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 #include "config.h" | 6 #include "config.h" |
7 | 7 |
8 #if USE(ACCELERATED_COMPOSITING) | 8 #if USE(ACCELERATED_COMPOSITING) |
9 | 9 |
10 #include "CCLayerTilingData.h" | 10 #include "CCLayerTilingData.h" |
11 | 11 |
| 12 #include "base/logging.h" |
| 13 |
12 using namespace std; | 14 using namespace std; |
13 | 15 |
14 namespace cc { | 16 namespace cc { |
15 | 17 |
16 PassOwnPtr<CCLayerTilingData> CCLayerTilingData::create(const IntSize& tileSize,
BorderTexelOption border) | 18 PassOwnPtr<CCLayerTilingData> CCLayerTilingData::create(const IntSize& tileSize,
BorderTexelOption border) |
17 { | 19 { |
18 return adoptPtr(new CCLayerTilingData(tileSize, border)); | 20 return adoptPtr(new CCLayerTilingData(tileSize, border)); |
19 } | 21 } |
20 | 22 |
21 CCLayerTilingData::CCLayerTilingData(const IntSize& tileSize, BorderTexelOption
border) | 23 CCLayerTilingData::CCLayerTilingData(const IntSize& tileSize, BorderTexelOption
border) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 57 |
56 const CCLayerTilingData& CCLayerTilingData::operator=(const CCLayerTilingData& t
iler) | 58 const CCLayerTilingData& CCLayerTilingData::operator=(const CCLayerTilingData& t
iler) |
57 { | 59 { |
58 m_tilingData = tiler.m_tilingData; | 60 m_tilingData = tiler.m_tilingData; |
59 | 61 |
60 return *this; | 62 return *this; |
61 } | 63 } |
62 | 64 |
63 void CCLayerTilingData::addTile(PassOwnPtr<Tile> tile, int i, int j) | 65 void CCLayerTilingData::addTile(PassOwnPtr<Tile> tile, int i, int j) |
64 { | 66 { |
65 ASSERT(!tileAt(i, j)); | 67 DCHECK(!tileAt(i, j)); |
66 tile->moveTo(i, j); | 68 tile->moveTo(i, j); |
67 m_tiles.add(make_pair(i, j), tile); | 69 m_tiles.add(make_pair(i, j), tile); |
68 } | 70 } |
69 | 71 |
70 PassOwnPtr<CCLayerTilingData::Tile> CCLayerTilingData::takeTile(int i, int j) | 72 PassOwnPtr<CCLayerTilingData::Tile> CCLayerTilingData::takeTile(int i, int j) |
71 { | 73 { |
72 return m_tiles.take(make_pair(i, j)); | 74 return m_tiles.take(make_pair(i, j)); |
73 } | 75 } |
74 | 76 |
75 CCLayerTilingData::Tile* CCLayerTilingData::tileAt(int i, int j) const | 77 CCLayerTilingData::Tile* CCLayerTilingData::tileAt(int i, int j) const |
76 { | 78 { |
77 return m_tiles.get(make_pair(i, j)); | 79 return m_tiles.get(make_pair(i, j)); |
78 } | 80 } |
79 | 81 |
80 void CCLayerTilingData::reset() | 82 void CCLayerTilingData::reset() |
81 { | 83 { |
82 m_tiles.clear(); | 84 m_tiles.clear(); |
83 } | 85 } |
84 | 86 |
85 void CCLayerTilingData::contentRectToTileIndices(const IntRect& contentRect, int
& left, int& top, int& right, int& bottom) const | 87 void CCLayerTilingData::contentRectToTileIndices(const IntRect& contentRect, int
& left, int& top, int& right, int& bottom) const |
86 { | 88 { |
87 // An empty rect doesn't result in an empty set of tiles, so don't pass an e
mpty rect. | 89 // An empty rect doesn't result in an empty set of tiles, so don't pass an e
mpty rect. |
88 // FIXME: Possibly we should fill a vector of tiles instead, | 90 // FIXME: Possibly we should fill a vector of tiles instead, |
89 // since the normal use of this function is to enumerate some tiles. | 91 // since the normal use of this function is to enumerate some tiles. |
90 ASSERT(!contentRect.isEmpty()); | 92 DCHECK(!contentRect.isEmpty()); |
91 | 93 |
92 left = m_tilingData.tileXIndexFromSrcCoord(contentRect.x()); | 94 left = m_tilingData.tileXIndexFromSrcCoord(contentRect.x()); |
93 top = m_tilingData.tileYIndexFromSrcCoord(contentRect.y()); | 95 top = m_tilingData.tileYIndexFromSrcCoord(contentRect.y()); |
94 right = m_tilingData.tileXIndexFromSrcCoord(contentRect.maxX() - 1); | 96 right = m_tilingData.tileXIndexFromSrcCoord(contentRect.maxX() - 1); |
95 bottom = m_tilingData.tileYIndexFromSrcCoord(contentRect.maxY() - 1); | 97 bottom = m_tilingData.tileYIndexFromSrcCoord(contentRect.maxY() - 1); |
96 } | 98 } |
97 | 99 |
98 IntRect CCLayerTilingData::tileRect(const Tile* tile) const | 100 IntRect CCLayerTilingData::tileRect(const Tile* tile) const |
99 { | 101 { |
100 IntRect tileRect = m_tilingData.tileBoundsWithBorder(tile->i(), tile->j()); | 102 IntRect tileRect = m_tilingData.tileBoundsWithBorder(tile->i(), tile->j()); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 151 } |
150 | 152 |
151 IntSize CCLayerTilingData::bounds() const | 153 IntSize CCLayerTilingData::bounds() const |
152 { | 154 { |
153 return m_tilingData.totalSize(); | 155 return m_tilingData.totalSize(); |
154 } | 156 } |
155 | 157 |
156 } // namespace cc | 158 } // namespace cc |
157 | 159 |
158 #endif // USE(ACCELERATED_COMPOSITING) | 160 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |