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

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

Issue 240593004: cc: Fix missing compositor invalidations during resize (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avoid assertion on empty bounds Created 6 years, 8 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/base/tiling_data.h ('k') | cc/base/tiling_data_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 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/rect.h" 9 #include "ui/gfx/rect.h"
10 #include "ui/gfx/vector2d.h" 10 #include "ui/gfx/vector2d.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 return 0; 131 return 0;
132 132
133 src_position -= tiling_rect_.y(); 133 src_position -= tiling_rect_.y();
134 134
135 DCHECK_GT(max_texture_size_.height() - 2 * border_texels_, 0); 135 DCHECK_GT(max_texture_size_.height() - 2 * border_texels_, 0);
136 int inner_tile_size = max_texture_size_.height() - 2 * border_texels_; 136 int inner_tile_size = max_texture_size_.height() - 2 * border_texels_;
137 int y = src_position / inner_tile_size; 137 int y = src_position / inner_tile_size;
138 return std::min(std::max(y, 0), num_tiles_y_ - 1); 138 return std::min(std::max(y, 0), num_tiles_y_ - 1);
139 } 139 }
140 140
141 gfx::Rect TilingData::ExpandRectToTileBoundsWithBorders(
142 const gfx::Rect rect) const {
143 if (!rect.Intersects(tiling_rect_) || has_empty_bounds())
144 return gfx::Rect();
145 int index_x = FirstBorderTileXIndexFromSrcCoord(rect.x());
146 int index_y = FirstBorderTileYIndexFromSrcCoord(rect.y());
147 int index_right = LastBorderTileXIndexFromSrcCoord(rect.right());
148 int index_bottom = LastBorderTileYIndexFromSrcCoord(rect.bottom());
149
150 gfx::Rect rect_top_left(TileBoundsWithBorder(index_x, index_y));
151 gfx::Rect rect_bottom_right(TileBoundsWithBorder(index_right, index_bottom));
152
153 gfx::Rect expanded(rect_top_left);
154 expanded.Union(rect_bottom_right);
155 return expanded;
156 }
157
141 gfx::Rect TilingData::TileBounds(int i, int j) const { 158 gfx::Rect TilingData::TileBounds(int i, int j) const {
142 AssertTile(i, j); 159 AssertTile(i, j);
143 int max_texture_size_x = max_texture_size_.width() - 2 * border_texels_; 160 int max_texture_size_x = max_texture_size_.width() - 2 * border_texels_;
144 int max_texture_size_y = max_texture_size_.height() - 2 * border_texels_; 161 int max_texture_size_y = max_texture_size_.height() - 2 * border_texels_;
145 162
146 int lo_x = tiling_rect_.x() + max_texture_size_x * i; 163 int lo_x = tiling_rect_.x() + max_texture_size_x * i;
147 if (i != 0) 164 if (i != 0)
148 lo_x += border_texels_; 165 lo_x += border_texels_;
149 166
150 int lo_y = tiling_rect_.y() + max_texture_size_y * j; 167 int lo_y = tiling_rect_.y() + max_texture_size_y * j;
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 current_step_ = 0; 669 current_step_ = 0;
653 direction_ = static_cast<Direction>((direction_ + 1) % 4); 670 direction_ = static_cast<Direction>((direction_ + 1) % 4);
654 671
655 if (direction_ == RIGHT || direction_ == LEFT) { 672 if (direction_ == RIGHT || direction_ == LEFT) {
656 ++vertical_step_count_; 673 ++vertical_step_count_;
657 ++horizontal_step_count_; 674 ++horizontal_step_count_;
658 } 675 }
659 } 676 }
660 677
661 } // namespace cc 678 } // namespace cc
OLDNEW
« no previous file with comments | « cc/base/tiling_data.h ('k') | cc/base/tiling_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698