Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Unified Diff: Source/WebCore/platform/graphics/gpu/TilingData.cpp

Issue 7590009: Merge 92255 - Source/WebCore: [Chromium] Use edge-distance method for layer anti-aliasing. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/platform/graphics/gpu/TilingData.h ('k') | Source/WebKit/chromium/tests/TilingDataTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « Source/WebCore/platform/graphics/gpu/TilingData.h ('k') | Source/WebKit/chromium/tests/TilingDataTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698