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

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

Issue 21839004: cc: Push valid property values when CalcDrawProps skips layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pushpaintprops: Simpler to dcheck in TiledLayer Created 7 years, 4 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
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/layers/picture_layer.h" 5 #include "cc/layers/picture_layer.h"
6 6
7 #include "cc/debug/benchmark_instrumentation.h" 7 #include "cc/debug/benchmark_instrumentation.h"
8 #include "cc/debug/devtools_instrumentation.h" 8 #include "cc/debug/devtools_instrumentation.h"
9 #include "cc/layers/picture_layer_impl.h" 9 #include "cc/layers/picture_layer_impl.h"
10 #include "cc/trees/layer_tree_impl.h" 10 #include "cc/trees/layer_tree_impl.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 void PictureLayer::SetNeedsDisplayRect(const gfx::RectF& layer_rect) { 62 void PictureLayer::SetNeedsDisplayRect(const gfx::RectF& layer_rect) {
63 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); 63 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect);
64 if (!rect.IsEmpty()) { 64 if (!rect.IsEmpty()) {
65 // Clamp invalidation to the layer bounds. 65 // Clamp invalidation to the layer bounds.
66 rect.Intersect(gfx::Rect(bounds())); 66 rect.Intersect(gfx::Rect(bounds()));
67 pending_invalidation_.Union(rect); 67 pending_invalidation_.Union(rect);
68 } 68 }
69 Layer::SetNeedsDisplayRect(layer_rect); 69 Layer::SetNeedsDisplayRect(layer_rect);
70 } 70 }
71 71
72 bool PictureLayer::Update(ResourceUpdateQueue*, 72 bool PictureLayer::Update(ResourceUpdateQueue* queue,
73 const OcclusionTracker*) { 73 const OcclusionTracker* occlusion) {
74 // Do not early-out of this function so that PicturePile::Update has a chance 74 // Do not early-out of this function so that PicturePile::Update has a chance
75 // to record pictures due to changing visibility of this layer. 75 // to record pictures due to changing visibility of this layer.
76 76
77 TRACE_EVENT1(benchmark_instrumentation::kCategory, 77 TRACE_EVENT1(benchmark_instrumentation::kCategory,
78 benchmark_instrumentation::kPictureLayerUpdate, 78 benchmark_instrumentation::kPictureLayerUpdate,
79 benchmark_instrumentation::kSourceFrameNumber, 79 benchmark_instrumentation::kSourceFrameNumber,
80 layer_tree_host()->source_frame_number()); 80 layer_tree_host()->source_frame_number());
81 81
82 // Note: This layer does not use ContentsScalingLayer::Update().
83 // TODO(danakj): Maybe this should not inherit from ContentsScalingLayer then.
enne (OOO) 2013/08/02 17:00:48 Agreed.
84 bool updated = Layer::Update(queue, occlusion);
85
82 pile_->Resize(paint_properties().bounds); 86 pile_->Resize(paint_properties().bounds);
83 87
84 // Calling paint in WebKit can sometimes cause invalidations, so save 88 // Calling paint in WebKit can sometimes cause invalidations, so save
85 // off the invalidation prior to calling update. 89 // off the invalidation prior to calling update.
86 pending_invalidation_.Swap(&pile_invalidation_); 90 pending_invalidation_.Swap(&pile_invalidation_);
87 pending_invalidation_.Clear(); 91 pending_invalidation_.Clear();
88 92
89 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( 93 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect(
90 visible_content_rect(), 1.f / contents_scale_x()); 94 visible_content_rect(), 1.f / contents_scale_x());
91 if (layer_tree_host()->settings().using_synchronous_renderer_compositor) { 95 if (layer_tree_host()->settings().using_synchronous_renderer_compositor) {
92 // Workaround for http://crbug.com/235910 - to retain backwards compat 96 // Workaround for http://crbug.com/235910 - to retain backwards compat
93 // the full page content must always be provided in the picture layer. 97 // the full page content must always be provided in the picture layer.
94 visible_layer_rect = gfx::Rect(bounds()); 98 visible_layer_rect = gfx::Rect(bounds());
95 } 99 }
96 devtools_instrumentation::ScopedLayerTask paint_layer( 100 devtools_instrumentation::ScopedLayerTask paint_layer(
97 devtools_instrumentation::kPaintLayer, id()); 101 devtools_instrumentation::kPaintLayer, id());
98 bool updated = pile_->Update(client_, 102 updated |= pile_->Update(client_,
99 SafeOpaqueBackgroundColor(), 103 SafeOpaqueBackgroundColor(),
100 contents_opaque(), 104 contents_opaque(),
101 pile_invalidation_, 105 pile_invalidation_,
102 visible_layer_rect, 106 visible_layer_rect,
103 rendering_stats_instrumentation()); 107 rendering_stats_instrumentation());
104 if (updated) { 108 if (updated) {
105 SetNeedsPushProperties(); 109 SetNeedsPushProperties();
106 } else { 110 } else {
107 // If this invalidation did not affect the pile, then it can be cleared as 111 // If this invalidation did not affect the pile, then it can be cleared as
108 // an optimization. 112 // an optimization.
109 pile_invalidation_.Clear(); 113 pile_invalidation_.Clear();
110 } 114 }
111 115
112 return updated; 116 return updated;
113 } 117 }
114 118
115 void PictureLayer::SetIsMask(bool is_mask) { 119 void PictureLayer::SetIsMask(bool is_mask) {
116 is_mask_ = is_mask; 120 is_mask_ = is_mask;
117 } 121 }
118 122
119 bool PictureLayer::SupportsLCDText() const { 123 bool PictureLayer::SupportsLCDText() const {
120 return true; 124 return true;
121 } 125 }
122 126
123 } // namespace cc 127 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698