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

Side by Side Diff: cc/quads/shared_quad_state.cc

Issue 23455060: mix-blend-mode implementation for accelerated layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moving blend_mode property to SharedQuadState Created 7 years, 2 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/quads/shared_quad_state.h" 5 #include "cc/quads/shared_quad_state.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/debug/traced_value.h" 9 #include "cc/debug/traced_value.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 SharedQuadState::SharedQuadState() : is_clipped(false), opacity(0.f) {} 13 SharedQuadState::SharedQuadState() : is_clipped(false),
14 opacity(0.f),
15 blend_mode(SkXfermode::kSrcOver_Mode) {}
14 16
15 SharedQuadState::~SharedQuadState() { 17 SharedQuadState::~SharedQuadState() {
16 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 18 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
17 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), 19 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"),
18 "cc::SharedQuadState", this); 20 "cc::SharedQuadState", this);
19 } 21 }
20 22
21 scoped_ptr<SharedQuadState> SharedQuadState::Create() { 23 scoped_ptr<SharedQuadState> SharedQuadState::Create() {
22 return make_scoped_ptr(new SharedQuadState); 24 return make_scoped_ptr(new SharedQuadState);
23 } 25 }
24 26
25 scoped_ptr<SharedQuadState> SharedQuadState::Copy() const { 27 scoped_ptr<SharedQuadState> SharedQuadState::Copy() const {
26 return make_scoped_ptr(new SharedQuadState(*this)); 28 return make_scoped_ptr(new SharedQuadState(*this));
27 } 29 }
28 30
29 void SharedQuadState::SetAll( 31 void SharedQuadState::SetAll(
30 const gfx::Transform& content_to_target_transform, 32 const gfx::Transform& content_to_target_transform,
31 gfx::Size content_bounds, 33 gfx::Size content_bounds,
32 gfx::Rect visible_content_rect, 34 gfx::Rect visible_content_rect,
33 gfx::Rect clip_rect, 35 gfx::Rect clip_rect,
34 bool is_clipped, 36 bool is_clipped,
35 float opacity) { 37 float opacity,
38 SkXfermode::Mode blend_mode) {
36 this->content_to_target_transform = content_to_target_transform; 39 this->content_to_target_transform = content_to_target_transform;
37 this->content_bounds = content_bounds; 40 this->content_bounds = content_bounds;
38 this->visible_content_rect = visible_content_rect; 41 this->visible_content_rect = visible_content_rect;
39 this->clip_rect = clip_rect; 42 this->clip_rect = clip_rect;
40 this->is_clipped = is_clipped; 43 this->is_clipped = is_clipped;
41 this->opacity = opacity; 44 this->opacity = opacity;
45 this->blend_mode = blend_mode;
42 } 46 }
43 47
44 scoped_ptr<base::Value> SharedQuadState::AsValue() const { 48 scoped_ptr<base::Value> SharedQuadState::AsValue() const {
45 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); 49 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
46 value->Set("transform", 50 value->Set("transform",
47 MathUtil::AsValue(content_to_target_transform).release()); 51 MathUtil::AsValue(content_to_target_transform).release());
48 value->Set("layer_content_bounds", 52 value->Set("layer_content_bounds",
49 MathUtil::AsValue(content_bounds).release()); 53 MathUtil::AsValue(content_bounds).release());
50 value->Set("layer_visible_content_rect", 54 value->Set("layer_visible_content_rect",
51 MathUtil::AsValue(visible_content_rect).release()); 55 MathUtil::AsValue(visible_content_rect).release());
52 value->SetBoolean("is_clipped", is_clipped); 56 value->SetBoolean("is_clipped", is_clipped);
53 value->Set("clip_rect", MathUtil::AsValue(clip_rect).release()); 57 value->Set("clip_rect", MathUtil::AsValue(clip_rect).release());
54 value->SetDouble("opacity", opacity); 58 value->SetDouble("opacity", opacity);
59 value->SetInteger("blend_mode", blend_mode);
enne (OOO) 2013/09/26 16:25:13 This should probably be a string to make it readab
rosca 2013/09/27 10:39:06 Done.
55 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( 60 TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
56 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), 61 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"),
57 value.get(), "cc::SharedQuadState", this); 62 value.get(), "cc::SharedQuadState", this);
58 return value.PassAs<base::Value>(); 63 return value.PassAs<base::Value>();
59 } 64 }
60 65
61 } // namespace cc 66 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698