Index: Source/WebCore/platform/graphics/gpu/TilingData.cpp |
=================================================================== |
--- Source/WebCore/platform/graphics/gpu/TilingData.cpp (revision 92714) |
+++ Source/WebCore/platform/graphics/gpu/TilingData.cpp (working copy) |
@@ -44,12 +44,10 @@ |
static int computeNumTiles(int maxTextureSize, int totalSize, int borderTexels) |
{ |
- int totalSizeWithBorder = totalSize + 2 * borderTexels; |
- |
if (maxTextureSize - 2 * borderTexels <= 0) |
- return 0; |
+ return totalSize > 0 && maxTextureSize >= totalSize ? 1 : 0; |
- int numTiles = max(1, 1 + (totalSizeWithBorder - 1 - 2 * borderTexels) / (maxTextureSize - 2 * borderTexels)); |
+ int numTiles = max(1, 1 + (totalSize - 1 - 2 * borderTexels) / (maxTextureSize - 2 * borderTexels)); |
return totalSize > 0 ? numTiles : 0; |
} |
@@ -81,7 +79,7 @@ |
return 0; |
ASSERT(m_maxTextureSize - 2 * m_borderTexels); |
- int x = srcPos / (m_maxTextureSize - 2 * m_borderTexels); |
+ int x = (srcPos - m_borderTexels) / (m_maxTextureSize - 2 * m_borderTexels); |
return min(max(x, 0), numTilesX() - 1); |
} |
@@ -91,7 +89,7 @@ |
return 0; |
ASSERT(m_maxTextureSize - 2 * m_borderTexels); |
- int y = srcPos / (m_maxTextureSize - 2 * m_borderTexels); |
+ int y = (srcPos - m_borderTexels) / (m_maxTextureSize - 2 * m_borderTexels); |
return min(max(y, 0), numTilesY() - 1); |
} |
@@ -134,16 +132,6 @@ |
return bounds; |
} |
-IntRect TilingData::tileBoundsWithOuterBorder(int tile) const |
-{ |
- IntRect bounds = tileBounds(tile); |
- |
- if (m_borderTexels) |
- bounds.inflate(1); |
- |
- return bounds; |
-} |
- |
FloatRect TilingData::tileBoundsNormalized(int tile) const |
{ |
assertTile(tile); |
@@ -180,6 +168,8 @@ |
if (!xIndex && m_numTilesX == 1) |
return m_totalSizeX; |
+ if (!xIndex && m_numTilesX > 1) |
+ return m_maxTextureSize - m_borderTexels; |
if (xIndex < numTilesX() - 1) |
return m_maxTextureSize - 2 * m_borderTexels; |
if (xIndex == numTilesX() - 1) |
@@ -195,6 +185,8 @@ |
if (!yIndex && m_numTilesY == 1) |
return m_totalSizeY; |
+ if (!yIndex && m_numTilesY > 1) |
+ return m_maxTextureSize - m_borderTexels; |
if (yIndex < numTilesY() - 1) |
return m_maxTextureSize - 2 * m_borderTexels; |
if (yIndex == numTilesY() - 1) |
@@ -238,8 +230,8 @@ |
*newSrc = srcRectIntersected; |
newSrc->move( |
- -tileBounds.x() + m_borderTexels, |
- -tileBounds.y() + m_borderTexels); |
+ -tileBounds.x() + ((tileXIndex(tile) > 0) ? m_borderTexels : 0), |
+ -tileBounds.y() + ((tileYIndex(tile) > 0) ? m_borderTexels : 0)); |
*newDst = FloatRect( |
srcRectIntersectedNormX * dstRect.width() + dstRect.x(), |
@@ -248,9 +240,12 @@ |
srcRectIntersectedNormH * dstRect.height()); |
} |
-IntPoint TilingData::textureOffset() const |
+IntPoint TilingData::textureOffset(int xIndex, int yIndex) const |
{ |
- return IntPoint(m_borderTexels, m_borderTexels); |
+ int left = (!xIndex || m_numTilesX == 1) ? 0 : m_borderTexels; |
+ int top = (!yIndex || m_numTilesY == 1) ? 0 : m_borderTexels; |
+ |
+ return IntPoint(left, top); |
} |
void TilingData::recomputeNumTiles() |