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

Side by Side Diff: cc/tiles/picture_layer_tiling.cc

Issue 1357423009: gfx: Make conversions from Size to SizeF be explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sizefconvert-gfx: . Created 5 years, 2 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
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | cc/tiles/picture_layer_tiling_set_unittest.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/tiles/picture_layer_tiling.h" 5 #include "cc/tiles/picture_layer_tiling.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 may_contain_low_resolution_tiles_(false), 67 may_contain_low_resolution_tiles_(false),
68 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels), 68 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels),
69 can_require_tiles_for_activation_(false), 69 can_require_tiles_for_activation_(false),
70 current_content_to_screen_scale_(0.f), 70 current_content_to_screen_scale_(0.f),
71 has_visible_rect_tiles_(false), 71 has_visible_rect_tiles_(false),
72 has_skewport_rect_tiles_(false), 72 has_skewport_rect_tiles_(false),
73 has_soon_border_rect_tiles_(false), 73 has_soon_border_rect_tiles_(false),
74 has_eventually_rect_tiles_(false), 74 has_eventually_rect_tiles_(false),
75 all_tiles_done_(true) { 75 all_tiles_done_(true) {
76 DCHECK(!raster_source->IsSolidColor()); 76 DCHECK(!raster_source->IsSolidColor());
77 gfx::Size content_bounds = gfx::ToCeiledSize( 77 gfx::Size content_bounds =
78 gfx::ScaleSize(raster_source_->GetSize(), contents_scale)); 78 gfx::ScaleToCeiledSize(raster_source_->GetSize(), contents_scale);
79 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); 79 gfx::Size tile_size = client_->CalculateTileSize(content_bounds);
80 80
81 DCHECK(!gfx::ToFlooredSize(gfx::ScaleSize(raster_source_->GetSize(), 81 DCHECK(!gfx::ScaleToFlooredSize(raster_source_->GetSize(), contents_scale)
82 contents_scale)).IsEmpty()) 82 .IsEmpty())
83 << "Tiling created with scale too small as contents become empty." 83 << "Tiling created with scale too small as contents become empty."
84 << " Layer bounds: " << raster_source_->GetSize().ToString() 84 << " Layer bounds: " << raster_source_->GetSize().ToString()
85 << " Contents scale: " << contents_scale; 85 << " Contents scale: " << contents_scale;
86 86
87 tiling_data_.SetTilingSize(content_bounds); 87 tiling_data_.SetTilingSize(content_bounds);
88 tiling_data_.SetMaxTextureSize(tile_size); 88 tiling_data_.SetMaxTextureSize(tile_size);
89 } 89 }
90 90
91 PictureLayerTiling::~PictureLayerTiling() { 91 PictureLayerTiling::~PictureLayerTiling() {
92 } 92 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 pending_twin->current_occlusion_in_layer_space_); 204 pending_twin->current_occlusion_in_layer_space_);
205 } 205 }
206 206
207 void PictureLayerTiling::SetRasterSourceAndResize( 207 void PictureLayerTiling::SetRasterSourceAndResize(
208 scoped_refptr<RasterSource> raster_source) { 208 scoped_refptr<RasterSource> raster_source) {
209 DCHECK(!raster_source->IsSolidColor()); 209 DCHECK(!raster_source->IsSolidColor());
210 gfx::Size old_layer_bounds = raster_source_->GetSize(); 210 gfx::Size old_layer_bounds = raster_source_->GetSize();
211 raster_source_.swap(raster_source); 211 raster_source_.swap(raster_source);
212 gfx::Size new_layer_bounds = raster_source_->GetSize(); 212 gfx::Size new_layer_bounds = raster_source_->GetSize();
213 gfx::Size content_bounds = 213 gfx::Size content_bounds =
214 gfx::ToCeiledSize(gfx::ScaleSize(new_layer_bounds, contents_scale_)); 214 gfx::ScaleToCeiledSize(new_layer_bounds, contents_scale_);
215 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); 215 gfx::Size tile_size = client_->CalculateTileSize(content_bounds);
216 216
217 if (tile_size != tiling_data_.max_texture_size()) { 217 if (tile_size != tiling_data_.max_texture_size()) {
218 tiling_data_.SetTilingSize(content_bounds); 218 tiling_data_.SetTilingSize(content_bounds);
219 tiling_data_.SetMaxTextureSize(tile_size); 219 tiling_data_.SetMaxTextureSize(tile_size);
220 // When the tile size changes, the TilingData positions no longer work 220 // When the tile size changes, the TilingData positions no longer work
221 // as valid keys to the TileMap, so just drop all tiles and clear the live 221 // as valid keys to the TileMap, so just drop all tiles and clear the live
222 // tiles rect. 222 // tiles rect.
223 Reset(); 223 Reset();
224 return; 224 return;
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { 1005 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const {
1006 size_t amount = 0; 1006 size_t amount = 0;
1007 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { 1007 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
1008 const Tile* tile = it->second; 1008 const Tile* tile = it->second;
1009 amount += tile->GPUMemoryUsageInBytes(); 1009 amount += tile->GPUMemoryUsageInBytes();
1010 } 1010 }
1011 return amount; 1011 return amount;
1012 } 1012 }
1013 1013
1014 } // namespace cc 1014 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | cc/tiles/picture_layer_tiling_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698