Unreviewed, rolling out r112432.
authorenne@google.com <enne@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Mar 2012 22:07:25 +0000 (22:07 +0000)
committerenne@google.com <enne@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Mar 2012 22:07:25 +0000 (22:07 +0000)
http://trac.webkit.org/changeset/112432
https://bugs.webkit.org/show_bug.cgi?id=82536

Causes ccs3 layout test asserts (Requested by enne on
#webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-03-28

Source/WebCore:

* platform/graphics/chromium/TiledLayerChromium.cpp:
(WebCore::TiledLayerChromium::drawsContent):
(WebCore::TiledLayerChromium::reserveTextures):
(WebCore::TiledLayerChromium::prepareToUpdate):
(WebCore::TiledLayerChromium::prepareToUpdateIdle):
(WebCore::TiledLayerChromium::needsIdlePaint):
(WebCore::TiledLayerChromium::idlePaintRect):
* platform/graphics/chromium/cc/CCLayerTilingData.cpp:
(WebCore::CCLayerTilingData::tileRect):
* platform/graphics/chromium/cc/CCLayerTilingData.h:
(WebCore::CCLayerTilingData::numTiles):
(WebCore::CCLayerTilingData::tileBounds):
(WebCore::CCLayerTilingData::isEmpty):
* platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:
(WebCore::CCTiledLayerImpl::bindContentsTexture):
(WebCore::CCTiledLayerImpl::appendQuads):
* platform/graphics/filters/FECustomFilter.cpp:
(WebCore::FECustomFilter::platformApplySoftware):
* platform/graphics/gpu/Texture.cpp:
(WebCore::Texture::create):
(WebCore::Texture::updateSubRect):
* platform/graphics/gpu/TilingData.cpp:
(WebCore::TilingData::tileBounds):
(WebCore::TilingData::tileBoundsWithBorder):
(WebCore::TilingData::tileBoundsNormalized):
(WebCore::TilingData::intersectDrawQuad):
(WebCore):
* platform/graphics/gpu/TilingData.h:
(WebCore::TilingData::numTiles):
(WebCore::TilingData::tileIndex):
(WebCore::TilingData::tileXIndex):
(WebCore::TilingData::tileYIndex):
(TilingData):
(WebCore::TilingData::assertTile):

Source/WebKit/chromium:

* tests/TiledLayerChromiumTest.cpp:
* tests/TilingDataTest.cpp:
(WebCore::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112449 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h
Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp
Source/WebCore/platform/graphics/filters/FECustomFilter.cpp
Source/WebCore/platform/graphics/gpu/Texture.cpp
Source/WebCore/platform/graphics/gpu/TilingData.cpp
Source/WebCore/platform/graphics/gpu/TilingData.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp
Source/WebKit/chromium/tests/TilingDataTest.cpp

index 5befc36..0de5d87 100644 (file)
@@ -1,3 +1,47 @@
+2012-03-28  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r112432.
+        http://trac.webkit.org/changeset/112432
+        https://bugs.webkit.org/show_bug.cgi?id=82536
+
+        Causes ccs3 layout test asserts (Requested by enne on
+        #webkit).
+
+        * platform/graphics/chromium/TiledLayerChromium.cpp:
+        (WebCore::TiledLayerChromium::drawsContent):
+        (WebCore::TiledLayerChromium::reserveTextures):
+        (WebCore::TiledLayerChromium::prepareToUpdate):
+        (WebCore::TiledLayerChromium::prepareToUpdateIdle):
+        (WebCore::TiledLayerChromium::needsIdlePaint):
+        (WebCore::TiledLayerChromium::idlePaintRect):
+        * platform/graphics/chromium/cc/CCLayerTilingData.cpp:
+        (WebCore::CCLayerTilingData::tileRect):
+        * platform/graphics/chromium/cc/CCLayerTilingData.h:
+        (WebCore::CCLayerTilingData::numTiles):
+        (WebCore::CCLayerTilingData::tileBounds):
+        (WebCore::CCLayerTilingData::isEmpty):
+        * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:
+        (WebCore::CCTiledLayerImpl::bindContentsTexture):
+        (WebCore::CCTiledLayerImpl::appendQuads):
+        * platform/graphics/filters/FECustomFilter.cpp:
+        (WebCore::FECustomFilter::platformApplySoftware):
+        * platform/graphics/gpu/Texture.cpp:
+        (WebCore::Texture::create):
+        (WebCore::Texture::updateSubRect):
+        * platform/graphics/gpu/TilingData.cpp:
+        (WebCore::TilingData::tileBounds):
+        (WebCore::TilingData::tileBoundsWithBorder):
+        (WebCore::TilingData::tileBoundsNormalized):
+        (WebCore::TilingData::intersectDrawQuad):
+        (WebCore):
+        * platform/graphics/gpu/TilingData.h:
+        (WebCore::TilingData::numTiles):
+        (WebCore::TilingData::tileIndex):
+        (WebCore::TilingData::tileXIndex):
+        (WebCore::TilingData::tileYIndex):
+        (TilingData):
+        (WebCore::TilingData::assertTile):
+
 2012-03-27  Daniel Cheng  <dcheng@chromium.org>
 
         [chromium] Merge ChromiumDataObject and DataTransferItemListChromium.
index 010a431..456632c 100644 (file)
@@ -166,8 +166,7 @@ bool TiledLayerChromium::drawsContent() const
     if (!LayerChromium::drawsContent())
         return false;
 
-    bool hasMoreThanOneTile = m_tiler->numTilesX() > 1 || m_tiler->numTilesY() > 1;
-    if (m_tilingOption == NeverTile && hasMoreThanOneTile)
+    if (m_tilingOption == NeverTile && m_tiler->numTiles() > 1)
         return false;
 
     return true;
@@ -557,7 +556,7 @@ void TiledLayerChromium::reserveTextures()
     updateBounds();
 
     const IntRect& layerRect = visibleLayerRect();
-    if (layerRect.isEmpty() || m_tiler->hasEmptyBounds())
+    if (layerRect.isEmpty() || !m_tiler->numTiles())
         return;
 
     int left, top, right, bottom;
@@ -610,7 +609,7 @@ void TiledLayerChromium::prepareToUpdate(const IntRect& layerRect, const CCOcclu
 
     resetUpdateState();
 
-    if (layerRect.isEmpty() || m_tiler->hasEmptyBounds())
+    if (layerRect.isEmpty() || !m_tiler->numTiles())
         return;
 
     int left, top, right, bottom;
@@ -629,7 +628,7 @@ void TiledLayerChromium::prepareToUpdateIdle(const IntRect& layerRect, const CCO
 
     updateBounds();
 
-    if (m_tiler->hasEmptyBounds())
+    if (!m_tiler->numTiles())
         return;
 
     IntRect idlePaintLayerRect = idlePaintRect(layerRect);
@@ -702,7 +701,7 @@ bool TiledLayerChromium::needsIdlePaint(const IntRect& layerRect)
     if (m_skipsIdlePaint)
         return false;
 
-    if (m_tiler->hasEmptyBounds())
+    if (!m_tiler->numTiles())
         return false;
 
     IntRect idlePaintLayerRect = idlePaintRect(layerRect);
@@ -732,8 +731,7 @@ IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleLayerRect)
     // of them is going to become visible. For small layers we return the entire layer, for larger
     // ones we avoid prepainting the layer at all.
     if (visibleLayerRect.isEmpty()) {
-        bool isSmallLayer = m_tiler->numTilesX() <= 9 && m_tiler->numTilesY() <= 9 && m_tiler->numTilesX() * m_tiler->numTilesY() <= 9;
-        if ((drawTransformIsAnimating() || screenSpaceTransformIsAnimating()) && isSmallLayer)
+        if ((drawTransformIsAnimating() || screenSpaceTransformIsAnimating()) && m_tiler->numTiles() <= 9)
             return IntRect(IntPoint(), contentBounds());
         return IntRect();
     }
index 42f1e8d..19d0251 100644 (file)
@@ -106,7 +106,8 @@ void CCLayerTilingData::layerRectToTileIndices(const IntRect& layerRect, int& le
 
 IntRect CCLayerTilingData::tileRect(const Tile* tile) const
 {
-    IntRect tileRect = m_tilingData.tileBoundsWithBorder(tile->i(), tile->j());
+    const int index = m_tilingData.tileIndex(tile->i(), tile->j());
+    IntRect tileRect = m_tilingData.tileBoundsWithBorder(index);
     tileRect.setSize(m_tileSize);
     return tileRect;
 }
index d87dcd2..9e18695 100644 (file)
@@ -44,10 +44,10 @@ public:
 
     static PassOwnPtr<CCLayerTilingData> create(const IntSize& tileSize, BorderTexelOption);
 
-    bool hasEmptyBounds() const { return m_tilingData.hasEmptyBounds(); }
+    int numTiles() const { return m_tilingData.numTiles(); }
     int numTilesX() const { return m_tilingData.numTilesX(); }
     int numTilesY() const { return m_tilingData.numTilesY(); }
-    IntRect tileBounds(int i, int j) const { return m_tilingData.tileBounds(i, j); }
+    IntRect tileBounds(int i, int j) const { return m_tilingData.tileBounds(m_tilingData.tileIndex(i, j)); }
     IntPoint textureOffset(int xIndex, int yIndex) const { return m_tilingData.textureOffset(xIndex, yIndex); }
 
     // Change the tile size. This may invalidate all the existing tiles.
@@ -57,7 +57,7 @@ public:
     void setBorderTexelOption(BorderTexelOption);
     bool hasBorderTexels() const { return m_tilingData.borderTexels(); }
 
-    bool isEmpty() const { return hasEmptyBounds() || !tiles().size(); }
+    bool isEmpty() const { return !m_tilingData.numTiles() || !tiles().size(); }
 
     const CCLayerTilingData& operator=(const CCLayerTilingData&);
 
index 1051165..da83e65 100644 (file)
@@ -80,8 +80,7 @@ void CCTiledLayerImpl::bindContentsTexture(LayerRendererChromium* layerRenderer)
 {
     // This function is only valid for single texture layers, e.g. masks.
     ASSERT(m_tiler);
-    ASSERT(m_tiler->numTilesX() == 1);
-    ASSERT(m_tiler->numTilesY() == 1);
+    ASSERT(m_tiler->numTiles() == 1);
 
     DrawableTile* tile = tileAt(0, 0);
     Platform3DObject textureId = tile ? tile->textureId() : 0;
@@ -144,7 +143,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta
 
     appendGutterQuads(quadList, sharedQuadState);
 
-    if (!m_tiler || m_tiler->hasEmptyBounds() || layerRect.isEmpty())
+    if (!m_tiler || !m_tiler->numTiles() || layerRect.isEmpty())
         return;
 
     int left, top, right, bottom;
index 23b6fe1..db8d3d9 100644 (file)
@@ -112,7 +112,7 @@ void FECustomFilter::platformApplySoftware()
         resizeContext(newContextSize);
     
     // Do not draw the filter if the input image cannot fit inside a single GPU texture.
-    if (m_inputTexture->tiles().numTilesX() != 1 || m_inputTexture->tiles().numTilesY() != 1)
+    if (m_inputTexture->tiles().numTiles() != 1)
         return;
     
     // The shader had compiler errors. We cannot draw anything.
index 3cad13a..5ff7d81 100644 (file)
@@ -90,13 +90,7 @@ PassRefPtr<Texture> Texture::create(GraphicsContext3D* context, Format format, i
     int maxTextureSize = 0;
     context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &maxTextureSize);
     TilingData tiling(maxTextureSize, width, height, true);
-
-    // Check for overflow.
-    int numTiles = width * height;
-    if (numTiles / width != height) {
-        tiling.setTotalSize(0, 0);
-        numTiles = 0;
-    }
+    int numTiles = tiling.numTiles();
 
     OwnPtr<Vector<unsigned int> > textureIds = adoptPtr(new Vector<unsigned int>(numTiles));
     textureIds->fill(0, numTiles);
@@ -110,9 +104,7 @@ PassRefPtr<Texture> Texture::create(GraphicsContext3D* context, Format format, i
         }
         textureIds->at(i) = textureId;
 
-        int xIndex = i % width;
-        int yIndex = i / width;
-        IntRect tileBoundsWithBorder = tiling.tileBoundsWithBorder(xIndex, yIndex);
+        IntRect tileBoundsWithBorder = tiling.tileBoundsWithBorder(i);
 
         unsigned int glFormat = 0;
         unsigned int glType = 0;
@@ -176,12 +168,9 @@ void Texture::updateSubRect(void* pixels, const IntRect& updateRect)
         min(m_tiles.maxTextureSize(), m_tiles.borderTexels() + updateRectSanitized.height());
     OwnArrayPtr<uint32_t> tempBuff = adoptArrayPtr(new uint32_t[tempBuffSize]);
 
-    for (int tile = 0; tile < m_tiles.numTilesX() * m_tiles.numTilesY(); tile++) {
-        int xIndex = tile % m_tiles.totalSizeX();
-        int yIndex = tile / m_tiles.totalSizeX();
-
+    for (int tile = 0; tile < m_tiles.numTiles(); tile++) {
         // Intersect with tile
-        IntRect tileBoundsWithBorder = m_tiles.tileBoundsWithBorder(xIndex, yIndex);
+        IntRect tileBoundsWithBorder = m_tiles.tileBoundsWithBorder(tile);
 
         IntRect updateRectIntersected = updateRectSanitized;
         updateRectIntersected.intersect(tileBoundsWithBorder);
index 6bad628..20db441 100644 (file)
@@ -99,21 +99,23 @@ int TilingData::tileYIndexFromSrcCoord(int srcPos) const
     return min(max(y, 0), numTilesY() - 1);
 }
 
-IntRect TilingData::tileBounds(int i, int j) const
+IntRect TilingData::tileBounds(int tile) const
 {
-    assertTile(i, j);
-    int x = tilePositionX(i);
-    int y = tilePositionY(j);
-    int width = tileSizeX(i);
-    int height = tileSizeY(j);
+    assertTile(tile);
+    int ix = tileXIndex(tile);
+    int iy = tileYIndex(tile);
+    int x = tilePositionX(ix);
+    int y = tilePositionY(iy);
+    int width = tileSizeX(ix);
+    int height = tileSizeY(iy);
     ASSERT(x >= 0 && y >= 0 && width >= 0 && height >= 0);
     ASSERT(x <= totalSizeX() && y <= totalSizeY());
     return IntRect(x, y, width, height);
 }
 
-IntRect TilingData::tileBoundsWithBorder(int i, int j) const
+IntRect TilingData::tileBoundsWithBorder(int tile) const
 {
-    IntRect bounds = tileBounds(i, j);
+    IntRect bounds = tileBounds(tile);
 
     if (m_borderTexels) {
         int x1 = bounds.x();
@@ -121,13 +123,13 @@ IntRect TilingData::tileBoundsWithBorder(int i, int j) const
         int y1 = bounds.y();
         int y2 = bounds.maxY();
 
-        if (i > 0)
+        if (tileXIndex(tile) > 0)
             x1--;
-        if (i < (numTilesX() - 1))
+        if (tileXIndex(tile) < (numTilesX() - 1))
             x2++;
-        if (j > 0)
+        if (tileYIndex(tile) > 0)
             y1--;
-        if (j < (numTilesY() - 1))
+        if (tileYIndex(tile) < (numTilesY() - 1))
             y2++;
 
         bounds = IntRect(x1, y1, x2 - x1, y2 - y1);
@@ -136,10 +138,10 @@ IntRect TilingData::tileBoundsWithBorder(int i, int j) const
     return bounds;
 }
 
-FloatRect TilingData::tileBoundsNormalized(int i, int j) const
+FloatRect TilingData::tileBoundsNormalized(int tile) const
 {
-    assertTile(i, j);
-    FloatRect bounds(tileBounds(i, j));
+    assertTile(tile);
+    FloatRect bounds(tileBounds(tile));
     bounds.scale(1.0f / m_totalSizeX, 1.0f / m_totalSizeY);
     return bounds;
 }
@@ -214,6 +216,36 @@ IntRect TilingData::overlappedTileIndices(const WebCore::FloatRect &srcRect) con
     return overlappedTileIndices(enclosingIntRect(srcRect));
 }
 
+void TilingData::intersectDrawQuad(const FloatRect& srcRect, const FloatRect& dstRect, int tile,
+                                   FloatRect* newSrc, FloatRect* newDst) const
+{
+    // Intersect with tile
+    FloatRect tileBounds = this->tileBounds(tile);
+    FloatRect srcRectIntersected = srcRect;
+    srcRectIntersected.intersect(tileBounds);
+
+    if (srcRectIntersected.isEmpty()) {
+        *newSrc = *newDst = FloatRect(0, 0, 0, 0);
+        return;
+    }
+
+    float srcRectIntersectedNormX = (srcRectIntersected.x() - srcRect.x()) / srcRect.width();
+    float srcRectIntersectedNormY = (srcRectIntersected.y() - srcRect.y()) / srcRect.height();
+    float srcRectIntersectedNormW = srcRectIntersected.width() / srcRect.width();
+    float srcRectIntersectedNormH = srcRectIntersected.height() / srcRect.height();
+
+    *newSrc = srcRectIntersected;
+    newSrc->move(
+        -tileBounds.x() + ((tileXIndex(tile) > 0) ? m_borderTexels : 0),
+        -tileBounds.y() + ((tileYIndex(tile) > 0) ? m_borderTexels : 0));
+
+    *newDst = FloatRect(
+        srcRectIntersectedNormX * dstRect.width() + dstRect.x(),
+        srcRectIntersectedNormY * dstRect.height() + dstRect.y(),
+        srcRectIntersectedNormW * dstRect.width(),
+        srcRectIntersectedNormH * dstRect.height());
+}
+
 IntPoint TilingData::textureOffset(int xIndex, int yIndex) const
 {
     int left = (!xIndex || m_numTilesX == 1) ? 0 : m_borderTexels;
index 146dfe1..bc861ef 100644 (file)
@@ -50,15 +50,18 @@ public:
     void setHasBorderTexels(bool);
     int borderTexels() const { return m_borderTexels; }
 
-    bool hasEmptyBounds() const { return !numTilesX() || !numTilesY(); }
+    int numTiles() const { return numTilesX() * numTilesY(); }
     int numTilesX() const { return m_numTilesX; }
     int numTilesY() const { return m_numTilesY; }
+    int tileIndex(int x, int y) const { return x + y * numTilesX(); }
+    int tileXIndex(int tile) const { assertTile(tile); return tile % numTilesX(); }
+    int tileYIndex(int tile) const { assertTile(tile); return tile / numTilesX(); }
     int tileXIndexFromSrcCoord(int) const;
     int tileYIndexFromSrcCoord(int) const;
 
-    IntRect tileBounds(int, int) const;
-    IntRect tileBoundsWithBorder(int, int) const;
-    FloatRect tileBoundsNormalized(int, int) const;
+    IntRect tileBounds(int tile) const;
+    IntRect tileBoundsWithBorder(int tile) const;
+    FloatRect tileBoundsNormalized(int tile) const;
     int tilePositionX(int xIndex) const;
     int tilePositionY(int yIndex) const;
     int tileSizeX(int xIndex) const;
@@ -66,12 +69,16 @@ public:
     IntRect overlappedTileIndices(const IntRect& srcRect) const;
     IntRect overlappedTileIndices(const FloatRect& srcRect) const;
 
+    // Given a set of source and destination coordinates for a drawing quad
+    // in texel units, returns adjusted data to render just the one tile.
+    void intersectDrawQuad(const FloatRect& srcRect, const FloatRect& dstRect, int tile, FloatRect* newSrc, FloatRect* newDst) const;
+
     // Difference between tileBound's and tileBoundWithBorder's location().
     IntPoint textureOffset(int xIndex, int yIndex) const;
 
 private:
     TilingData() : m_maxTextureSize(0), m_totalSizeX(0), m_totalSizeY(0) {}
-    void assertTile(int i, int j) const { ASSERT_UNUSED(i, i >= 0 && i < numTilesX()); ASSERT_UNUSED(j, j >= 0 && j < numTilesY()); }
+    void assertTile(int tile) const { ASSERT_UNUSED(tile, tile >= 0 && tile < numTiles()); }
     void recomputeNumTiles();
 
     int m_maxTextureSize;
index d485e7b..4edcc30 100644 (file)
@@ -1,3 +1,16 @@
+2012-03-28  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r112432.
+        http://trac.webkit.org/changeset/112432
+        https://bugs.webkit.org/show_bug.cgi?id=82536
+
+        Causes ccs3 layout test asserts (Requested by enne on
+        #webkit).
+
+        * tests/TiledLayerChromiumTest.cpp:
+        * tests/TilingDataTest.cpp:
+        (WebCore::TEST):
+
 2012-03-27  Daniel Cheng  <dcheng@chromium.org>
 
         [chromium] Merge ChromiumDataObject and DataTransferItemListChromium.
index 46106e4..129c915 100644 (file)
@@ -1082,19 +1082,6 @@ TEST(TiledLayerChromiumTest, resizeToSmaller)
     layer->invalidateRect(IntRect(0, 0, 200, 200));
 }
 
-TEST(TiledLayerChromiumTest, hugeLayerUpdateCrash)
-{
-    OwnPtr<TextureManager> textureManager = TextureManager::create(60*1024*1024, 60*1024*1024, 1024);
-    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
-
-    int size = 1 << 30;
-    layer->setBounds(IntSize(size, size));
-    layer->invalidateRect(IntRect(0, 0, size, size));
-
-    // Ensure no crash for bounds where size * size would overflow an int.
-    layer->prepareToUpdate(IntRect(0, 0, 700, 700), 0);
-}
-
 TEST(TiledLayerChromiumTest, partialUpdates)
 {
     CCSettings settings;
index 408fdab..c29743f 100755 (executable)
@@ -38,406 +38,385 @@ using namespace WebCore;
 
 namespace {
 
-class TestTiling : public TilingData {
-public:
-    TestTiling(int maxTextureSize, int totalSizeX, int totalSizeY, bool hasBorderTexels)
-        : TilingData(maxTextureSize, totalSizeX, totalSizeY, hasBorderTexels)
-    {
-    }
-
-    // This function only available for testing because of potential overflow.
-    int numTiles() const
-    {
-        int numTiles = numTilesX() * numTilesY();
-
-        // Assert no overflow.
-        EXPECT_GE(numTiles, 0);
-        if (numTiles > 0)
-            EXPECT_EQ(numTiles / numTilesX(), numTilesY());
-
-        return numTiles;
-    }
-};
-
 TEST(TilingDataTest, numTiles_NoTiling)
 {
-    EXPECT_EQ(1, TestTiling(16, 16, 16, false).numTiles());
-    EXPECT_EQ(1, TestTiling(16, 15, 15, true).numTiles());
-    EXPECT_EQ(1, TestTiling(16, 16, 16, true).numTiles());
-    EXPECT_EQ(1, TestTiling(16,  1, 16, false).numTiles());
-    EXPECT_EQ(1, TestTiling(15, 15, 15, true).numTiles());
+    EXPECT_EQ(1, TilingData(16, 16, 16, false).numTiles());
+    EXPECT_EQ(1, TilingData(16, 15, 15, true).numTiles());
+    EXPECT_EQ(1, TilingData(16, 16, 16, true).numTiles());
+    EXPECT_EQ(1, TilingData(16,  1, 16, false).numTiles());
+    EXPECT_EQ(1, TilingData(15, 15, 15, true).numTiles());
 }
 
 TEST(TilingDataTest, numTiles_TilingNoBorders)
 {
-    EXPECT_EQ(0, TestTiling(0,  0,  0, false).numTiles());
-    EXPECT_EQ(0, TestTiling(0,  4,  0, false).numTiles());
-    EXPECT_EQ(0, TestTiling(0,  0,  4, false).numTiles());
-    EXPECT_EQ(0, TestTiling(4,  4,  0, false).numTiles());
-    EXPECT_EQ(0, TestTiling(4,  0,  4, false).numTiles());
-    EXPECT_EQ(0, TestTiling(-8, 1,  1, false).numTiles());
-    EXPECT_EQ(0, TestTiling(-1, 1,  1, false).numTiles());
-    EXPECT_EQ(0, TestTiling(0,  1,  1, false).numTiles());
-
-    EXPECT_EQ(1, TestTiling(1,  1,  1, false).numTiles());
-    EXPECT_EQ(2, TestTiling(1,  1,  2, false).numTiles());
-    EXPECT_EQ(2, TestTiling(1,  2,  1, false).numTiles());
-    EXPECT_EQ(1, TestTiling(2,  1,  1, false).numTiles());
-    EXPECT_EQ(1, TestTiling(2,  1,  2, false).numTiles());
-    EXPECT_EQ(1, TestTiling(2,  2,  1, false).numTiles());
-    EXPECT_EQ(1, TestTiling(2,  2,  2, false).numTiles());
-    EXPECT_EQ(1, TestTiling(3,  3,  3, false).numTiles());
-
-    EXPECT_EQ(1, TestTiling(4,  1,  4, false).numTiles());
-    EXPECT_EQ(1, TestTiling(4,  2,  4, false).numTiles());
-    EXPECT_EQ(1, TestTiling(4,  3,  4, false).numTiles());
-    EXPECT_EQ(1, TestTiling(4,  4,  4, false).numTiles());
-    EXPECT_EQ(2, TestTiling(4,  5,  4, false).numTiles());
-    EXPECT_EQ(2, TestTiling(4,  6,  4, false).numTiles());
-    EXPECT_EQ(2, TestTiling(4,  7,  4, false).numTiles());
-    EXPECT_EQ(2, TestTiling(4,  8,  4, false).numTiles());
-    EXPECT_EQ(3, TestTiling(4,  9,  4, false).numTiles());
-    EXPECT_EQ(3, TestTiling(4, 10,  4, false).numTiles());
-    EXPECT_EQ(3, TestTiling(4, 11,  4, false).numTiles());
-
-    EXPECT_EQ(1, TestTiling(5,  1,  5, false).numTiles());
-    EXPECT_EQ(1, TestTiling(5,  2,  5, false).numTiles());
-    EXPECT_EQ(1, TestTiling(5,  3,  5, false).numTiles());
-    EXPECT_EQ(1, TestTiling(5,  4,  5, false).numTiles());
-    EXPECT_EQ(1, TestTiling(5,  5,  5, false).numTiles());
-    EXPECT_EQ(2, TestTiling(5,  6,  5, false).numTiles());
-    EXPECT_EQ(2, TestTiling(5,  7,  5, false).numTiles());
-    EXPECT_EQ(2, TestTiling(5,  8,  5, false).numTiles());
-    EXPECT_EQ(2, TestTiling(5,  9,  5, false).numTiles());
-    EXPECT_EQ(2, TestTiling(5, 10,  5, false).numTiles());
-    EXPECT_EQ(3, TestTiling(5, 11,  5, false).numTiles());
-
-    EXPECT_EQ(1, TestTiling(16, 16, 16, false).numTiles());
-    EXPECT_EQ(1, TestTiling(17, 16, 16, false).numTiles());
-    EXPECT_EQ(4, TestTiling(15, 16, 16, false).numTiles());
-    EXPECT_EQ(4, TestTiling(8, 16, 16, false).numTiles());
-    EXPECT_EQ(6, TestTiling(8, 17, 16, false).numTiles());
+    EXPECT_EQ(0, TilingData(0,  0,  0, false).numTiles());
+    EXPECT_EQ(0, TilingData(0,  4,  0, false).numTiles());
+    EXPECT_EQ(0, TilingData(0,  0,  4, false).numTiles());
+    EXPECT_EQ(0, TilingData(4,  4,  0, false).numTiles());
+    EXPECT_EQ(0, TilingData(4,  0,  4, false).numTiles());
+    EXPECT_EQ(0, TilingData(-8, 1,  1, false).numTiles());
+    EXPECT_EQ(0, TilingData(-1, 1,  1, false).numTiles());
+    EXPECT_EQ(0, TilingData(0,  1,  1, false).numTiles());
+
+    EXPECT_EQ(1, TilingData(1,  1,  1, false).numTiles());
+    EXPECT_EQ(2, TilingData(1,  1,  2, false).numTiles());
+    EXPECT_EQ(2, TilingData(1,  2,  1, false).numTiles());
+    EXPECT_EQ(1, TilingData(2,  1,  1, false).numTiles());
+    EXPECT_EQ(1, TilingData(2,  1,  2, false).numTiles());
+    EXPECT_EQ(1, TilingData(2,  2,  1, false).numTiles());
+    EXPECT_EQ(1, TilingData(2,  2,  2, false).numTiles());
+    EXPECT_EQ(1, TilingData(3,  3,  3, false).numTiles());
+
+    EXPECT_EQ(1, TilingData(4,  1,  4, false).numTiles());
+    EXPECT_EQ(1, TilingData(4,  2,  4, false).numTiles());
+    EXPECT_EQ(1, TilingData(4,  3,  4, false).numTiles());
+    EXPECT_EQ(1, TilingData(4,  4,  4, false).numTiles());
+    EXPECT_EQ(2, TilingData(4,  5,  4, false).numTiles());
+    EXPECT_EQ(2, TilingData(4,  6,  4, false).numTiles());
+    EXPECT_EQ(2, TilingData(4,  7,  4, false).numTiles());
+    EXPECT_EQ(2, TilingData(4,  8,  4, false).numTiles());
+    EXPECT_EQ(3, TilingData(4,  9,  4, false).numTiles());
+    EXPECT_EQ(3, TilingData(4, 10,  4, false).numTiles());
+    EXPECT_EQ(3, TilingData(4, 11,  4, false).numTiles());
+
+    EXPECT_EQ(1, TilingData(5,  1,  5, false).numTiles());
+    EXPECT_EQ(1, TilingData(5,  2,  5, false).numTiles());
+    EXPECT_EQ(1, TilingData(5,  3,  5, false).numTiles());
+    EXPECT_EQ(1, TilingData(5,  4,  5, false).numTiles());
+    EXPECT_EQ(1, TilingData(5,  5,  5, false).numTiles());
+    EXPECT_EQ(2, TilingData(5,  6,  5, false).numTiles());
+    EXPECT_EQ(2, TilingData(5,  7,  5, false).numTiles());
+    EXPECT_EQ(2, TilingData(5,  8,  5, false).numTiles());
+    EXPECT_EQ(2, TilingData(5,  9,  5, false).numTiles());
+    EXPECT_EQ(2, TilingData(5, 10,  5, false).numTiles());
+    EXPECT_EQ(3, TilingData(5, 11,  5, false).numTiles());
+
+    EXPECT_EQ(1, TilingData(16, 16, 16, false).numTiles());
+    EXPECT_EQ(1, TilingData(17, 16, 16, false).numTiles());
+    EXPECT_EQ(4, TilingData(15, 16, 16, false).numTiles());
+    EXPECT_EQ(4, TilingData(8, 16, 16, false).numTiles());
+    EXPECT_EQ(6, TilingData(8, 17, 16, false).numTiles());
 }
 
 TEST(TilingDataTest, numTiles_TilingWithBorders)
 {
-    EXPECT_EQ(0, TestTiling(0,  0,  0, true).numTiles());
-    EXPECT_EQ(0, TestTiling(0,  4,  0, true).numTiles());
-    EXPECT_EQ(0, TestTiling(0,  0,  4, true).numTiles());
-    EXPECT_EQ(0, TestTiling(4,  4,  0, true).numTiles());
-    EXPECT_EQ(0, TestTiling(4,  0,  4, true).numTiles());
-    EXPECT_EQ(0, TestTiling(-8, 1,  1, true).numTiles());
-    EXPECT_EQ(0, TestTiling(-1, 1,  1, true).numTiles());
-    EXPECT_EQ(0, TestTiling(0,  1,  1, true).numTiles());
-
-    EXPECT_EQ(1, TestTiling(1,  1,  1, true).numTiles());
-    EXPECT_EQ(0, TestTiling(1,  1,  2, true).numTiles());
-    EXPECT_EQ(0, TestTiling(1,  2,  1, true).numTiles());
-    EXPECT_EQ(1, TestTiling(2,  1,  1, true).numTiles());
-    EXPECT_EQ(1, TestTiling(2,  1,  2, true).numTiles());
-    EXPECT_EQ(1, TestTiling(2,  2,  1, true).numTiles());
-    EXPECT_EQ(1, TestTiling(2,  2,  2, true).numTiles());
-
-    EXPECT_EQ(1, TestTiling(3,  1,  3, true).numTiles());
-    EXPECT_EQ(1, TestTiling(3,  2,  3, true).numTiles());
-    EXPECT_EQ(1, TestTiling(3,  3,  3, true).numTiles());
-    EXPECT_EQ(2, TestTiling(3,  4,  3, true).numTiles());
-    EXPECT_EQ(3, TestTiling(3,  5,  3, true).numTiles());
-    EXPECT_EQ(4, TestTiling(3,  6,  3, true).numTiles());
-    EXPECT_EQ(5, TestTiling(3,  7,  3, true).numTiles());
-
-    EXPECT_EQ(1, TestTiling(4,  1,  4, true).numTiles());
-    EXPECT_EQ(1, TestTiling(4,  2,  4, true).numTiles());
-    EXPECT_EQ(1, TestTiling(4,  3,  4, true).numTiles());
-    EXPECT_EQ(1, TestTiling(4,  4,  4, true).numTiles());
-    EXPECT_EQ(2, TestTiling(4,  5,  4, true).numTiles());
-    EXPECT_EQ(2, TestTiling(4,  6,  4, true).numTiles());
-    EXPECT_EQ(3, TestTiling(4,  7,  4, true).numTiles());
-    EXPECT_EQ(3, TestTiling(4,  8,  4, true).numTiles());
-    EXPECT_EQ(4, TestTiling(4,  9,  4, true).numTiles());
-    EXPECT_EQ(4, TestTiling(4, 10,  4, true).numTiles());
-    EXPECT_EQ(5, TestTiling(4, 11,  4, true).numTiles());
-
-    EXPECT_EQ(1, TestTiling(5,  1,  5, true).numTiles());
-    EXPECT_EQ(1, TestTiling(5,  2,  5, true).numTiles());
-    EXPECT_EQ(1, TestTiling(5,  3,  5, true).numTiles());
-    EXPECT_EQ(1, TestTiling(5,  4,  5, true).numTiles());
-    EXPECT_EQ(1, TestTiling(5,  5,  5, true).numTiles());
-    EXPECT_EQ(2, TestTiling(5,  6,  5, true).numTiles());
-    EXPECT_EQ(2, TestTiling(5,  7,  5, true).numTiles());
-    EXPECT_EQ(2, TestTiling(5,  8,  5, true).numTiles());
-    EXPECT_EQ(3, TestTiling(5,  9,  5, true).numTiles());
-    EXPECT_EQ(3, TestTiling(5, 10,  5, true).numTiles());
-    EXPECT_EQ(3, TestTiling(5, 11,  5, true).numTiles());
+    EXPECT_EQ(0, TilingData(0,  0,  0, true).numTiles());
+    EXPECT_EQ(0, TilingData(0,  4,  0, true).numTiles());
+    EXPECT_EQ(0, TilingData(0,  0,  4, true).numTiles());
+    EXPECT_EQ(0, TilingData(4,  4,  0, true).numTiles());
+    EXPECT_EQ(0, TilingData(4,  0,  4, true).numTiles());
+    EXPECT_EQ(0, TilingData(-8, 1,  1, true).numTiles());
+    EXPECT_EQ(0, TilingData(-1, 1,  1, true).numTiles());
+    EXPECT_EQ(0, TilingData(0,  1,  1, true).numTiles());
+
+    EXPECT_EQ(1, TilingData(1,  1,  1, true).numTiles());
+    EXPECT_EQ(0, TilingData(1,  1,  2, true).numTiles());
+    EXPECT_EQ(0, TilingData(1,  2,  1, true).numTiles());
+    EXPECT_EQ(1, TilingData(2,  1,  1, true).numTiles());
+    EXPECT_EQ(1, TilingData(2,  1,  2, true).numTiles());
+    EXPECT_EQ(1, TilingData(2,  2,  1, true).numTiles());
+    EXPECT_EQ(1, TilingData(2,  2,  2, true).numTiles());
+
+    EXPECT_EQ(1, TilingData(3,  1,  3, true).numTiles());
+    EXPECT_EQ(1, TilingData(3,  2,  3, true).numTiles());
+    EXPECT_EQ(1, TilingData(3,  3,  3, true).numTiles());
+    EXPECT_EQ(2, TilingData(3,  4,  3, true).numTiles());
+    EXPECT_EQ(3, TilingData(3,  5,  3, true).numTiles());
+    EXPECT_EQ(4, TilingData(3,  6,  3, true).numTiles());
+    EXPECT_EQ(5, TilingData(3,  7,  3, true).numTiles());
+
+    EXPECT_EQ(1, TilingData(4,  1,  4, true).numTiles());
+    EXPECT_EQ(1, TilingData(4,  2,  4, true).numTiles());
+    EXPECT_EQ(1, TilingData(4,  3,  4, true).numTiles());
+    EXPECT_EQ(1, TilingData(4,  4,  4, true).numTiles());
+    EXPECT_EQ(2, TilingData(4,  5,  4, true).numTiles());
+    EXPECT_EQ(2, TilingData(4,  6,  4, true).numTiles());
+    EXPECT_EQ(3, TilingData(4,  7,  4, true).numTiles());
+    EXPECT_EQ(3, TilingData(4,  8,  4, true).numTiles());
+    EXPECT_EQ(4, TilingData(4,  9,  4, true).numTiles());
+    EXPECT_EQ(4, TilingData(4, 10,  4, true).numTiles());
+    EXPECT_EQ(5, TilingData(4, 11,  4, true).numTiles());
+
+    EXPECT_EQ(1, TilingData(5,  1,  5, true).numTiles());
+    EXPECT_EQ(1, TilingData(5,  2,  5, true).numTiles());
+    EXPECT_EQ(1, TilingData(5,  3,  5, true).numTiles());
+    EXPECT_EQ(1, TilingData(5,  4,  5, true).numTiles());
+    EXPECT_EQ(1, TilingData(5,  5,  5, true).numTiles());
+    EXPECT_EQ(2, TilingData(5,  6,  5, true).numTiles());
+    EXPECT_EQ(2, TilingData(5,  7,  5, true).numTiles());
+    EXPECT_EQ(2, TilingData(5,  8,  5, true).numTiles());
+    EXPECT_EQ(3, TilingData(5,  9,  5, true).numTiles());
+    EXPECT_EQ(3, TilingData(5, 10,  5, true).numTiles());
+    EXPECT_EQ(3, TilingData(5, 11,  5, true).numTiles());
 }
 
 TEST(TilingDataTest, tileXIndexFromSrcCoord)
 {
-    EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(1));
-    EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(2));
-    EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(3));
-    EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(4));
-    EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(5));
-    EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(6));
-    EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(7));
-    EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(8));
-    EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(9));
-    EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(10));
-    EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileXIndexFromSrcCoord(11));
-
-    EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(1));
-    EXPECT_EQ(1, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(2));
-    EXPECT_EQ(2, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(3));
-    EXPECT_EQ(3, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(4));
-    EXPECT_EQ(4, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(5));
-    EXPECT_EQ(5, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(6));
-    EXPECT_EQ(6, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(7));
-    EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(8));
-    EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(9));
-    EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(10));
-    EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileXIndexFromSrcCoord(11));
-
-    EXPECT_EQ(0, TestTiling(1, 1, 1, false).tileXIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileXIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileXIndexFromSrcCoord(1));
-    EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileXIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileXIndexFromSrcCoord(1));
-    EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileXIndexFromSrcCoord(2));
-
-    EXPECT_EQ(0, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(1));
-    EXPECT_EQ(0, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(2));
-    EXPECT_EQ(1, TestTiling(3, 4, 3, false).tileXIndexFromSrcCoord(3));
-
-    EXPECT_EQ(0, TestTiling(1, 1, 1, true).tileXIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileXIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileXIndexFromSrcCoord(1));
-    EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileXIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileXIndexFromSrcCoord(1));
-    EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileXIndexFromSrcCoord(2));
-
-    EXPECT_EQ(0, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(1));
-    EXPECT_EQ(1, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(2));
-    EXPECT_EQ(1, TestTiling(3, 4, 3, true).tileXIndexFromSrcCoord(3));
+    EXPECT_EQ(0, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(1));
+    EXPECT_EQ(0, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(2));
+    EXPECT_EQ(1, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(3));
+    EXPECT_EQ(1, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(4));
+    EXPECT_EQ(1, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(5));
+    EXPECT_EQ(2, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(6));
+    EXPECT_EQ(2, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(7));
+    EXPECT_EQ(2, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(8));
+    EXPECT_EQ(3, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(9));
+    EXPECT_EQ(3, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(10));
+    EXPECT_EQ(3, TilingData(3, 10, 10, false).tileXIndexFromSrcCoord(11));
+
+    EXPECT_EQ(0, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(1));
+    EXPECT_EQ(1, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(2));
+    EXPECT_EQ(2, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(3));
+    EXPECT_EQ(3, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(4));
+    EXPECT_EQ(4, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(5));
+    EXPECT_EQ(5, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(6));
+    EXPECT_EQ(6, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(7));
+    EXPECT_EQ(7, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(8));
+    EXPECT_EQ(7, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(9));
+    EXPECT_EQ(7, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(10));
+    EXPECT_EQ(7, TilingData(3, 10, 10, true).tileXIndexFromSrcCoord(11));
+
+    EXPECT_EQ(0, TilingData(1, 1, 1, false).tileXIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(2, 2, 2, false).tileXIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(2, 2, 2, false).tileXIndexFromSrcCoord(1));
+    EXPECT_EQ(0, TilingData(3, 3, 3, false).tileXIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(3, 3, 3, false).tileXIndexFromSrcCoord(1));
+    EXPECT_EQ(0, TilingData(3, 3, 3, false).tileXIndexFromSrcCoord(2));
+
+    EXPECT_EQ(0, TilingData(3, 4, 3, false).tileXIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(3, 4, 3, false).tileXIndexFromSrcCoord(1));
+    EXPECT_EQ(0, TilingData(3, 4, 3, false).tileXIndexFromSrcCoord(2));
+    EXPECT_EQ(1, TilingData(3, 4, 3, false).tileXIndexFromSrcCoord(3));
+
+    EXPECT_EQ(0, TilingData(1, 1, 1, true).tileXIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(2, 2, 2, true).tileXIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(2, 2, 2, true).tileXIndexFromSrcCoord(1));
+    EXPECT_EQ(0, TilingData(3, 3, 3, true).tileXIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(3, 3, 3, true).tileXIndexFromSrcCoord(1));
+    EXPECT_EQ(0, TilingData(3, 3, 3, true).tileXIndexFromSrcCoord(2));
+
+    EXPECT_EQ(0, TilingData(3, 4, 3, true).tileXIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(3, 4, 3, true).tileXIndexFromSrcCoord(1));
+    EXPECT_EQ(1, TilingData(3, 4, 3, true).tileXIndexFromSrcCoord(2));
+    EXPECT_EQ(1, TilingData(3, 4, 3, true).tileXIndexFromSrcCoord(3));
 }
 TEST(TilingDataTest, tileYIndexFromSrcCoord)
 {
-    EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(1));
-    EXPECT_EQ(0, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(2));
-    EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(3));
-    EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(4));
-    EXPECT_EQ(1, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(5));
-    EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(6));
-    EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(7));
-    EXPECT_EQ(2, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(8));
-    EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(9));
-    EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(10));
-    EXPECT_EQ(3, TestTiling(3, 10, 10, false).tileYIndexFromSrcCoord(11));
-
-    EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(1));
-    EXPECT_EQ(1, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(2));
-    EXPECT_EQ(2, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(3));
-    EXPECT_EQ(3, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(4));
-    EXPECT_EQ(4, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(5));
-    EXPECT_EQ(5, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(6));
-    EXPECT_EQ(6, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(7));
-    EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(8));
-    EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(9));
-    EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(10));
-    EXPECT_EQ(7, TestTiling(3, 10, 10, true).tileYIndexFromSrcCoord(11));
-
-    EXPECT_EQ(0, TestTiling(1, 1, 1, false).tileYIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileYIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(2, 2, 2, false).tileYIndexFromSrcCoord(1));
-    EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileYIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileYIndexFromSrcCoord(1));
-    EXPECT_EQ(0, TestTiling(3, 3, 3, false).tileYIndexFromSrcCoord(2));
-
-    EXPECT_EQ(0, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(1));
-    EXPECT_EQ(0, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(2));
-    EXPECT_EQ(1, TestTiling(3, 3, 4, false).tileYIndexFromSrcCoord(3));
-
-    EXPECT_EQ(0, TestTiling(1, 1, 1, true).tileYIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileYIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(2, 2, 2, true).tileYIndexFromSrcCoord(1));
-    EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileYIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileYIndexFromSrcCoord(1));
-    EXPECT_EQ(0, TestTiling(3, 3, 3, true).tileYIndexFromSrcCoord(2));
-
-    EXPECT_EQ(0, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(0));
-    EXPECT_EQ(0, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(1));
-    EXPECT_EQ(1, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(2));
-    EXPECT_EQ(1, TestTiling(3, 3, 4, true).tileYIndexFromSrcCoord(3));
+    EXPECT_EQ(0, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(1));
+    EXPECT_EQ(0, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(2));
+    EXPECT_EQ(1, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(3));
+    EXPECT_EQ(1, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(4));
+    EXPECT_EQ(1, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(5));
+    EXPECT_EQ(2, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(6));
+    EXPECT_EQ(2, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(7));
+    EXPECT_EQ(2, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(8));
+    EXPECT_EQ(3, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(9));
+    EXPECT_EQ(3, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(10));
+    EXPECT_EQ(3, TilingData(3, 10, 10, false).tileYIndexFromSrcCoord(11));
+
+    EXPECT_EQ(0, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(1));
+    EXPECT_EQ(1, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(2));
+    EXPECT_EQ(2, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(3));
+    EXPECT_EQ(3, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(4));
+    EXPECT_EQ(4, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(5));
+    EXPECT_EQ(5, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(6));
+    EXPECT_EQ(6, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(7));
+    EXPECT_EQ(7, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(8));
+    EXPECT_EQ(7, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(9));
+    EXPECT_EQ(7, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(10));
+    EXPECT_EQ(7, TilingData(3, 10, 10, true).tileYIndexFromSrcCoord(11));
+
+    EXPECT_EQ(0, TilingData(1, 1, 1, false).tileYIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(2, 2, 2, false).tileYIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(2, 2, 2, false).tileYIndexFromSrcCoord(1));
+    EXPECT_EQ(0, TilingData(3, 3, 3, false).tileYIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(3, 3, 3, false).tileYIndexFromSrcCoord(1));
+    EXPECT_EQ(0, TilingData(3, 3, 3, false).tileYIndexFromSrcCoord(2));
+
+    EXPECT_EQ(0, TilingData(3, 3, 4, false).tileYIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(3, 3, 4, false).tileYIndexFromSrcCoord(1));
+    EXPECT_EQ(0, TilingData(3, 3, 4, false).tileYIndexFromSrcCoord(2));
+    EXPECT_EQ(1, TilingData(3, 3, 4, false).tileYIndexFromSrcCoord(3));
+
+    EXPECT_EQ(0, TilingData(1, 1, 1, true).tileYIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(2, 2, 2, true).tileYIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(2, 2, 2, true).tileYIndexFromSrcCoord(1));
+    EXPECT_EQ(0, TilingData(3, 3, 3, true).tileYIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(3, 3, 3, true).tileYIndexFromSrcCoord(1));
+    EXPECT_EQ(0, TilingData(3, 3, 3, true).tileYIndexFromSrcCoord(2));
+
+    EXPECT_EQ(0, TilingData(3, 3, 4, true).tileYIndexFromSrcCoord(0));
+    EXPECT_EQ(0, TilingData(3, 3, 4, true).tileYIndexFromSrcCoord(1));
+    EXPECT_EQ(1, TilingData(3, 3, 4, true).tileYIndexFromSrcCoord(2));
+    EXPECT_EQ(1, TilingData(3, 3, 4, true).tileYIndexFromSrcCoord(3));
 }
 
 TEST(TilingDataTest, tileSizeX)
 {
-    EXPECT_EQ(5, TestTiling(5,  5,  5, false).tileSizeX(0));
-    EXPECT_EQ(5, TestTiling(5,  5,  5, true).tileSizeX(0));
-
-    EXPECT_EQ(5, TestTiling(5,  6,  6, false).tileSizeX(0));
-    EXPECT_EQ(1, TestTiling(5,  6,  6, false).tileSizeX(1));
-    EXPECT_EQ(4, TestTiling(5,  6,  6, true).tileSizeX(0));
-    EXPECT_EQ(2, TestTiling(5,  6,  6, true).tileSizeX(1));
-
-    EXPECT_EQ(5, TestTiling(5,  8,  8, false).tileSizeX(0));
-    EXPECT_EQ(3, TestTiling(5,  8,  8, false).tileSizeX(1));
-    EXPECT_EQ(4, TestTiling(5,  8,  8, true).tileSizeX(0));
-    EXPECT_EQ(4, TestTiling(5,  8,  8, true).tileSizeX(1));
-
-    EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeX(0));
-    EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeX(1));
-    EXPECT_EQ(4, TestTiling(5, 10, 10, true).tileSizeX(0));
-    EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeX(1));
-    EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeX(2));
-
-    EXPECT_EQ(4, TestTiling(5, 11, 11, true).tileSizeX(2));
-    EXPECT_EQ(3, TestTiling(5, 12, 12, true).tileSizeX(2));
+    EXPECT_EQ(5, TilingData(5,  5,  5, false).tileSizeX(0));
+    EXPECT_EQ(5, TilingData(5,  5,  5, true).tileSizeX(0));
+
+    EXPECT_EQ(5, TilingData(5,  6,  6, false).tileSizeX(0));
+    EXPECT_EQ(1, TilingData(5,  6,  6, false).tileSizeX(1));
+    EXPECT_EQ(4, TilingData(5,  6,  6, true).tileSizeX(0));
+    EXPECT_EQ(2, TilingData(5,  6,  6, true).tileSizeX(1));
+
+    EXPECT_EQ(5, TilingData(5,  8,  8, false).tileSizeX(0));
+    EXPECT_EQ(3, TilingData(5,  8,  8, false).tileSizeX(1));
+    EXPECT_EQ(4, TilingData(5,  8,  8, true).tileSizeX(0));
+    EXPECT_EQ(4, TilingData(5,  8,  8, true).tileSizeX(1));
+
+    EXPECT_EQ(5, TilingData(5, 10, 10, false).tileSizeX(0));
+    EXPECT_EQ(5, TilingData(5, 10, 10, false).tileSizeX(1));
+    EXPECT_EQ(4, TilingData(5, 10, 10, true).tileSizeX(0));
+    EXPECT_EQ(3, TilingData(5, 10, 10, true).tileSizeX(1));
+    EXPECT_EQ(3, TilingData(5, 10, 10, true).tileSizeX(2));
+
+    EXPECT_EQ(4, TilingData(5, 11, 11, true).tileSizeX(2));
+    EXPECT_EQ(3, TilingData(5, 12, 12, true).tileSizeX(2));
 }
 TEST(TilingDataTest, tileSizeY)
 {
-    EXPECT_EQ(5, TestTiling(5,  5,  5, false).tileSizeY(0));
-    EXPECT_EQ(5, TestTiling(5,  5,  5, true).tileSizeY(0));
-
-    EXPECT_EQ(5, TestTiling(5,  6,  6, false).tileSizeY(0));
-    EXPECT_EQ(1, TestTiling(5,  6,  6, false).tileSizeY(1));
-    EXPECT_EQ(4, TestTiling(5,  6,  6, true).tileSizeY(0));
-    EXPECT_EQ(2, TestTiling(5,  6,  6, true).tileSizeY(1));
-
-    EXPECT_EQ(5, TestTiling(5,  8,  8, false).tileSizeY(0));
-    EXPECT_EQ(3, TestTiling(5,  8,  8, false).tileSizeY(1));
-    EXPECT_EQ(4, TestTiling(5,  8,  8, true).tileSizeY(0));
-    EXPECT_EQ(4, TestTiling(5,  8,  8, true).tileSizeY(1));
-
-    EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeY(0));
-    EXPECT_EQ(5, TestTiling(5, 10, 10, false).tileSizeY(1));
-    EXPECT_EQ(4, TestTiling(5, 10, 10, true).tileSizeY(0));
-    EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeY(1));
-    EXPECT_EQ(3, TestTiling(5, 10, 10, true).tileSizeY(2));
-
-    EXPECT_EQ(4, TestTiling(5, 11, 11, true).tileSizeY(2));
-    EXPECT_EQ(3, TestTiling(5, 12, 12, true).tileSizeY(2));
+    EXPECT_EQ(5, TilingData(5,  5,  5, false).tileSizeY(0));
+    EXPECT_EQ(5, TilingData(5,  5,  5, true).tileSizeY(0));
+
+    EXPECT_EQ(5, TilingData(5,  6,  6, false).tileSizeY(0));
+    EXPECT_EQ(1, TilingData(5,  6,  6, false).tileSizeY(1));
+    EXPECT_EQ(4, TilingData(5,  6,  6, true).tileSizeY(0));
+    EXPECT_EQ(2, TilingData(5,  6,  6, true).tileSizeY(1));
+
+    EXPECT_EQ(5, TilingData(5,  8,  8, false).tileSizeY(0));
+    EXPECT_EQ(3, TilingData(5,  8,  8, false).tileSizeY(1));
+    EXPECT_EQ(4, TilingData(5,  8,  8, true).tileSizeY(0));
+    EXPECT_EQ(4, TilingData(5,  8,  8, true).tileSizeY(1));
+
+    EXPECT_EQ(5, TilingData(5, 10, 10, false).tileSizeY(0));
+    EXPECT_EQ(5, TilingData(5, 10, 10, false).tileSizeY(1));
+    EXPECT_EQ(4, TilingData(5, 10, 10, true).tileSizeY(0));
+    EXPECT_EQ(3, TilingData(5, 10, 10, true).tileSizeY(1));
+    EXPECT_EQ(3, TilingData(5, 10, 10, true).tileSizeY(2));
+
+    EXPECT_EQ(4, TilingData(5, 11, 11, true).tileSizeY(2));
+    EXPECT_EQ(3, TilingData(5, 12, 12, true).tileSizeY(2));
 }
 
 TEST(TilingDataTest, tileSizeX_and_tilePositionX)
 {
     // Single tile cases:
-    EXPECT_EQ(1, TestTiling(3, 1,   1, false).tileSizeX(0));
-    EXPECT_EQ(0, TestTiling(3, 1,   1, false).tilePositionX(0));
-    EXPECT_EQ(1, TestTiling(3, 1, 100, false).tileSizeX(0));
-    EXPECT_EQ(0, TestTiling(3, 1, 100, false).tilePositionX(0));
-    EXPECT_EQ(3, TestTiling(3, 3,   1, false).tileSizeX(0));
-    EXPECT_EQ(0, TestTiling(3, 3,   1, false).tilePositionX(0));
-    EXPECT_EQ(3, TestTiling(3, 3, 100, false).tileSizeX(0));
-    EXPECT_EQ(0, TestTiling(3, 3, 100, false).tilePositionX(0));
-    EXPECT_EQ(1, TestTiling(3, 1,   1, true).tileSizeX(0));
-    EXPECT_EQ(0, TestTiling(3, 1,   1, true).tilePositionX(0));
-    EXPECT_EQ(1, TestTiling(3, 1, 100, true).tileSizeX(0));
-    EXPECT_EQ(0, TestTiling(3, 1, 100, true).tilePositionX(0));
-    EXPECT_EQ(3, TestTiling(3, 3,   1, true).tileSizeX(0));
-    EXPECT_EQ(0, TestTiling(3, 3,   1, true).tilePositionX(0));
-    EXPECT_EQ(3, TestTiling(3, 3, 100, true).tileSizeX(0));
-    EXPECT_EQ(0, TestTiling(3, 3, 100, true).tilePositionX(0));
+    EXPECT_EQ(1, TilingData(3, 1,   1, false).tileSizeX(0));
+    EXPECT_EQ(0, TilingData(3, 1,   1, false).tilePositionX(0));
+    EXPECT_EQ(1, TilingData(3, 1, 100, false).tileSizeX(0));
+    EXPECT_EQ(0, TilingData(3, 1, 100, false).tilePositionX(0));
+    EXPECT_EQ(3, TilingData(3, 3,   1, false).tileSizeX(0));
+    EXPECT_EQ(0, TilingData(3, 3,   1, false).tilePositionX(0));
+    EXPECT_EQ(3, TilingData(3, 3, 100, false).tileSizeX(0));
+    EXPECT_EQ(0, TilingData(3, 3, 100, false).tilePositionX(0));
+    EXPECT_EQ(1, TilingData(3, 1,   1, true).tileSizeX(0));
+    EXPECT_EQ(0, TilingData(3, 1,   1, true).tilePositionX(0));
+    EXPECT_EQ(1, TilingData(3, 1, 100, true).tileSizeX(0));
+    EXPECT_EQ(0, TilingData(3, 1, 100, true).tilePositionX(0));
+    EXPECT_EQ(3, TilingData(3, 3,   1, true).tileSizeX(0));
+    EXPECT_EQ(0, TilingData(3, 3,   1, true).tilePositionX(0));
+    EXPECT_EQ(3, TilingData(3, 3, 100, true).tileSizeX(0));
+    EXPECT_EQ(0, TilingData(3, 3, 100, true).tilePositionX(0));
 
     // Multiple tiles:
     // no border
     // positions 0, 3
-    EXPECT_EQ(2, TestTiling(3, 6,   1, false).numTiles());
-    EXPECT_EQ(3, TestTiling(3, 6,   1, false).tileSizeX(0));
-    EXPECT_EQ(3, TestTiling(3, 6,   1, false).tileSizeX(1));
-    EXPECT_EQ(0, TestTiling(3, 6,   1, false).tilePositionX(0));
-    EXPECT_EQ(3, TestTiling(3, 6,   1, false).tilePositionX(1));
-    EXPECT_EQ(3, TestTiling(3, 6, 100, false).tileSizeX(0));
-    EXPECT_EQ(3, TestTiling(3, 6, 100, false).tileSizeX(1));
-    EXPECT_EQ(0, TestTiling(3, 6, 100, false).tilePositionX(0));
-    EXPECT_EQ(3, TestTiling(3, 6, 100, false).tilePositionX(1));
+    EXPECT_EQ(2, TilingData(3, 6,   1, false).numTiles());
+    EXPECT_EQ(3, TilingData(3, 6,   1, false).tileSizeX(0));
+    EXPECT_EQ(3, TilingData(3, 6,   1, false).tileSizeX(1));
+    EXPECT_EQ(0, TilingData(3, 6,   1, false).tilePositionX(0));
+    EXPECT_EQ(3, TilingData(3, 6,   1, false).tilePositionX(1));
+    EXPECT_EQ(3, TilingData(3, 6, 100, false).tileSizeX(0));
+    EXPECT_EQ(3, TilingData(3, 6, 100, false).tileSizeX(1));
+    EXPECT_EQ(0, TilingData(3, 6, 100, false).tilePositionX(0));
+    EXPECT_EQ(3, TilingData(3, 6, 100, false).tilePositionX(1));
 
     // Multiple tiles:
     // with border
     // positions 0, 2, 3, 4
-    EXPECT_EQ(4, TestTiling(3, 6,   1, true).numTiles());
-    EXPECT_EQ(2, TestTiling(3, 6,   1, true).tileSizeX(0));
-    EXPECT_EQ(1, TestTiling(3, 6,   1, true).tileSizeX(1));
-    EXPECT_EQ(1, TestTiling(3, 6,   1, true).tileSizeX(2));
-    EXPECT_EQ(2, TestTiling(3, 6,   1, true).tileSizeX(3));
-    EXPECT_EQ(0, TestTiling(3, 6,   1, true).tilePositionX(0));
-    EXPECT_EQ(2, TestTiling(3, 6,   1, true).tilePositionX(1));
-    EXPECT_EQ(3, TestTiling(3, 6,   1, true).tilePositionX(2));
-    EXPECT_EQ(4, TestTiling(3, 6,   1, true).tilePositionX(3));
-    EXPECT_EQ(2, TestTiling(3, 6, 100, true).tileSizeX(0));
-    EXPECT_EQ(1, TestTiling(3, 6, 100, true).tileSizeX(1));
-    EXPECT_EQ(1, TestTiling(3, 6, 100, true).tileSizeX(2));
-    EXPECT_EQ(2, TestTiling(3, 6, 100, true).tileSizeX(3));
-    EXPECT_EQ(0, TestTiling(3, 6, 100, true).tilePositionX(0));
-    EXPECT_EQ(2, TestTiling(3, 6, 100, true).tilePositionX(1));
-    EXPECT_EQ(3, TestTiling(3, 6, 100, true).tilePositionX(2));
-    EXPECT_EQ(4, TestTiling(3, 6, 100, true).tilePositionX(3));
+    EXPECT_EQ(4, TilingData(3, 6,   1, true).numTiles());
+    EXPECT_EQ(2, TilingData(3, 6,   1, true).tileSizeX(0));
+    EXPECT_EQ(1, TilingData(3, 6,   1, true).tileSizeX(1));
+    EXPECT_EQ(1, TilingData(3, 6,   1, true).tileSizeX(2));
+    EXPECT_EQ(2, TilingData(3, 6,   1, true).tileSizeX(3));
+    EXPECT_EQ(0, TilingData(3, 6,   1, true).tilePositionX(0));
+    EXPECT_EQ(2, TilingData(3, 6,   1, true).tilePositionX(1));
+    EXPECT_EQ(3, TilingData(3, 6,   1, true).tilePositionX(2));
+    EXPECT_EQ(4, TilingData(3, 6,   1, true).tilePositionX(3));
+    EXPECT_EQ(2, TilingData(3, 6, 100, true).tileSizeX(0));
+    EXPECT_EQ(1, TilingData(3, 6, 100, true).tileSizeX(1));
+    EXPECT_EQ(1, TilingData(3, 6, 100, true).tileSizeX(2));
+    EXPECT_EQ(2, TilingData(3, 6, 100, true).tileSizeX(3));
+    EXPECT_EQ(0, TilingData(3, 6, 100, true).tilePositionX(0));
+    EXPECT_EQ(2, TilingData(3, 6, 100, true).tilePositionX(1));
+    EXPECT_EQ(3, TilingData(3, 6, 100, true).tilePositionX(2));
+    EXPECT_EQ(4, TilingData(3, 6, 100, true).tilePositionX(3));
 }
 
 TEST(TilingDataTest, tileSizeY_and_tilePositionY)
 {
     // Single tile cases:
-    EXPECT_EQ(1, TestTiling(3,   1, 1, false).tileSizeY(0));
-    EXPECT_EQ(0, TestTiling(3,   1, 1, false).tilePositionY(0));
-    EXPECT_EQ(1, TestTiling(3, 100, 1, false).tileSizeY(0));
-    EXPECT_EQ(0, TestTiling(3, 100, 1, false).tilePositionY(0));
-    EXPECT_EQ(3, TestTiling(3,   1, 3, false).tileSizeY(0));
-    EXPECT_EQ(0, TestTiling(3,   1, 3, false).tilePositionY(0));
-    EXPECT_EQ(3, TestTiling(3, 100, 3, false).tileSizeY(0));
-    EXPECT_EQ(0, TestTiling(3, 100, 3, false).tilePositionY(0));
-    EXPECT_EQ(1, TestTiling(3,   1, 1, true).tileSizeY(0));
-    EXPECT_EQ(0, TestTiling(3,   1, 1, true).tilePositionY(0));
-    EXPECT_EQ(1, TestTiling(3, 100, 1, true).tileSizeY(0));
-    EXPECT_EQ(0, TestTiling(3, 100, 1, true).tilePositionY(0));
-    EXPECT_EQ(3, TestTiling(3,   1, 3, true).tileSizeY(0));
-    EXPECT_EQ(0, TestTiling(3,   1, 3, true).tilePositionY(0));
-    EXPECT_EQ(3, TestTiling(3, 100, 3, true).tileSizeY(0));
-    EXPECT_EQ(0, TestTiling(3, 100, 3, true).tilePositionY(0));
+    EXPECT_EQ(1, TilingData(3,   1, 1, false).tileSizeY(0));
+    EXPECT_EQ(0, TilingData(3,   1, 1, false).tilePositionY(0));
+    EXPECT_EQ(1, TilingData(3, 100, 1, false).tileSizeY(0));
+    EXPECT_EQ(0, TilingData(3, 100, 1, false).tilePositionY(0));
+    EXPECT_EQ(3, TilingData(3,   1, 3, false).tileSizeY(0));
+    EXPECT_EQ(0, TilingData(3,   1, 3, false).tilePositionY(0));
+    EXPECT_EQ(3, TilingData(3, 100, 3, false).tileSizeY(0));
+    EXPECT_EQ(0, TilingData(3, 100, 3, false).tilePositionY(0));
+    EXPECT_EQ(1, TilingData(3,   1, 1, true).tileSizeY(0));
+    EXPECT_EQ(0, TilingData(3,   1, 1, true).tilePositionY(0));
+    EXPECT_EQ(1, TilingData(3, 100, 1, true).tileSizeY(0));
+    EXPECT_EQ(0, TilingData(3, 100, 1, true).tilePositionY(0));
+    EXPECT_EQ(3, TilingData(3,   1, 3, true).tileSizeY(0));
+    EXPECT_EQ(0, TilingData(3,   1, 3, true).tilePositionY(0));
+    EXPECT_EQ(3, TilingData(3, 100, 3, true).tileSizeY(0));
+    EXPECT_EQ(0, TilingData(3, 100, 3, true).tilePositionY(0));
 
     // Multiple tiles:
     // no border
     // positions 0, 3
-    EXPECT_EQ(2, TestTiling(3,   1, 6, false).numTiles());
-    EXPECT_EQ(3, TestTiling(3,   1, 6, false).tileSizeY(0));
-    EXPECT_EQ(3, TestTiling(3,   1, 6, false).tileSizeY(1));
-    EXPECT_EQ(0, TestTiling(3,   1, 6, false).tilePositionY(0));
-    EXPECT_EQ(3, TestTiling(3,   1, 6, false).tilePositionY(1));
-    EXPECT_EQ(3, TestTiling(3, 100, 6, false).tileSizeY(0));
-    EXPECT_EQ(3, TestTiling(3, 100, 6, false).tileSizeY(1));
-    EXPECT_EQ(0, TestTiling(3, 100, 6, false).tilePositionY(0));
-    EXPECT_EQ(3, TestTiling(3, 100, 6, false).tilePositionY(1));
+    EXPECT_EQ(2, TilingData(3,   1, 6, false).numTiles());
+    EXPECT_EQ(3, TilingData(3,   1, 6, false).tileSizeY(0));
+    EXPECT_EQ(3, TilingData(3,   1, 6, false).tileSizeY(1));
+    EXPECT_EQ(0, TilingData(3,   1, 6, false).tilePositionY(0));
+    EXPECT_EQ(3, TilingData(3,   1, 6, false).tilePositionY(1));
+    EXPECT_EQ(3, TilingData(3, 100, 6, false).tileSizeY(0));
+    EXPECT_EQ(3, TilingData(3, 100, 6, false).tileSizeY(1));
+    EXPECT_EQ(0, TilingData(3, 100, 6, false).tilePositionY(0));
+    EXPECT_EQ(3, TilingData(3, 100, 6, false).tilePositionY(1));
 
     // Multiple tiles:
     // with border
     // positions 0, 2, 3, 4
-    EXPECT_EQ(4, TestTiling(3,   1, 6, true).numTiles());
-    EXPECT_EQ(2, TestTiling(3,   1, 6, true).tileSizeY(0));
-    EXPECT_EQ(1, TestTiling(3,   1, 6, true).tileSizeY(1));
-    EXPECT_EQ(1, TestTiling(3,   1, 6, true).tileSizeY(2));
-    EXPECT_EQ(2, TestTiling(3,   1, 6, true).tileSizeY(3));
-    EXPECT_EQ(0, TestTiling(3,   1, 6, true).tilePositionY(0));
-    EXPECT_EQ(2, TestTiling(3,   1, 6, true).tilePositionY(1));
-    EXPECT_EQ(3, TestTiling(3,   1, 6, true).tilePositionY(2));
-    EXPECT_EQ(4, TestTiling(3,   1, 6, true).tilePositionY(3));
-    EXPECT_EQ(2, TestTiling(3, 100, 6, true).tileSizeY(0));
-    EXPECT_EQ(1, TestTiling(3, 100, 6, true).tileSizeY(1));
-    EXPECT_EQ(1, TestTiling(3, 100, 6, true).tileSizeY(2));
-    EXPECT_EQ(2, TestTiling(3, 100, 6, true).tileSizeY(3));
-    EXPECT_EQ(0, TestTiling(3, 100, 6, true).tilePositionY(0));
-    EXPECT_EQ(2, TestTiling(3, 100, 6, true).tilePositionY(1));
-    EXPECT_EQ(3, TestTiling(3, 100, 6, true).tilePositionY(2));
-    EXPECT_EQ(4, TestTiling(3, 100, 6, true).tilePositionY(3));
+    EXPECT_EQ(4, TilingData(3,   1, 6, true).numTiles());
+    EXPECT_EQ(2, TilingData(3,   1, 6, true).tileSizeY(0));
+    EXPECT_EQ(1, TilingData(3,   1, 6, true).tileSizeY(1));
+    EXPECT_EQ(1, TilingData(3,   1, 6, true).tileSizeY(2));
+    EXPECT_EQ(2, TilingData(3,   1, 6, true).tileSizeY(3));
+    EXPECT_EQ(0, TilingData(3,   1, 6, true).tilePositionY(0));
+    EXPECT_EQ(2, TilingData(3,   1, 6, true).tilePositionY(1));
+    EXPECT_EQ(3, TilingData(3,   1, 6, true).tilePositionY(2));
+    EXPECT_EQ(4, TilingData(3,   1, 6, true).tilePositionY(3));
+    EXPECT_EQ(2, TilingData(3, 100, 6, true).tileSizeY(0));
+    EXPECT_EQ(1, TilingData(3, 100, 6, true).tileSizeY(1));
+    EXPECT_EQ(1, TilingData(3, 100, 6, true).tileSizeY(2));
+    EXPECT_EQ(2, TilingData(3, 100, 6, true).tileSizeY(3));
+    EXPECT_EQ(0, TilingData(3, 100, 6, true).tilePositionY(0));
+    EXPECT_EQ(2, TilingData(3, 100, 6, true).tilePositionY(1));
+    EXPECT_EQ(3, TilingData(3, 100, 6, true).tilePositionY(2));
+    EXPECT_EQ(4, TilingData(3, 100, 6, true).tilePositionY(3));
 }
 
 TEST(TilingDataTest, setTotalSize)
 {
-    TestTiling data(5, 5, 5, false);
+    TilingData data(5, 5, 5, false);
     EXPECT_EQ(5, data.totalSizeX());
     EXPECT_EQ(5, data.totalSizeY());
     EXPECT_EQ(1, data.numTilesX());
@@ -467,7 +446,7 @@ TEST(TilingDataTest, setTotalSize)
 
 TEST(TilingDataTest, setMaxTextureSizeNoBorders)
 {
-    TestTiling data(8, 16, 32, false);
+    TilingData data(8, 16, 32, false);
     EXPECT_EQ(2, data.numTilesX());
     EXPECT_EQ(4, data.numTilesY());
 
@@ -489,7 +468,7 @@ TEST(TilingDataTest, setMaxTextureSizeNoBorders)
 
 TEST(TilingDataTest, setMaxTextureSizeBorders)
 {
-    TestTiling data(8, 16, 32, true);
+    TilingData data(8, 16, 32, true);
     EXPECT_EQ(3, data.numTilesX());
     EXPECT_EQ(5, data.numTilesY());
 
@@ -512,8 +491,8 @@ TEST(TilingDataTest, setMaxTextureSizeBorders)
 TEST(TilingDataTest, assignment)
 {
     {
-        TestTiling source(8, 16, 32, true);
-        TestTiling dest = source;
+        TilingData source(8, 16, 32, true);
+        TilingData dest = source;
         EXPECT_EQ(source.borderTexels(), dest.borderTexels());
         EXPECT_EQ(source.maxTextureSize(), dest.maxTextureSize());
         EXPECT_EQ(source.numTilesX(), dest.numTilesX());
@@ -522,8 +501,8 @@ TEST(TilingDataTest, assignment)
         EXPECT_EQ(source.totalSizeY(), dest.totalSizeY());
     }
     {
-        TestTiling source(3, 6, 100, false);
-        TestTiling dest(source);
+        TilingData source(3, 6, 100, false);
+        TilingData dest(source);
         EXPECT_EQ(source.borderTexels(), dest.borderTexels());
         EXPECT_EQ(source.maxTextureSize(), dest.maxTextureSize());
         EXPECT_EQ(source.numTilesX(), dest.numTilesX());
@@ -535,7 +514,7 @@ TEST(TilingDataTest, assignment)
 
 TEST(TilingDataTest, setBorderTexels)
 {
-    TestTiling data(8, 16, 32, false);
+    TilingData data(8, 16, 32, false);
     EXPECT_EQ(2, data.numTilesX());
     EXPECT_EQ(4, data.numTilesY());