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

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

Issue 1096703006: cc: Some more cleanup and removing TODOs for validating resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); 284 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_);
285 current_draw_mode_ = draw_mode; 285 current_draw_mode_ = draw_mode;
286 return true; 286 return true;
287 } 287 }
288 288
289 void LayerImpl::DidDraw(ResourceProvider* resource_provider) { 289 void LayerImpl::DidDraw(ResourceProvider* resource_provider) {
290 DCHECK_NE(DRAW_MODE_NONE, current_draw_mode_); 290 DCHECK_NE(DRAW_MODE_NONE, current_draw_mode_);
291 current_draw_mode_ = DRAW_MODE_NONE; 291 current_draw_mode_ = DRAW_MODE_NONE;
292 } 292 }
293 293
294 #if DCHECK_IS_ON()
295 // Verify that the resource id is valid.
296 static ResourceProvider::ResourceId ValidateResource(
297 const ResourceProvider* provider,
298 ResourceProvider::ResourceId id) {
299 provider->ValidateResource(id);
300 return id;
301 }
302 #endif
303
304 void LayerImpl::ValidateQuadResources(const DrawQuad* quad) const {
piman 2015/04/23 22:55:10 nit: do you think we could inline this? That way i
danakj 2015/04/23 22:58:06 Ya I can do this. I wanna keep the Bind call in th
305 #if DCHECK_IS_ON()
306 output_quad->IterateResources(
307 base::Bind(&ValidateResource, layer_tree_impl_->resource_provider()));
308 #endif
309 }
310
294 bool LayerImpl::ShowDebugBorders() const { 311 bool LayerImpl::ShowDebugBorders() const {
295 return layer_tree_impl()->debug_state().show_debug_borders; 312 return layer_tree_impl()->debug_state().show_debug_borders;
296 } 313 }
297 314
298 void LayerImpl::GetDebugBorderProperties(SkColor* color, float* width) const { 315 void LayerImpl::GetDebugBorderProperties(SkColor* color, float* width) const {
299 if (draws_content_) { 316 if (draws_content_) {
300 *color = DebugColors::ContentLayerBorderColor(); 317 *color = DebugColors::ContentLayerBorderColor();
301 *width = DebugColors::ContentLayerBorderWidth(layer_tree_impl()); 318 *width = DebugColors::ContentLayerBorderWidth(layer_tree_impl());
302 return; 319 return;
303 } 320 }
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 gfx::Transform scaled_draw_transform = 1635 gfx::Transform scaled_draw_transform =
1619 draw_properties_.target_space_transform; 1636 draw_properties_.target_space_transform;
1620 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); 1637 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale);
1621 gfx::Size scaled_content_bounds = 1638 gfx::Size scaled_content_bounds =
1622 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); 1639 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale));
1623 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, 1640 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform,
1624 gfx::Rect(scaled_content_bounds)); 1641 gfx::Rect(scaled_content_bounds));
1625 } 1642 }
1626 1643
1627 } // namespace cc 1644 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698