This commit is contained in:
Robert O'Callahan 2012-07-02 14:43:37 +12:00
Родитель 0bde718f71
Коммит cedd410a70
3 изменённых файлов: 7 добавлений и 20 удалений

Просмотреть файл

@ -2099,4 +2099,4 @@ gfxContext::ChangeTransform(const Matrix &aNewMatrix)
} }
mDT->SetTransform(aNewMatrix); mDT->SetTransform(aNewMatrix);
} }

Просмотреть файл

@ -1997,7 +1997,6 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
// Create the gradient pattern. // Create the gradient pattern.
nsRefPtr<gfxPattern> gradientPattern; nsRefPtr<gfxPattern> gradientPattern;
bool forceRepeatToCoverTiles = false;
if (aGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) { if (aGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) {
// Compute the actual gradient line ends we need to pass to cairo after // Compute the actual gradient line ends we need to pass to cairo after
// stops have been normalized. // stops have been normalized.
@ -2016,16 +2015,6 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
gradientPattern = new gfxPattern(gradientStart.x, gradientStart.y, gradientPattern = new gfxPattern(gradientStart.x, gradientStart.y,
gradientEnd.x, gradientEnd.y); gradientEnd.x, gradientEnd.y);
// When the gradient line is parallel to the x axis from the left edge
// to the right edge of a tile, then we can repeat by just repeating the
// gradient.
if ((gradientStart.y == gradientEnd.y && gradientStart.x == 0 &&
gradientEnd.x == oneCellArea.width) ||
(gradientStart.x == gradientEnd.x && gradientStart.y == 0 &&
gradientEnd.y == oneCellArea.height)) {
forceRepeatToCoverTiles = true;
}
} else { } else {
NS_ASSERTION(firstStop >= 0.0, NS_ASSERTION(firstStop >= 0.0,
"Negative stops not allowed for radial gradients"); "Negative stops not allowed for radial gradients");
@ -2076,7 +2065,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
} }
// Set repeat mode. Default cairo extend mode is PAD. // Set repeat mode. Default cairo extend mode is PAD.
if (aGradient->mRepeating || forceRepeatToCoverTiles) { if (aGradient->mRepeating) {
gradientPattern->SetExtend(gfxPattern::EXTEND_REPEAT); gradientPattern->SetExtend(gfxPattern::EXTEND_REPEAT);
} }
@ -2095,9 +2084,8 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
// xStart/yStart are the top-left corner of the top-left tile. // xStart/yStart are the top-left corner of the top-left tile.
nscoord xStart = FindTileStart(dirty.x, aOneCellArea.x, aOneCellArea.width); nscoord xStart = FindTileStart(dirty.x, aOneCellArea.x, aOneCellArea.width);
nscoord yStart = FindTileStart(dirty.y, aOneCellArea.y, aOneCellArea.height); nscoord yStart = FindTileStart(dirty.y, aOneCellArea.y, aOneCellArea.height);
nscoord xEnd = forceRepeatToCoverTiles ? xStart + aOneCellArea.width : dirty.XMost(); nscoord xEnd = dirty.XMost();
nscoord yEnd = forceRepeatToCoverTiles ? yStart + aOneCellArea.height : dirty.YMost(); nscoord yEnd = dirty.YMost();
// x and y are the top-left corner of the tile to draw // x and y are the top-left corner of the tile to draw
for (nscoord y = yStart; y < yEnd; y += aOneCellArea.height) { for (nscoord y = yStart; y < yEnd; y += aOneCellArea.height) {
for (nscoord x = xStart; x < xEnd; x += aOneCellArea.width) { for (nscoord x = xStart; x < xEnd; x += aOneCellArea.width) {
@ -2107,8 +2095,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
appUnitsPerPixel); appUnitsPerPixel);
// The actual area to fill with this tile is the intersection of this // The actual area to fill with this tile is the intersection of this
// tile with the overall area we're supposed to be filling // tile with the overall area we're supposed to be filling
gfxRect fillRect = gfxRect fillRect = tileRect.Intersect(areaToFill);
forceRepeatToCoverTiles ? areaToFill : tileRect.Intersect(areaToFill);
ctx->NewPath(); ctx->NewPath();
ctx->Translate(tileRect.TopLeft()); ctx->Translate(tileRect.TopLeft());
ctx->SetPattern(gradientPattern); ctx->SetPattern(gradientPattern);

Просмотреть файл

@ -35,8 +35,8 @@ random-if(d2d) == element-paint-transform-02.html element-paint-transform-02-ref
random-if(!cocoaWidget) == gradient-html-03.html gradient-html-03-ref.svg random-if(!cocoaWidget) == gradient-html-03.html gradient-html-03-ref.svg
== gradient-html-04.html gradient-html-04-ref.html == gradient-html-04.html gradient-html-04-ref.html
== gradient-html-05.html gradient-html-05-ref.html == gradient-html-05.html gradient-html-05-ref.html
fuzzy(1,9627) random-if(!cocoaWidget) == gradient-html-06a.html gradient-html-06b.html random-if(!cocoaWidget) == gradient-html-06a.html gradient-html-06b.html
fuzzy(1,9627) random-if(!cocoaWidget) == gradient-html-06b.html gradient-html-06c.html random-if(!cocoaWidget) == gradient-html-06b.html gradient-html-06c.html
== gradient-html-06c.html gradient-html-06d.html == gradient-html-06c.html gradient-html-06d.html
== gradient-html-06d.html gradient-html-06e.html == gradient-html-06d.html gradient-html-06e.html
random-if(!cocoaWidget) == gradient-html-07a.html gradient-html-07b.html random-if(!cocoaWidget) == gradient-html-07a.html gradient-html-07b.html