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

Side by Side Diff: cc/layers/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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 is_drawable_(false), 48 is_drawable_(false),
49 hide_layer_and_subtree_(false), 49 hide_layer_and_subtree_(false),
50 masks_to_bounds_(false), 50 masks_to_bounds_(false),
51 contents_opaque_(false), 51 contents_opaque_(false),
52 double_sided_(true), 52 double_sided_(true),
53 preserves_3d_(false), 53 preserves_3d_(false),
54 use_parent_backface_visibility_(false), 54 use_parent_backface_visibility_(false),
55 draw_checkerboard_for_missing_tiles_(false), 55 draw_checkerboard_for_missing_tiles_(false),
56 force_render_surface_(false), 56 force_render_surface_(false),
57 replica_layer_(NULL), 57 replica_layer_(NULL),
58 raster_scale_(0.f) { 58 raster_scale_(0.f),
59 saved_paint_properties_(false) {
59 if (layer_id_ < 0) { 60 if (layer_id_ < 0) {
60 s_next_layer_id = 1; 61 s_next_layer_id = 1;
61 layer_id_ = s_next_layer_id++; 62 layer_id_ = s_next_layer_id++;
62 } 63 }
63 64
64 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); 65 layer_animation_controller_ = LayerAnimationController::Create(layer_id_);
65 layer_animation_controller_->AddValueObserver(this); 66 layer_animation_controller_->AddValueObserver(this);
66 } 67 }
67 68
68 Layer::~Layer() { 69 Layer::~Layer() {
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 main_thread_task_runner->PostTask(FROM_HERE, 723 main_thread_task_runner->PostTask(FROM_HERE,
723 base::Bind(&RunCopyCallbackOnMainThread, 724 base::Bind(&RunCopyCallbackOnMainThread,
724 base::Passed(&request), 725 base::Passed(&request),
725 base::Passed(&result))); 726 base::Passed(&result)));
726 } 727 }
727 728
728 void Layer::PushPropertiesTo(LayerImpl* layer) { 729 void Layer::PushPropertiesTo(LayerImpl* layer) {
729 layer->SetAnchorPoint(anchor_point_); 730 layer->SetAnchorPoint(anchor_point_);
730 layer->SetAnchorPointZ(anchor_point_z_); 731 layer->SetAnchorPointZ(anchor_point_z_);
731 layer->SetBackgroundColor(background_color_); 732 layer->SetBackgroundColor(background_color_);
732 layer->SetBounds(paint_properties_.bounds); 733 layer->SetBounds(saved_paint_properties_ ? paint_properties_.bounds
734 : bounds_);
733 layer->SetContentBounds(content_bounds()); 735 layer->SetContentBounds(content_bounds());
734 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); 736 layer->SetContentsScale(contents_scale_x(), contents_scale_y());
735 layer->SetDebugName(debug_name_); 737 layer->SetDebugName(debug_name_);
736 layer->SetCompositingReasons(compositing_reasons_); 738 layer->SetCompositingReasons(compositing_reasons_);
737 layer->SetDoubleSided(double_sided_); 739 layer->SetDoubleSided(double_sided_);
738 layer->SetDrawCheckerboardForMissingTiles( 740 layer->SetDrawCheckerboardForMissingTiles(
739 draw_checkerboard_for_missing_tiles_); 741 draw_checkerboard_for_missing_tiles_);
740 layer->SetForceRenderSurface(force_render_surface_); 742 layer->SetForceRenderSurface(force_render_surface_);
741 layer->SetDrawsContent(DrawsContent()); 743 layer->SetDrawsContent(DrawsContent());
742 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); 744 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 layer->layer_animation_controller()); 820 layer->layer_animation_controller());
819 821
820 // Reset any state that should be cleared for the next update. 822 // Reset any state that should be cleared for the next update.
821 stacking_order_changed_ = false; 823 stacking_order_changed_ = false;
822 update_rect_ = gfx::RectF(); 824 update_rect_ = gfx::RectF();
823 825
824 // Animating layers require further push properties to clean up the animation. 826 // Animating layers require further push properties to clean up the animation.
825 // crbug.com/259088 827 // crbug.com/259088
826 needs_push_properties_ = layer_animation_controller_->has_any_animation(); 828 needs_push_properties_ = layer_animation_controller_->has_any_animation();
827 num_dependents_need_push_properties_ = 0; 829 num_dependents_need_push_properties_ = 0;
830
831 saved_paint_properties_ = false;
828 } 832 }
829 833
830 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) { 834 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
831 return LayerImpl::Create(tree_impl, layer_id_); 835 return LayerImpl::Create(tree_impl, layer_id_);
832 } 836 }
833 837
834 bool Layer::DrawsContent() const { 838 bool Layer::DrawsContent() const {
835 return is_drawable_; 839 return is_drawable_;
836 } 840 }
837 841
838 void Layer::SavePaintProperties() { 842 void Layer::SavePaintProperties() {
839 // TODO(reveman): Save all layer properties that we depend on not 843 // TODO(reveman): Save all layer properties that we depend on not
840 // changing until PushProperties() has been called. crbug.com/231016 844 // changing until PushProperties() has been called. crbug.com/231016
841 paint_properties_.bounds = bounds_; 845 paint_properties_.bounds = bounds_;
846 saved_paint_properties_ = true;
842 } 847 }
843 848
844 bool Layer::Update(ResourceUpdateQueue* queue, 849 bool Layer::Update(ResourceUpdateQueue* queue,
845 const OcclusionTracker* occlusion) { 850 const OcclusionTracker* occlusion) {
851 DCHECK(saved_paint_properties_);
enne (OOO) 2013/08/02 17:00:48 This seems like something that could be easily ski
danakj 2013/08/02 21:57:28 Done.
846 return false; 852 return false;
847 } 853 }
848 854
849 bool Layer::NeedMoreUpdates() { 855 bool Layer::NeedMoreUpdates() {
850 return false; 856 return false;
851 } 857 }
852 858
853 void Layer::SetDebugName(const std::string& debug_name) { 859 void Layer::SetDebugName(const std::string& debug_name) {
854 debug_name_ = debug_name; 860 debug_name_ = debug_name;
855 SetNeedsCommit(); 861 SetNeedsCommit();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 961
956 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { 962 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const {
957 return layer_tree_host_->rendering_stats_instrumentation(); 963 return layer_tree_host_->rendering_stats_instrumentation();
958 } 964 }
959 965
960 bool Layer::SupportsLCDText() const { 966 bool Layer::SupportsLCDText() const {
961 return false; 967 return false;
962 } 968 }
963 969
964 } // namespace cc 970 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/nine_patch_layer.cc » ('j') | cc/layers/picture_layer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698