зеркало из https://github.com/mozilla/gecko-dev.git
Bug 907011 - Implement pattern matrices for the Cairo Azure backend. r=Bas
This commit is contained in:
Родитель
e24181566b
Коммит
f8e8d3bb7a
|
@ -255,6 +255,7 @@ static cairo_pattern_t*
|
|||
GfxPatternToCairoPattern(const Pattern& aPattern, Float aAlpha)
|
||||
{
|
||||
cairo_pattern_t* pat;
|
||||
const Matrix* matrix = nullptr;
|
||||
|
||||
switch (aPattern.GetType())
|
||||
{
|
||||
|
@ -272,14 +273,7 @@ GfxPatternToCairoPattern(const Pattern& aPattern, Float aAlpha)
|
|||
|
||||
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);
|
||||
matrix = &pattern.mMatrix;
|
||||
|
||||
cairo_pattern_set_filter(pat, GfxFilterToCairoFilter(pattern.mFilter));
|
||||
cairo_pattern_set_extend(pat, GfxExtendToCairoExtend(pattern.mExtendMode));
|
||||
|
@ -299,6 +293,8 @@ GfxPatternToCairoPattern(const Pattern& aPattern, Float aAlpha)
|
|||
GradientStopsCairo* cairoStops = static_cast<GradientStopsCairo*>(pattern.mStops.get());
|
||||
cairo_pattern_set_extend(pat, GfxExtendToCairoExtend(cairoStops->GetExtendMode()));
|
||||
|
||||
matrix = &pattern.mMatrix;
|
||||
|
||||
const std::vector<GradientStop>& stops = cairoStops->GetStops();
|
||||
for (size_t i = 0; i < stops.size(); ++i) {
|
||||
const GradientStop& stop = stops[i];
|
||||
|
@ -320,6 +316,8 @@ GfxPatternToCairoPattern(const Pattern& aPattern, Float aAlpha)
|
|||
GradientStopsCairo* cairoStops = static_cast<GradientStopsCairo*>(pattern.mStops.get());
|
||||
cairo_pattern_set_extend(pat, GfxExtendToCairoExtend(cairoStops->GetExtendMode()));
|
||||
|
||||
matrix = &pattern.mMatrix;
|
||||
|
||||
const std::vector<GradientStop>& stops = cairoStops->GetStops();
|
||||
for (size_t i = 0; i < stops.size(); ++i) {
|
||||
const GradientStop& stop = stops[i];
|
||||
|
@ -337,6 +335,16 @@ GfxPatternToCairoPattern(const Pattern& aPattern, Float aAlpha)
|
|||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
if (matrix) {
|
||||
cairo_matrix_t mat;
|
||||
GfxMatrixToCairoMatrix(*matrix, mat);
|
||||
cairo_matrix_invert(&mat);
|
||||
cairo_pattern_set_matrix(pat, &mat);
|
||||
}
|
||||
|
||||
return pat;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче