| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 int numTilesX() const { return m_numTilesX; } | 54 int numTilesX() const { return m_numTilesX; } |
| 55 int numTilesY() const { return m_numTilesY; } | 55 int numTilesY() const { return m_numTilesY; } |
| 56 int tileIndex(int x, int y) const { return x + y * numTilesX(); } | 56 int tileIndex(int x, int y) const { return x + y * numTilesX(); } |
| 57 int tileXIndex(int tile) const { assertTile(tile); return tile % numTilesX()
; } | 57 int tileXIndex(int tile) const { assertTile(tile); return tile % numTilesX()
; } |
| 58 int tileYIndex(int tile) const { assertTile(tile); return tile / numTilesX()
; } | 58 int tileYIndex(int tile) const { assertTile(tile); return tile / numTilesX()
; } |
| 59 int tileXIndexFromSrcCoord(int) const; | 59 int tileXIndexFromSrcCoord(int) const; |
| 60 int tileYIndexFromSrcCoord(int) const; | 60 int tileYIndexFromSrcCoord(int) const; |
| 61 | 61 |
| 62 IntRect tileBounds(int tile) const; | 62 IntRect tileBounds(int tile) const; |
| 63 IntRect tileBoundsWithBorder(int tile) const; | 63 IntRect tileBoundsWithBorder(int tile) const; |
| 64 IntRect tileBoundsWithOuterBorder(int tile) const; | |
| 65 FloatRect tileBoundsNormalized(int tile) const; | 64 FloatRect tileBoundsNormalized(int tile) const; |
| 66 int tilePositionX(int xIndex) const; | 65 int tilePositionX(int xIndex) const; |
| 67 int tilePositionY(int yIndex) const; | 66 int tilePositionY(int yIndex) const; |
| 68 int tileSizeX(int xIndex) const; | 67 int tileSizeX(int xIndex) const; |
| 69 int tileSizeY(int yIndex) const; | 68 int tileSizeY(int yIndex) const; |
| 70 IntRect overlappedTileIndices(const IntRect& srcRect) const; | 69 IntRect overlappedTileIndices(const IntRect& srcRect) const; |
| 71 IntRect overlappedTileIndices(const FloatRect& srcRect) const; | 70 IntRect overlappedTileIndices(const FloatRect& srcRect) const; |
| 72 | 71 |
| 73 // Given a set of source and destination coordinates for a drawing quad | 72 // Given a set of source and destination coordinates for a drawing quad |
| 74 // in texel units, returns adjusted data to render just the one tile. | 73 // in texel units, returns adjusted data to render just the one tile. |
| 75 void intersectDrawQuad(const FloatRect& srcRect, const FloatRect& dstRect, i
nt tile, FloatRect* newSrc, FloatRect* newDst) const; | 74 void intersectDrawQuad(const FloatRect& srcRect, const FloatRect& dstRect, i
nt tile, FloatRect* newSrc, FloatRect* newDst) const; |
| 76 | 75 |
| 77 // Difference between tileBound's and tileBoundWithBorder's location(). | 76 // Difference between tileBound's and tileBoundWithBorder's location(). |
| 78 IntPoint textureOffset() const; | 77 IntPoint textureOffset(int xIndex, int yIndex) const; |
| 79 | 78 |
| 80 private: | 79 private: |
| 81 TilingData() : m_maxTextureSize(0), m_totalSizeX(0), m_totalSizeY(0) {} | 80 TilingData() : m_maxTextureSize(0), m_totalSizeX(0), m_totalSizeY(0) {} |
| 82 #ifndef NDEBUG | 81 #ifndef NDEBUG |
| 83 void assertTile(int tile) const { ASSERT(tile >= 0 && tile < numTiles()); } | 82 void assertTile(int tile) const { ASSERT(tile >= 0 && tile < numTiles()); } |
| 84 #else | 83 #else |
| 85 void assertTile(int) const {} | 84 void assertTile(int) const {} |
| 86 #endif | 85 #endif |
| 87 void recomputeNumTiles(); | 86 void recomputeNumTiles(); |
| 88 | 87 |
| 89 int m_maxTextureSize; | 88 int m_maxTextureSize; |
| 90 int m_totalSizeX; | 89 int m_totalSizeX; |
| 91 int m_totalSizeY; | 90 int m_totalSizeY; |
| 92 int m_borderTexels; // 0 or 1 | 91 int m_borderTexels; // 0 or 1 |
| 93 | 92 |
| 94 // computed values: | 93 // computed values: |
| 95 int m_numTilesX; | 94 int m_numTilesX; |
| 96 int m_numTilesY; | 95 int m_numTilesY; |
| 97 }; | 96 }; |
| 98 | 97 |
| 99 } | 98 } |
| 100 | 99 |
| 101 #endif // TilingData_h | 100 #endif // TilingData_h |
| OLD | NEW |