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

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

@ -1997,7 +1997,6 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
// Create the gradient pattern.
nsRefPtr<gfxPattern> gradientPattern;
bool forceRepeatToCoverTiles = false;
if (aGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) {
// Compute the actual gradient line ends we need to pass to cairo after
// stops have been normalized.
@ -2016,16 +2015,6 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
gradientPattern = new gfxPattern(gradientStart.x, gradientStart.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 {
NS_ASSERTION(firstStop >= 0.0,
"Negative stops not allowed for radial gradients");
@ -2076,7 +2065,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
}
// Set repeat mode. Default cairo extend mode is PAD.
if (aGradient->mRepeating || forceRepeatToCoverTiles) {
if (aGradient->mRepeating) {
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.
nscoord xStart = FindTileStart(dirty.x, aOneCellArea.x, aOneCellArea.width);
nscoord yStart = FindTileStart(dirty.y, aOneCellArea.y, aOneCellArea.height);
nscoord xEnd = forceRepeatToCoverTiles ? xStart + aOneCellArea.width : dirty.XMost();
nscoord yEnd = forceRepeatToCoverTiles ? yStart + aOneCellArea.height : dirty.YMost();
nscoord xEnd = dirty.XMost();
nscoord yEnd = dirty.YMost();
// x and y are the top-left corner of the tile to draw
for (nscoord y = yStart; y < yEnd; y += aOneCellArea.height) {
for (nscoord x = xStart; x < xEnd; x += aOneCellArea.width) {
@ -2107,8 +2095,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
appUnitsPerPixel);
// The actual area to fill with this tile is the intersection of this
// tile with the overall area we're supposed to be filling
gfxRect fillRect =
forceRepeatToCoverTiles ? areaToFill : tileRect.Intersect(areaToFill);
gfxRect fillRect = tileRect.Intersect(areaToFill);
ctx->NewPath();
ctx->Translate(tileRect.TopLeft());
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
== gradient-html-04.html gradient-html-04-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
fuzzy(1,9627) random-if(!cocoaWidget) == gradient-html-06b.html gradient-html-06c.html
random-if(!cocoaWidget) == gradient-html-06a.html gradient-html-06b.html
random-if(!cocoaWidget) == gradient-html-06b.html gradient-html-06c.html
== gradient-html-06c.html gradient-html-06d.html
== gradient-html-06d.html gradient-html-06e.html
random-if(!cocoaWidget) == gradient-html-07a.html gradient-html-07b.html