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

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

Issue 913133004: cc: Make PaintedScrollbarLayer not use ContentsScalingLayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: danakj review Created 5 years, 10 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
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_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 render_pass, bounds(), shared_quad_state, append_quads_data); 172 render_pass, bounds(), shared_quad_state, append_quads_data);
173 173
174 SolidColorLayerImpl::AppendSolidQuads( 174 SolidColorLayerImpl::AppendSolidQuads(
175 render_pass, occlusion_in_content_space, shared_quad_state, 175 render_pass, occlusion_in_content_space, shared_quad_state,
176 visible_content_rect(), raster_source_->GetSolidColor(), 176 visible_content_rect(), raster_source_->GetSolidColor(),
177 append_quads_data); 177 append_quads_data);
178 return; 178 return;
179 } 179 }
180 180
181 float max_contents_scale = MaximumTilingContentsScale(); 181 float max_contents_scale = MaximumTilingContentsScale();
182 gfx::Transform scaled_draw_transform = draw_transform(); 182 PopulateScaledSharedQuadState(shared_quad_state, max_contents_scale);
183 scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale,
184 SK_MScalar1 / max_contents_scale);
185 gfx::Size scaled_content_bounds =
186 gfx::ToCeiledSize(gfx::ScaleSize(bounds(), max_contents_scale));
187 gfx::Rect scaled_visible_content_rect =
188 gfx::ScaleToEnclosingRect(visible_content_rect(), max_contents_scale);
189 scaled_visible_content_rect.Intersect(gfx::Rect(scaled_content_bounds));
190 Occlusion scaled_occlusion = 183 Occlusion scaled_occlusion =
191 occlusion_in_content_space.GetOcclusionWithGivenDrawTransform( 184 occlusion_in_content_space.GetOcclusionWithGivenDrawTransform(
192 scaled_draw_transform); 185 shared_quad_state->content_to_target_transform);
193
194 shared_quad_state->SetAll(
195 scaled_draw_transform, scaled_content_bounds, scaled_visible_content_rect,
196 draw_properties().clip_rect, draw_properties().is_clipped,
197 draw_properties().opacity, draw_properties().blend_mode,
198 sorting_context_id_);
199 186
200 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) { 187 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) {
201 AppendDebugBorderQuad( 188 AppendDebugBorderQuad(
202 render_pass, 189 render_pass, shared_quad_state->content_bounds, shared_quad_state,
203 scaled_content_bounds, 190 append_quads_data, DebugColors::DirectPictureBorderColor(),
204 shared_quad_state,
205 append_quads_data,
206 DebugColors::DirectPictureBorderColor(),
207 DebugColors::DirectPictureBorderWidth(layer_tree_impl())); 191 DebugColors::DirectPictureBorderWidth(layer_tree_impl()));
208 192
209 gfx::Rect geometry_rect = scaled_visible_content_rect; 193 gfx::Rect geometry_rect = shared_quad_state->visible_content_rect;
210 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); 194 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect();
211 gfx::Rect visible_geometry_rect = 195 gfx::Rect visible_geometry_rect =
212 scaled_occlusion.GetUnoccludedContentRect(geometry_rect); 196 scaled_occlusion.GetUnoccludedContentRect(geometry_rect);
213 if (visible_geometry_rect.IsEmpty()) 197 if (visible_geometry_rect.IsEmpty())
214 return; 198 return;
215 199
216 gfx::Size texture_size = scaled_visible_content_rect.size(); 200 gfx::Rect quad_content_rect = shared_quad_state->visible_content_rect;
201 gfx::Size texture_size = quad_content_rect.size();
217 gfx::RectF texture_rect = gfx::RectF(texture_size); 202 gfx::RectF texture_rect = gfx::RectF(texture_size);
218 gfx::Rect quad_content_rect = scaled_visible_content_rect;
219 203
220 PictureDrawQuad* quad = 204 PictureDrawQuad* quad =
221 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>(); 205 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>();
222 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect, 206 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect,
223 visible_geometry_rect, texture_rect, texture_size, 207 visible_geometry_rect, texture_rect, texture_size,
224 nearest_neighbor_, RGBA_8888, quad_content_rect, 208 nearest_neighbor_, RGBA_8888, quad_content_rect,
225 max_contents_scale, raster_source_); 209 max_contents_scale, raster_source_);
226 return; 210 return;
227 } 211 }
228 212
229 AppendDebugBorderQuad( 213 AppendDebugBorderQuad(render_pass, shared_quad_state->content_bounds,
230 render_pass, scaled_content_bounds, shared_quad_state, append_quads_data); 214 shared_quad_state, append_quads_data);
231 215
232 if (ShowDebugBorders()) { 216 if (ShowDebugBorders()) {
233 for (PictureLayerTilingSet::CoverageIterator iter( 217 for (PictureLayerTilingSet::CoverageIterator iter(
234 tilings_.get(), 218 tilings_.get(), max_contents_scale,
235 max_contents_scale, 219 shared_quad_state->visible_content_rect, ideal_contents_scale_);
236 scaled_visible_content_rect, 220 iter; ++iter) {
237 ideal_contents_scale_);
238 iter;
239 ++iter) {
240 SkColor color; 221 SkColor color;
241 float width; 222 float width;
242 if (*iter && iter->IsReadyToDraw()) { 223 if (*iter && iter->IsReadyToDraw()) {
243 TileDrawInfo::Mode mode = iter->draw_info().mode(); 224 TileDrawInfo::Mode mode = iter->draw_info().mode();
244 if (mode == TileDrawInfo::SOLID_COLOR_MODE) { 225 if (mode == TileDrawInfo::SOLID_COLOR_MODE) {
245 color = DebugColors::SolidColorTileBorderColor(); 226 color = DebugColors::SolidColorTileBorderColor();
246 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); 227 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl());
247 } else if (mode == TileDrawInfo::PICTURE_PILE_MODE) { 228 } else if (mode == TileDrawInfo::PICTURE_PILE_MODE) {
248 color = DebugColors::PictureTileBorderColor(); 229 color = DebugColors::PictureTileBorderColor();
249 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); 230 width = DebugColors::PictureTileBorderWidth(layer_tree_impl());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 264
284 // Ignore missing tiles outside of viewport for tile priority. This is 265 // Ignore missing tiles outside of viewport for tile priority. This is
285 // normally the same as draw viewport but can be independently overridden by 266 // normally the same as draw viewport but can be independently overridden by
286 // embedders like Android WebView with SetExternalDrawConstraints. 267 // embedders like Android WebView with SetExternalDrawConstraints.
287 gfx::Rect scaled_viewport_for_tile_priority = gfx::ScaleToEnclosingRect( 268 gfx::Rect scaled_viewport_for_tile_priority = gfx::ScaleToEnclosingRect(
288 viewport_rect_for_tile_priority_in_content_space_, max_contents_scale); 269 viewport_rect_for_tile_priority_in_content_space_, max_contents_scale);
289 270
290 size_t missing_tile_count = 0u; 271 size_t missing_tile_count = 0u;
291 size_t on_demand_missing_tile_count = 0u; 272 size_t on_demand_missing_tile_count = 0u;
292 only_used_low_res_last_append_quads_ = true; 273 only_used_low_res_last_append_quads_ = true;
293 for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(), 274 for (PictureLayerTilingSet::CoverageIterator iter(
294 max_contents_scale, 275 tilings_.get(), max_contents_scale,
295 scaled_visible_content_rect, 276 shared_quad_state->visible_content_rect, ideal_contents_scale_);
296 ideal_contents_scale_); 277 iter; ++iter) {
297 iter;
298 ++iter) {
299 gfx::Rect geometry_rect = iter.geometry_rect(); 278 gfx::Rect geometry_rect = iter.geometry_rect();
300 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); 279 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect();
301 gfx::Rect visible_geometry_rect = 280 gfx::Rect visible_geometry_rect =
302 scaled_occlusion.GetUnoccludedContentRect(geometry_rect); 281 scaled_occlusion.GetUnoccludedContentRect(geometry_rect);
303 if (visible_geometry_rect.IsEmpty()) 282 if (visible_geometry_rect.IsEmpty())
304 continue; 283 continue;
305 284
306 append_quads_data->visible_content_area += 285 append_quads_data->visible_content_area +=
307 visible_geometry_rect.width() * visible_geometry_rect.height(); 286 visible_geometry_rect.width() * visible_geometry_rect.height();
308 287
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 1212
1234 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { 1213 bool PictureLayerImpl::IsOnActiveOrPendingTree() const {
1235 return !layer_tree_impl()->IsRecycleTree(); 1214 return !layer_tree_impl()->IsRecycleTree();
1236 } 1215 }
1237 1216
1238 bool PictureLayerImpl::HasValidTilePriorities() const { 1217 bool PictureLayerImpl::HasValidTilePriorities() const {
1239 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); 1218 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember();
1240 } 1219 }
1241 1220
1242 } // namespace cc 1221 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698