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

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: Call SavePaintProps when needed in tests 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
« no previous file with comments | « cc/layers/paint_properties.h ('k') | cc/layers/scrollbar_layer.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 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 bool updated = Layer::Update(queue, occlusion);
83
82 pile_->Resize(paint_properties().bounds); 84 pile_->Resize(paint_properties().bounds);
83 85
84 // Calling paint in WebKit can sometimes cause invalidations, so save 86 // Calling paint in WebKit can sometimes cause invalidations, so save
85 // off the invalidation prior to calling update. 87 // off the invalidation prior to calling update.
86 pending_invalidation_.Swap(&pile_invalidation_); 88 pending_invalidation_.Swap(&pile_invalidation_);
87 pending_invalidation_.Clear(); 89 pending_invalidation_.Clear();
88 90
89 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( 91 gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect(
90 visible_content_rect(), 1.f / contents_scale_x()); 92 visible_content_rect(), 1.f / contents_scale_x());
91 if (layer_tree_host()->settings().using_synchronous_renderer_compositor) { 93 if (layer_tree_host()->settings().using_synchronous_renderer_compositor) {
92 // Workaround for http://crbug.com/235910 - to retain backwards compat 94 // Workaround for http://crbug.com/235910 - to retain backwards compat
93 // the full page content must always be provided in the picture layer. 95 // the full page content must always be provided in the picture layer.
94 visible_layer_rect = gfx::Rect(bounds()); 96 visible_layer_rect = gfx::Rect(bounds());
95 } 97 }
96 devtools_instrumentation::ScopedLayerTask paint_layer( 98 devtools_instrumentation::ScopedLayerTask paint_layer(
97 devtools_instrumentation::kPaintLayer, id()); 99 devtools_instrumentation::kPaintLayer, id());
98 bool updated = pile_->Update(client_, 100 updated |= pile_->Update(client_,
99 SafeOpaqueBackgroundColor(), 101 SafeOpaqueBackgroundColor(),
100 contents_opaque(), 102 contents_opaque(),
101 pile_invalidation_, 103 pile_invalidation_,
102 visible_layer_rect, 104 visible_layer_rect,
103 rendering_stats_instrumentation()); 105 rendering_stats_instrumentation());
104 if (updated) { 106 if (updated) {
105 SetNeedsPushProperties(); 107 SetNeedsPushProperties();
106 } else { 108 } else {
107 // If this invalidation did not affect the pile, then it can be cleared as 109 // If this invalidation did not affect the pile, then it can be cleared as
108 // an optimization. 110 // an optimization.
109 pile_invalidation_.Clear(); 111 pile_invalidation_.Clear();
110 } 112 }
111 113
112 return updated; 114 return updated;
113 } 115 }
114 116
115 void PictureLayer::SetIsMask(bool is_mask) { 117 void PictureLayer::SetIsMask(bool is_mask) {
116 is_mask_ = is_mask; 118 is_mask_ = is_mask;
117 } 119 }
118 120
119 bool PictureLayer::SupportsLCDText() const { 121 bool PictureLayer::SupportsLCDText() const {
120 return true; 122 return true;
121 } 123 }
122 124
123 } // namespace cc 125 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/paint_properties.h ('k') | cc/layers/scrollbar_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698