| 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 #include "cc/layer_tiling_data.h" | 8 #include "cc/layer_tiling_data.h" |
| 9 | 9 |
| 10 #include "IntRect.h" |
| 11 #include "IntSize.h" |
| 10 #include "base/logging.h" | 12 #include "base/logging.h" |
| 11 | 13 |
| 12 using namespace std; | 14 using namespace std; |
| 13 | 15 |
| 14 namespace cc { | 16 namespace cc { |
| 15 | 17 |
| 16 scoped_ptr<LayerTilingData> LayerTilingData::create(const gfx::Size& tileSize, B
orderTexelOption border) | 18 scoped_ptr<LayerTilingData> LayerTilingData::create(const gfx::Size& tileSize, B
orderTexelOption border) |
| 17 { | 19 { |
| 18 return make_scoped_ptr(new LayerTilingData(tileSize, border)); | 20 return make_scoped_ptr(new LayerTilingData(tileSize, border)); |
| 19 } | 21 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 Region opaqueRegion; | 112 Region opaqueRegion; |
| 111 int left, top, right, bottom; | 113 int left, top, right, bottom; |
| 112 contentRectToTileIndices(contentRect, left, top, right, bottom); | 114 contentRectToTileIndices(contentRect, left, top, right, bottom); |
| 113 for (int j = top; j <= bottom; ++j) { | 115 for (int j = top; j <= bottom; ++j) { |
| 114 for (int i = left; i <= right; ++i) { | 116 for (int i = left; i <= right; ++i) { |
| 115 Tile* tile = tileAt(i, j); | 117 Tile* tile = tileAt(i, j); |
| 116 if (!tile) | 118 if (!tile) |
| 117 continue; | 119 continue; |
| 118 | 120 |
| 119 gfx::Rect tileOpaqueRect = gfx::IntersectRects(contentRect, tile->op
aqueRect()); | 121 gfx::Rect tileOpaqueRect = gfx::IntersectRects(contentRect, tile->op
aqueRect()); |
| 120 opaqueRegion.unite(cc::IntRect(tileOpaqueRect)); | 122 opaqueRegion.Union(tileOpaqueRect); |
| 121 } | 123 } |
| 122 } | 124 } |
| 123 return opaqueRegion; | 125 return opaqueRegion; |
| 124 } | 126 } |
| 125 | 127 |
| 126 void LayerTilingData::setBounds(const gfx::Size& size) | 128 void LayerTilingData::setBounds(const gfx::Size& size) |
| 127 { | 129 { |
| 128 m_tilingData.setTotalSize(cc::IntSize(size)); | 130 m_tilingData.setTotalSize(cc::IntSize(size)); |
| 129 if (size.IsEmpty()) { | 131 if (size.IsEmpty()) { |
| 130 m_tiles.clear(); | 132 m_tiles.clear(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 142 for (size_t i = 0; i < invalidTileKeys.size(); ++i) | 144 for (size_t i = 0; i < invalidTileKeys.size(); ++i) |
| 143 m_tiles.erase(invalidTileKeys[i]); | 145 m_tiles.erase(invalidTileKeys[i]); |
| 144 } | 146 } |
| 145 | 147 |
| 146 gfx::Size LayerTilingData::bounds() const | 148 gfx::Size LayerTilingData::bounds() const |
| 147 { | 149 { |
| 148 return cc::IntSize(m_tilingData.totalSize()); | 150 return cc::IntSize(m_tilingData.totalSize()); |
| 149 } | 151 } |
| 150 | 152 |
| 151 } // namespace cc | 153 } // namespace cc |
| OLD | NEW |