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

Side by Side Diff: cc/base/tiling_data.cc

Issue 2295343005: Improve PictureLayerTiling::CoverageIterator to handle rounding more precisely (Closed)
Patch Set: remove the 1.5 Created 4 years, 3 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/base/tiling_data.h ('k') | cc/layers/picture_layer_impl.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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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/base/tiling_data.h" 5 #include "cc/base/tiling_data.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/gfx/geometry/rect.h" 9 #include "ui/gfx/geometry/rect.h"
10 #include "ui/gfx/geometry/rect_f.h"
10 #include "ui/gfx/geometry/vector2d.h" 11 #include "ui/gfx/geometry/vector2d.h"
11 12
12 namespace cc { 13 namespace cc {
13 14
14 static int ComputeNumTiles(int max_texture_size, 15 static int ComputeNumTiles(int max_texture_size,
15 int total_size, 16 int total_size,
16 int border_texels) { 17 int border_texels) {
17 if (max_texture_size - 2 * border_texels <= 0) 18 if (max_texture_size - 2 * border_texels <= 0)
18 return total_size > 0 && max_texture_size >= total_size ? 1 : 0; 19 return total_size > 0 && max_texture_size >= total_size ? 1 : 0;
19 20
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 return max_texture_size_.height() - border_texels_; 273 return max_texture_size_.height() - border_texels_;
273 if (y_index < num_tiles_y_ - 1) 274 if (y_index < num_tiles_y_ - 1)
274 return max_texture_size_.height() - 2 * border_texels_; 275 return max_texture_size_.height() - 2 * border_texels_;
275 if (y_index == num_tiles_y_ - 1) 276 if (y_index == num_tiles_y_ - 1)
276 return tiling_size_.height() - TilePositionY(y_index); 277 return tiling_size_.height() - TilePositionY(y_index);
277 278
278 NOTREACHED(); 279 NOTREACHED();
279 return 0; 280 return 0;
280 } 281 }
281 282
283 gfx::RectF TilingData::TexelExtent(int i, int j) const {
284 gfx::RectF result(TileBoundsWithBorder(i, j));
285 result.Inset(0.5f, 0.5f);
286 return result;
287 }
288
282 gfx::Vector2d TilingData::TextureOffset(int x_index, int y_index) const { 289 gfx::Vector2d TilingData::TextureOffset(int x_index, int y_index) const {
283 int left = (!x_index || num_tiles_x_ == 1) ? 0 : border_texels_; 290 int left = (!x_index || num_tiles_x_ == 1) ? 0 : border_texels_;
284 int top = (!y_index || num_tiles_y_ == 1) ? 0 : border_texels_; 291 int top = (!y_index || num_tiles_y_ == 1) ? 0 : border_texels_;
285 292
286 return gfx::Vector2d(left, top); 293 return gfx::Vector2d(left, top);
287 } 294 }
288 295
289 void TilingData::RecomputeNumTiles() { 296 void TilingData::RecomputeNumTiles() {
290 num_tiles_x_ = ComputeNumTiles( 297 num_tiles_x_ = ComputeNumTiles(
291 max_texture_size_.width(), tiling_size_.width(), border_texels_); 298 max_texture_size_.width(), tiling_size_.width(), border_texels_);
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 865
859 // We should always end up in an around rect at some point. 866 // We should always end up in an around rect at some point.
860 // Since the direction is now vertical, we have to ensure that we will 867 // Since the direction is now vertical, we have to ensure that we will
861 // advance. 868 // advance.
862 DCHECK_GE(horizontal_step_count_, 1); 869 DCHECK_GE(horizontal_step_count_, 1);
863 DCHECK_GE(vertical_step_count_, 1); 870 DCHECK_GE(vertical_step_count_, 1);
864 } 871 }
865 } 872 }
866 873
867 } // namespace cc 874 } // namespace cc
OLDNEW
« no previous file with comments | « cc/base/tiling_data.h ('k') | cc/layers/picture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698