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

Side by Side Diff: cc/picture_layer.cc

Issue 11824013: Clamps to invalidation region of a PictureLayer to the layer bounds to avoid adding unecessary bulk (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « no previous file | no next file » | 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/picture_layer.h" 5 #include "cc/picture_layer.h"
6 6
7 #include "cc/layer_tree_impl.h" 7 #include "cc/layer_tree_impl.h"
8 #include "cc/picture_layer_impl.h" 8 #include "cc/picture_layer_impl.h"
9 #include "ui/gfx/rect_conversions.h" 9 #include "ui/gfx/rect_conversions.h"
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 45
46 void PictureLayer::setLayerTreeHost(LayerTreeHost* host) { 46 void PictureLayer::setLayerTreeHost(LayerTreeHost* host) {
47 Layer::setLayerTreeHost(host); 47 Layer::setLayerTreeHost(host);
48 if (host) 48 if (host)
49 pile_.SetMinContentsScale(host->settings().minimumContentsScale); 49 pile_.SetMinContentsScale(host->settings().minimumContentsScale);
50 } 50 }
51 51
52 void PictureLayer::setNeedsDisplayRect(const gfx::RectF& layer_rect) { 52 void PictureLayer::setNeedsDisplayRect(const gfx::RectF& layer_rect) {
53 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); 53 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect);
54 pending_invalidation_.Union(rect); 54 if (!rect.IsEmpty()) {
danakj 2013/01/09 01:00:05 i think this if() is kinda surplus too, everything
vangelis 2013/01/09 01:50:36 it is indeed a no-op but still goes though a surpr
danakj 2013/01/09 01:51:48 If it's an issue, maybe we should add it to cc::Re
55 // Clamp invalidation to the layer bounds.
56 rect.Intersect(gfx::Rect(contentBounds()));
danakj 2013/01/09 01:00:05 Sorry to miss this last round: You want bounds() h
vangelis 2013/01/09 01:50:36 Done.
57 pending_invalidation_.Union(rect);
58 }
55 Layer::setNeedsDisplayRect(layer_rect); 59 Layer::setNeedsDisplayRect(layer_rect);
56 } 60 }
57 61
58 void PictureLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, 62 void PictureLayer::update(ResourceUpdateQueue&, const OcclusionTracker*,
59 RenderingStats& stats) { 63 RenderingStats& stats) {
60 if (pile_.size() == bounds() && pending_invalidation_.IsEmpty()) 64 if (pile_.size() == bounds() && pending_invalidation_.IsEmpty())
61 return; 65 return;
62 66
63 pile_.Resize(bounds()); 67 pile_.Resize(bounds());
64 68
65 // Calling paint in WebKit can sometimes cause invalidations, so save 69 // Calling paint in WebKit can sometimes cause invalidations, so save
66 // off the invalidation prior to calling update. 70 // off the invalidation prior to calling update.
67 pile_invalidation_.Swap(pending_invalidation_); 71 pile_invalidation_.Swap(pending_invalidation_);
68 pending_invalidation_.Clear(); 72 pending_invalidation_.Clear();
69 73
70 pile_.Update(client_, pile_invalidation_, stats); 74 pile_.Update(client_, pile_invalidation_, stats);
71 } 75 }
72 76
73 void PictureLayer::setIsMask(bool is_mask) { 77 void PictureLayer::setIsMask(bool is_mask) {
74 is_mask_ = is_mask; 78 is_mask_ = is_mask;
75 } 79 }
76 80
77 } // namespace cc 81 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698