Chromium Code Reviews| Index: src/core/SkTileGrid.cpp |
| =================================================================== |
| --- src/core/SkTileGrid.cpp (revision 8533) |
| +++ src/core/SkTileGrid.cpp (working copy) |
| @@ -39,9 +39,6 @@ |
| SkIRect dilatedBounds = bounds; |
| dilatedBounds.outset(fInfo.fMargin.width(), fInfo.fMargin.height()); |
| dilatedBounds.offset(fInfo.fOffset); |
| - if (!SkIRect::Intersects(dilatedBounds, fGridBounds)) { |
|
Tom Hudson
2013/04/09 10:10:50
Either this code was erroneous, or the new version
|
| - return; |
| - } |
| // Note: SkIRects are non-inclusive of the right() column and bottom() row, |
| // hence the "-1"s in the computations of maxTileX and maxTileY. |
| @@ -75,16 +72,14 @@ |
| int tileStartY = adjustedQuery.top() / fInfo.fTileInterval.height(); |
| int tileEndY = (adjustedQuery.bottom() + fInfo.fTileInterval.height() - 1) / |
| fInfo.fTileInterval.height(); |
| - if (tileStartX >= fXTileCount || tileStartY >= fYTileCount || tileEndX <= 0 || tileEndY <= 0) { |
| - return; // query does not intersect the grid |
| - } |
| - // clamp to grid |
| - if (tileStartX < 0) tileStartX = 0; |
| - if (tileStartY < 0) tileStartY = 0; |
| - if (tileEndX > fXTileCount) tileEndX = fXTileCount; |
| - if (tileEndY > fYTileCount) tileEndY = fYTileCount; |
| + tileStartX = SkClampMinMax(tileStartX, 0, fXTileCount - 1); |
| + tileEndX = SkClampMinMax(tileEndX, 1, fXTileCount); |
| + tileStartY = SkClampMinMax(tileStartY, 0, fYTileCount - 1); |
| + tileEndY = SkClampMinMax(tileEndY, 1, fYTileCount); |
| + |
| int queryTileCount = (tileEndX - tileStartX) * (tileEndY - tileStartY); |
| + SkASSERT(queryTileCount); |
| if (queryTileCount == 1) { |
| *results = this->tile(tileStartX, tileStartY); |
| } else { |