Bug 788087 - Apply matrices to Azure/Cairo patterns. r=joe
authorAnthony Jones <ajones@mozilla.com>
Tue, 04 Sep 2012 21:01:57 -0400
changeset 104242 bc9be79a2eeb1883b19f3cab74ce821c7b45be95
parent 104241 4e1c9887f87d20afc5746cc707f1533f79cc77c6
child 104243 3f42b12798954e0f41c78a1a17abc1862cbc163c
push id14416
push userryanvm@gmail.com
push dateWed, 05 Sep 2012 01:02:06 +0000
treeherdermozilla-inbound@3f42b1279895 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjoe
bugs788087
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 788087 - Apply matrices to Azure/Cairo patterns. r=joe
gfx/2d/DrawTargetCairo.cpp
--- a/gfx/2d/DrawTargetCairo.cpp
+++ b/gfx/2d/DrawTargetCairo.cpp
@@ -191,16 +191,26 @@ GfxPatternToCairoPattern(const Pattern& 
     }
 
     case PATTERN_SURFACE:
     {
       const SurfacePattern& pattern = static_cast<const SurfacePattern&>(aPattern);
       cairo_surface_t* surf = GetCairoSurfaceForSourceSurface(pattern.mSurface);
 
       pat = cairo_pattern_create_for_surface(surf);
+
+      // The pattern matrix is a matrix that transforms the pattern into user
+      // space. Cairo takes a matrix that converts from user space to pattern
+      // space. Cairo therefore needs the inverse.
+
+      cairo_matrix_t mat;
+      GfxMatrixToCairoMatrix(pattern.mMatrix, mat);
+      cairo_matrix_invert(&mat);
+      cairo_pattern_set_matrix(pat, &mat);
+
       cairo_pattern_set_filter(pat, GfxFilterToCairoFilter(pattern.mFilter));
       cairo_pattern_set_extend(pat, GfxExtendToCairoExtend(pattern.mExtendMode));
 
       cairo_surface_destroy(surf);
 
       break;
     }
     case PATTERN_LINEAR_GRADIENT: