| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 #ifndef CCLayerTilingData_h | 6 #ifndef CCLayerTilingData_h |
| 7 #define CCLayerTilingData_h | 7 #define CCLayerTilingData_h |
| 8 | 8 |
| 9 #if USE(ACCELERATED_COMPOSITING) | 9 #if USE(ACCELERATED_COMPOSITING) |
| 10 | 10 |
| 11 #include "base/basictypes.h" |
| 11 #include "IntRect.h" | 12 #include "IntRect.h" |
| 12 #include "Region.h" | 13 #include "Region.h" |
| 13 #include "TilingData.h" | 14 #include "TilingData.h" |
| 14 #include <wtf/HashMap.h> | 15 #include <wtf/HashMap.h> |
| 15 #include <wtf/HashTraits.h> | 16 #include <wtf/HashTraits.h> |
| 16 #include <wtf/PassOwnPtr.h> | 17 #include <wtf/PassOwnPtr.h> |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 | 20 |
| 20 class CCLayerTilingData { | 21 class CCLayerTilingData { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 IntSize tileSize() const; | 37 IntSize tileSize() const; |
| 37 // Change the border texel setting. This may invalidate all existing tiles. | 38 // Change the border texel setting. This may invalidate all existing tiles. |
| 38 void setBorderTexelOption(BorderTexelOption); | 39 void setBorderTexelOption(BorderTexelOption); |
| 39 bool hasBorderTexels() const { return m_tilingData.borderTexels(); } | 40 bool hasBorderTexels() const { return m_tilingData.borderTexels(); } |
| 40 | 41 |
| 41 bool isEmpty() const { return hasEmptyBounds() || !tiles().size(); } | 42 bool isEmpty() const { return hasEmptyBounds() || !tiles().size(); } |
| 42 | 43 |
| 43 const CCLayerTilingData& operator=(const CCLayerTilingData&); | 44 const CCLayerTilingData& operator=(const CCLayerTilingData&); |
| 44 | 45 |
| 45 class Tile { | 46 class Tile { |
| 46 WTF_MAKE_NONCOPYABLE(Tile); | |
| 47 public: | 47 public: |
| 48 Tile() : m_i(-1), m_j(-1) { } | 48 Tile() : m_i(-1), m_j(-1) { } |
| 49 virtual ~Tile() { } | 49 virtual ~Tile() { } |
| 50 | 50 |
| 51 int i() const { return m_i; } | 51 int i() const { return m_i; } |
| 52 int j() const { return m_j; } | 52 int j() const { return m_j; } |
| 53 void moveTo(int i, int j) { m_i = i; m_j = j; } | 53 void moveTo(int i, int j) { m_i = i; m_j = j; } |
| 54 | 54 |
| 55 const IntRect& opaqueRect() const { return m_opaqueRect; } | 55 const IntRect& opaqueRect() const { return m_opaqueRect; } |
| 56 void setOpaqueRect(const IntRect& opaqueRect) { m_opaqueRect = opaqueRec
t; } | 56 void setOpaqueRect(const IntRect& opaqueRect) { m_opaqueRect = opaqueRec
t; } |
| 57 private: | 57 private: |
| 58 int m_i; | 58 int m_i; |
| 59 int m_j; | 59 int m_j; |
| 60 IntRect m_opaqueRect; | 60 IntRect m_opaqueRect; |
| 61 DISALLOW_COPY_AND_ASSIGN(Tile); |
| 61 }; | 62 }; |
| 62 // Default hash key traits for integers disallow 0 and -1 as a key, so | 63 // Default hash key traits for integers disallow 0 and -1 as a key, so |
| 63 // use a custom hash trait which disallows -1 and -2 instead. | 64 // use a custom hash trait which disallows -1 and -2 instead. |
| 64 typedef std::pair<int, int> TileMapKey; | 65 typedef std::pair<int, int> TileMapKey; |
| 65 struct TileMapKeyTraits : HashTraits<TileMapKey> { | 66 struct TileMapKeyTraits : HashTraits<TileMapKey> { |
| 66 static const bool emptyValueIsZero = false; | 67 static const bool emptyValueIsZero = false; |
| 67 static const bool needsDestruction = false; | 68 static const bool needsDestruction = false; |
| 68 static TileMapKey emptyValue() { return std::make_pair(-1, -1); } | 69 static TileMapKey emptyValue() { return std::make_pair(-1, -1); } |
| 69 static void constructDeletedValue(TileMapKey& slot) { slot = std::make_p
air(-2, -2); } | 70 static void constructDeletedValue(TileMapKey& slot) { slot = std::make_p
air(-2, -2); } |
| 70 static bool isDeletedValue(TileMapKey value) { return value.first == -2
&& value.second == -2; } | 71 static bool isDeletedValue(TileMapKey value) { return value.first == -2
&& value.second == -2; } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 91 | 92 |
| 92 TileMap m_tiles; | 93 TileMap m_tiles; |
| 93 TilingData m_tilingData; | 94 TilingData m_tilingData; |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 } | 97 } |
| 97 | 98 |
| 98 #endif // USE(ACCELERATED_COMPOSITING) | 99 #endif // USE(ACCELERATED_COMPOSITING) |
| 99 | 100 |
| 100 #endif | 101 #endif |
| OLD | NEW |