Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(715)

Side by Side Diff: cc/resources/layer_tiling_data.cc

Issue 389973004: cc: Give TilingData back a Size instead of a Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tilingsize: comments Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/resources/layer_tiling_data.h ('k') | cc/resources/picture_layer_tiling.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "cc/resources/layer_tiling_data.h" 5 #include "cc/resources/layer_tiling_data.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 scoped_ptr<LayerTilingData> LayerTilingData::Create(const gfx::Size& tile_size, 13 scoped_ptr<LayerTilingData> LayerTilingData::Create(const gfx::Size& tile_size,
14 BorderTexelOption border) { 14 BorderTexelOption border) {
15 return make_scoped_ptr(new LayerTilingData(tile_size, border)); 15 return make_scoped_ptr(new LayerTilingData(tile_size, border));
16 } 16 }
17 17
18 LayerTilingData::LayerTilingData(const gfx::Size& tile_size, 18 LayerTilingData::LayerTilingData(const gfx::Size& tile_size,
19 BorderTexelOption border) 19 BorderTexelOption border)
20 : tiling_data_(tile_size, gfx::Rect(), border == HAS_BORDER_TEXELS) { 20 : tiling_data_(tile_size, gfx::Size(), border == HAS_BORDER_TEXELS) {
21 SetTileSize(tile_size); 21 SetTileSize(tile_size);
22 } 22 }
23 23
24 LayerTilingData::~LayerTilingData() {} 24 LayerTilingData::~LayerTilingData() {}
25 25
26 void LayerTilingData::SetTileSize(const gfx::Size& size) { 26 void LayerTilingData::SetTileSize(const gfx::Size& size) {
27 if (tile_size() == size) 27 if (tile_size() == size)
28 return; 28 return;
29 29
30 reset(); 30 reset();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 continue; 105 continue;
106 106
107 gfx::Rect tile_opaque_rect = 107 gfx::Rect tile_opaque_rect =
108 gfx::IntersectRects(content_rect, tile->opaque_rect()); 108 gfx::IntersectRects(content_rect, tile->opaque_rect());
109 opaque_region.Union(tile_opaque_rect); 109 opaque_region.Union(tile_opaque_rect);
110 } 110 }
111 } 111 }
112 return opaque_region; 112 return opaque_region;
113 } 113 }
114 114
115 void LayerTilingData::SetTilingRect(const gfx::Rect& tiling_rect) { 115 void LayerTilingData::SetTilingSize(const gfx::Size& tiling_size) {
116 tiling_data_.SetTilingRect(tiling_rect); 116 tiling_data_.SetTilingSize(tiling_size);
117 if (tiling_rect.IsEmpty()) { 117 if (tiling_size.IsEmpty()) {
118 tiles_.clear(); 118 tiles_.clear();
119 return; 119 return;
120 } 120 }
121 121
122 // Any tiles completely outside our new bounds are invalid and should be 122 // Any tiles completely outside our new bounds are invalid and should be
123 // dropped. 123 // dropped.
124 int left, top, right, bottom; 124 int left, top, right, bottom;
125 ContentRectToTileIndices(tiling_rect, &left, &top, &right, &bottom); 125 ContentRectToTileIndices(
126 gfx::Rect(tiling_size), &left, &top, &right, &bottom);
126 std::vector<TileMapKey> invalid_tile_keys; 127 std::vector<TileMapKey> invalid_tile_keys;
127 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { 128 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
128 if (it->first.first > right || it->first.second > bottom) 129 if (it->first.first > right || it->first.second > bottom)
129 invalid_tile_keys.push_back(it->first); 130 invalid_tile_keys.push_back(it->first);
130 } 131 }
131 for (size_t i = 0; i < invalid_tile_keys.size(); ++i) 132 for (size_t i = 0; i < invalid_tile_keys.size(); ++i)
132 tiles_.erase(invalid_tile_keys[i]); 133 tiles_.erase(invalid_tile_keys[i]);
133 } 134 }
134 135
135 } // namespace cc 136 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/layer_tiling_data.h ('k') | cc/resources/picture_layer_tiling.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698