| OLD | NEW |
| 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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 hide_layer_and_subtree_(false), | 50 hide_layer_and_subtree_(false), |
| 51 masks_to_bounds_(false), | 51 masks_to_bounds_(false), |
| 52 contents_opaque_(false), | 52 contents_opaque_(false), |
| 53 double_sided_(true), | 53 double_sided_(true), |
| 54 preserves_3d_(false), | 54 preserves_3d_(false), |
| 55 use_parent_backface_visibility_(false), | 55 use_parent_backface_visibility_(false), |
| 56 draw_checkerboard_for_missing_tiles_(false), | 56 draw_checkerboard_for_missing_tiles_(false), |
| 57 force_render_surface_(false), | 57 force_render_surface_(false), |
| 58 anchor_point_(0.5f, 0.5f), | 58 anchor_point_(0.5f, 0.5f), |
| 59 background_color_(0), | 59 background_color_(0), |
| 60 compositing_reasons_(kCompositingReasonUnknown), | |
| 61 opacity_(1.f), | 60 opacity_(1.f), |
| 62 blend_mode_(SkXfermode::kSrcOver_Mode), | 61 blend_mode_(SkXfermode::kSrcOver_Mode), |
| 63 anchor_point_z_(0.f), | 62 anchor_point_z_(0.f), |
| 64 scroll_parent_(NULL), | 63 scroll_parent_(NULL), |
| 65 clip_parent_(NULL), | 64 clip_parent_(NULL), |
| 66 replica_layer_(NULL), | 65 replica_layer_(NULL), |
| 67 raster_scale_(0.f), | 66 raster_scale_(0.f), |
| 68 client_(NULL) { | 67 client_(NULL) { |
| 69 if (layer_id_ < 0) { | 68 if (layer_id_ < 0) { |
| 70 s_next_layer_id = 1; | 69 s_next_layer_id = 1; |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 bool is_tracing; | 875 bool is_tracing; |
| 877 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 876 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 878 &is_tracing); | 877 &is_tracing); |
| 879 if (is_tracing) { | 878 if (is_tracing) { |
| 880 layer->SetDebugName(DebugName()); | 879 layer->SetDebugName(DebugName()); |
| 881 layer->SetDebugInfo(TakeDebugInfo()); | 880 layer->SetDebugInfo(TakeDebugInfo()); |
| 882 } else { | 881 } else { |
| 883 layer->SetDebugName(std::string()); | 882 layer->SetDebugName(std::string()); |
| 884 } | 883 } |
| 885 | 884 |
| 886 layer->SetCompositingReasons(compositing_reasons_); | |
| 887 layer->SetDoubleSided(double_sided_); | 885 layer->SetDoubleSided(double_sided_); |
| 888 layer->SetDrawCheckerboardForMissingTiles( | 886 layer->SetDrawCheckerboardForMissingTiles( |
| 889 draw_checkerboard_for_missing_tiles_); | 887 draw_checkerboard_for_missing_tiles_); |
| 890 layer->SetForceRenderSurface(force_render_surface_); | 888 layer->SetForceRenderSurface(force_render_surface_); |
| 891 layer->SetDrawsContent(DrawsContent()); | 889 layer->SetDrawsContent(DrawsContent()); |
| 892 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 890 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
| 893 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) | 891 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) |
| 894 layer->SetFilters(filters_); | 892 layer->SetFilters(filters_); |
| 895 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); | 893 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); |
| 896 layer->SetBackgroundFilters(background_filters()); | 894 layer->SetBackgroundFilters(background_filters()); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 return client_ ? client_->DebugName() : std::string(); | 1037 return client_ ? client_->DebugName() : std::string(); |
| 1040 } | 1038 } |
| 1041 | 1039 |
| 1042 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() { | 1040 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() { |
| 1043 if (client_) | 1041 if (client_) |
| 1044 return client_->TakeDebugInfo(); | 1042 return client_->TakeDebugInfo(); |
| 1045 else | 1043 else |
| 1046 return NULL; | 1044 return NULL; |
| 1047 } | 1045 } |
| 1048 | 1046 |
| 1049 | |
| 1050 void Layer::SetCompositingReasons(CompositingReasons reasons) { | |
| 1051 compositing_reasons_ = reasons; | |
| 1052 } | |
| 1053 | |
| 1054 void Layer::CreateRenderSurface() { | 1047 void Layer::CreateRenderSurface() { |
| 1055 DCHECK(!draw_properties_.render_surface); | 1048 DCHECK(!draw_properties_.render_surface); |
| 1056 draw_properties_.render_surface = make_scoped_ptr(new RenderSurface(this)); | 1049 draw_properties_.render_surface = make_scoped_ptr(new RenderSurface(this)); |
| 1057 draw_properties_.render_target = this; | 1050 draw_properties_.render_target = this; |
| 1058 } | 1051 } |
| 1059 | 1052 |
| 1060 void Layer::ClearRenderSurface() { | 1053 void Layer::ClearRenderSurface() { |
| 1061 draw_properties_.render_surface.reset(); | 1054 draw_properties_.render_surface.reset(); |
| 1062 } | 1055 } |
| 1063 | 1056 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1181 clip_parent_->RemoveClipChild(this); | 1174 clip_parent_->RemoveClipChild(this); |
| 1182 | 1175 |
| 1183 clip_parent_ = NULL; | 1176 clip_parent_ = NULL; |
| 1184 } | 1177 } |
| 1185 | 1178 |
| 1186 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1179 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 1187 benchmark->RunOnLayer(this); | 1180 benchmark->RunOnLayer(this); |
| 1188 } | 1181 } |
| 1189 | 1182 |
| 1190 } // namespace cc | 1183 } // namespace cc |
| OLD | NEW |