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

Side by Side Diff: cc/layers/tiled_layer.cc

Issue 647253002: cc: Stop converting update rect from int to float to int. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: displayrectint: ccperftests Created 6 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/layers/tiled_layer.h ('k') | cc/layers/video_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 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/layers/tiled_layer.h" 5 #include "cc/layers/tiled_layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 281
282 added_tile->dirty_rect = tiler_->TileRect(added_tile); 282 added_tile->dirty_rect = tiler_->TileRect(added_tile);
283 283
284 // Temporary diagnostic crash. 284 // Temporary diagnostic crash.
285 CHECK(added_tile); 285 CHECK(added_tile);
286 CHECK(TileAt(i, j)); 286 CHECK(TileAt(i, j));
287 287
288 return added_tile; 288 return added_tile;
289 } 289 }
290 290
291 void TiledLayer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { 291 void TiledLayer::SetNeedsDisplayRect(const gfx::Rect& dirty_rect) {
292 InvalidateContentRect(LayerRectToContentRect(dirty_rect)); 292 InvalidateContentRect(LayerRectToContentRect(dirty_rect));
293 ContentsScalingLayer::SetNeedsDisplayRect(dirty_rect); 293 ContentsScalingLayer::SetNeedsDisplayRect(dirty_rect);
294 } 294 }
295 295
296 void TiledLayer::InvalidateContentRect(const gfx::Rect& content_rect) { 296 void TiledLayer::InvalidateContentRect(const gfx::Rect& content_rect) {
297 UpdateBounds(); 297 UpdateBounds();
298 if (tiler_->is_empty() || content_rect.IsEmpty() || skips_draw_) 298 if (tiler_->is_empty() || content_rect.IsEmpty() || skips_draw_)
299 return; 299 return;
300 300
301 for (LayerTilingData::TileMap::const_iterator iter = tiler_->tiles().begin(); 301 for (LayerTilingData::TileMap::const_iterator iter = tiler_->tiles().begin();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 int left, 457 int left,
458 int top, 458 int top,
459 int right, 459 int right,
460 int bottom, 460 int bottom,
461 ResourceUpdateQueue* queue, 461 ResourceUpdateQueue* queue,
462 const OcclusionTracker<Layer>* occlusion) { 462 const OcclusionTracker<Layer>* occlusion) {
463 // The update_rect should be in layer space. So we have to convert the 463 // The update_rect should be in layer space. So we have to convert the
464 // paint_rect from content space to layer space. 464 // paint_rect from content space to layer space.
465 float width_scale = 1 / draw_properties().contents_scale_x; 465 float width_scale = 1 / draw_properties().contents_scale_x;
466 float height_scale = 1 / draw_properties().contents_scale_y; 466 float height_scale = 1 / draw_properties().contents_scale_y;
467 update_rect_ = gfx::ScaleRect(update_rect, width_scale, height_scale); 467 update_rect_ =
468 gfx::ScaleToEnclosingRect(update_rect, width_scale, height_scale);
468 469
469 // Calling PrepareToUpdate() calls into WebKit to paint, which may have the 470 // Calling PrepareToUpdate() calls into WebKit to paint, which may have the
470 // side effect of disabling compositing, which causes our reference to the 471 // side effect of disabling compositing, which causes our reference to the
471 // texture updater to be deleted. However, we can't free the memory backing 472 // texture updater to be deleted. However, we can't free the memory backing
472 // the SkCanvas until the paint finishes, so we grab a local reference here to 473 // the SkCanvas until the paint finishes, so we grab a local reference here to
473 // hold the updater alive until the paint completes. 474 // hold the updater alive until the paint completes.
474 scoped_refptr<LayerUpdater> protector(Updater()); 475 scoped_refptr<LayerUpdater> protector(Updater());
475 Updater()->PrepareToUpdate(content_bounds(), 476 Updater()->PrepareToUpdate(content_bounds(),
476 paint_rect, 477 paint_rect,
477 tiler_->tile_size(), 478 tiler_->tile_size(),
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 gfx::Rect prepaint_rect = visible_content_rect(); 861 gfx::Rect prepaint_rect = visible_content_rect();
861 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, 862 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns,
862 -tiler_->tile_size().height() * kPrepaintRows); 863 -tiler_->tile_size().height() * kPrepaintRows);
863 gfx::Rect content_rect(content_bounds()); 864 gfx::Rect content_rect(content_bounds());
864 prepaint_rect.Intersect(content_rect); 865 prepaint_rect.Intersect(content_rect);
865 866
866 return prepaint_rect; 867 return prepaint_rect;
867 } 868 }
868 869
869 } // namespace cc 870 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/tiled_layer.h ('k') | cc/layers/video_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698