Applied an upside-down scale transformation to the pattern matrix,

otherwise patterns end up upside-down relative to other graphics
interfaces.
This commit is contained in:
Tim Edwards 2017-09-15 14:55:41 -04:00
parent bf5bb09f50
commit f12d98c2c7
2 changed files with 8 additions and 2 deletions

View File

@ -216,6 +216,8 @@ grtcairoSetStipple (stipple)
int stipple; /* The stipple number to be used. */
{
static int oldStip = -1;
cairo_matrix_t matrix;
if (stipple == oldStip) return;
oldStip = stipple;
GR_TCAIRO_FLUSH_BATCH();
@ -223,6 +225,10 @@ int stipple; /* The stipple number to be used. */
currentStipple = cairo_pattern_create_rgba(0, 0, 0, 1);
} else {
if (stipplePatterns[stipple] == (cairo_pattern_t *)NULL) MainExit(1);
/* Patterns will be upside-down if not transformed like the window */
cairo_matrix_init_scale (&matrix, 1.0, -1.0);
cairo_pattern_set_matrix (stipplePatterns[stipple], &matrix);
cairo_pattern_set_extend(stipplePatterns[stipple], CAIRO_EXTEND_REPEAT);
cairo_pattern_set_filter(stipplePatterns[stipple], CAIRO_FILTER_NEAREST);
currentStipple = stipplePatterns[stipple];

View File

@ -743,8 +743,8 @@ typedef struct LayerInstance {
*/
static int ImgLayerCreate _ANSI_ARGS_((Tcl_Interp *interp,
const char *name, int argc, Tcl_Obj *CONST objv[],
const Tk_ImageType *typePtr, Tk_ImageMaster master,
CONST86 char *name, int argc, Tcl_Obj *const objv[],
CONST86 Tk_ImageType *typePtr, Tk_ImageMaster master,
ClientData *clientDataPtr));
static ClientData ImgLayerGet _ANSI_ARGS_((Tk_Window tkwin,
ClientData clientData));