| OLD | NEW |
| 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/quads/shared_quad_state.h" | 5 #include "cc/quads/shared_quad_state.h" |
| 6 | 6 |
| 7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
| 8 #include "base/trace_event/trace_event_argument.h" | 8 #include "base/trace_event/trace_event_argument.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| 11 #include "cc/debug/traced_value.h" | 11 #include "cc/debug/traced_value.h" |
| 12 #include "third_party/skia/include/core/SkBlendMode.h" |
| 12 | 13 |
| 13 namespace cc { | 14 namespace cc { |
| 14 | 15 |
| 15 SharedQuadState::SharedQuadState() | 16 SharedQuadState::SharedQuadState() |
| 16 : is_clipped(false), | 17 : is_clipped(false), |
| 17 opacity(0.f), | 18 opacity(0.f), |
| 18 blend_mode(SkXfermode::kSrcOver_Mode), | 19 blend_mode(SkBlendMode::kSrcOver), |
| 19 sorting_context_id(0) { | 20 sorting_context_id(0) {} |
| 20 } | |
| 21 | 21 |
| 22 SharedQuadState::SharedQuadState(const SharedQuadState& other) = default; | 22 SharedQuadState::SharedQuadState(const SharedQuadState& other) = default; |
| 23 | 23 |
| 24 SharedQuadState::~SharedQuadState() { | 24 SharedQuadState::~SharedQuadState() { |
| 25 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 25 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 26 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), | 26 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), |
| 27 "cc::SharedQuadState", this); | 27 "cc::SharedQuadState", this); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void SharedQuadState::SetAll(const gfx::Transform& quad_to_target_transform, | 30 void SharedQuadState::SetAll(const gfx::Transform& quad_to_target_transform, |
| 31 const gfx::Size& quad_layer_bounds, | 31 const gfx::Size& quad_layer_bounds, |
| 32 const gfx::Rect& visible_quad_layer_rect, | 32 const gfx::Rect& visible_quad_layer_rect, |
| 33 const gfx::Rect& clip_rect, | 33 const gfx::Rect& clip_rect, |
| 34 bool is_clipped, | 34 bool is_clipped, |
| 35 float opacity, | 35 float opacity, |
| 36 SkXfermode::Mode blend_mode, | 36 SkBlendMode blend_mode, |
| 37 int sorting_context_id) { | 37 int sorting_context_id) { |
| 38 this->quad_to_target_transform = quad_to_target_transform; | 38 this->quad_to_target_transform = quad_to_target_transform; |
| 39 this->quad_layer_bounds = quad_layer_bounds; | 39 this->quad_layer_bounds = quad_layer_bounds; |
| 40 this->visible_quad_layer_rect = visible_quad_layer_rect; | 40 this->visible_quad_layer_rect = visible_quad_layer_rect; |
| 41 this->clip_rect = clip_rect; | 41 this->clip_rect = clip_rect; |
| 42 this->is_clipped = is_clipped; | 42 this->is_clipped = is_clipped; |
| 43 this->opacity = opacity; | 43 this->opacity = opacity; |
| 44 this->blend_mode = blend_mode; | 44 this->blend_mode = blend_mode; |
| 45 this->sorting_context_id = sorting_context_id; | 45 this->sorting_context_id = sorting_context_id; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void SharedQuadState::AsValueInto(base::trace_event::TracedValue* value) const { | 48 void SharedQuadState::AsValueInto(base::trace_event::TracedValue* value) const { |
| 49 MathUtil::AddToTracedValue("transform", quad_to_target_transform, value); | 49 MathUtil::AddToTracedValue("transform", quad_to_target_transform, value); |
| 50 MathUtil::AddToTracedValue("layer_content_bounds", quad_layer_bounds, value); | 50 MathUtil::AddToTracedValue("layer_content_bounds", quad_layer_bounds, value); |
| 51 MathUtil::AddToTracedValue("layer_visible_content_rect", | 51 MathUtil::AddToTracedValue("layer_visible_content_rect", |
| 52 visible_quad_layer_rect, value); | 52 visible_quad_layer_rect, value); |
| 53 | 53 |
| 54 value->SetBoolean("is_clipped", is_clipped); | 54 value->SetBoolean("is_clipped", is_clipped); |
| 55 | 55 |
| 56 MathUtil::AddToTracedValue("clip_rect", clip_rect, value); | 56 MathUtil::AddToTracedValue("clip_rect", clip_rect, value); |
| 57 | 57 |
| 58 value->SetDouble("opacity", opacity); | 58 value->SetDouble("opacity", opacity); |
| 59 value->SetString("blend_mode", SkXfermode::ModeName(blend_mode)); | 59 value->SetString("blend_mode", SkBlendMode_Name(blend_mode)); |
| 60 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 60 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
| 61 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), | 61 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), |
| 62 value, | 62 value, |
| 63 "cc::SharedQuadState", | 63 "cc::SharedQuadState", |
| 64 this); | 64 this); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace cc | 67 } // namespace cc |
| OLD | NEW |