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

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: unittests fixed Created 7 years 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
« no previous file with comments | « cc/quads/shared_quad_state.h ('k') | cc/test/data/blending_and_filter.png » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
14 : is_clipped(false), opacity(0.f), blend_mode(SkXfermode::kSrcOver_Mode) {}
14 15
15 SharedQuadState::~SharedQuadState() { 16 SharedQuadState::~SharedQuadState() {
16 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 17 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
17 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), 18 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"),
18 "cc::SharedQuadState", this); 19 "cc::SharedQuadState", this);
19 } 20 }
20 21
21 scoped_ptr<SharedQuadState> SharedQuadState::Create() { 22 scoped_ptr<SharedQuadState> SharedQuadState::Create() {
22 return make_scoped_ptr(new SharedQuadState); 23 return make_scoped_ptr(new SharedQuadState);
23 } 24 }
24 25
25 scoped_ptr<SharedQuadState> SharedQuadState::Copy() const { 26 scoped_ptr<SharedQuadState> SharedQuadState::Copy() const {
26 return make_scoped_ptr(new SharedQuadState(*this)); 27 return make_scoped_ptr(new SharedQuadState(*this));
27 } 28 }
28 29
29 void SharedQuadState::SetAll( 30 void SharedQuadState::SetAll(const gfx::Transform& content_to_target_transform,
30 const gfx::Transform& content_to_target_transform, 31 gfx::Size content_bounds,
31 gfx::Size content_bounds, 32 gfx::Rect visible_content_rect,
32 gfx::Rect visible_content_rect, 33 gfx::Rect clip_rect,
33 gfx::Rect clip_rect, 34 bool is_clipped,
34 bool is_clipped, 35 float opacity,
35 float opacity) { 36 SkXfermode::Mode blend_mode) {
36 this->content_to_target_transform = content_to_target_transform; 37 this->content_to_target_transform = content_to_target_transform;
37 this->content_bounds = content_bounds; 38 this->content_bounds = content_bounds;
38 this->visible_content_rect = visible_content_rect; 39 this->visible_content_rect = visible_content_rect;
39 this->clip_rect = clip_rect; 40 this->clip_rect = clip_rect;
40 this->is_clipped = is_clipped; 41 this->is_clipped = is_clipped;
41 this->opacity = opacity; 42 this->opacity = opacity;
43 this->blend_mode = blend_mode;
42 } 44 }
43 45
44 scoped_ptr<base::Value> SharedQuadState::AsValue() const { 46 scoped_ptr<base::Value> SharedQuadState::AsValue() const {
45 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); 47 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
46 value->Set("transform", 48 value->Set("transform",
47 MathUtil::AsValue(content_to_target_transform).release()); 49 MathUtil::AsValue(content_to_target_transform).release());
48 value->Set("layer_content_bounds", 50 value->Set("layer_content_bounds",
49 MathUtil::AsValue(content_bounds).release()); 51 MathUtil::AsValue(content_bounds).release());
50 value->Set("layer_visible_content_rect", 52 value->Set("layer_visible_content_rect",
51 MathUtil::AsValue(visible_content_rect).release()); 53 MathUtil::AsValue(visible_content_rect).release());
52 value->SetBoolean("is_clipped", is_clipped); 54 value->SetBoolean("is_clipped", is_clipped);
53 value->Set("clip_rect", MathUtil::AsValue(clip_rect).release()); 55 value->Set("clip_rect", MathUtil::AsValue(clip_rect).release());
54 value->SetDouble("opacity", opacity); 56 value->SetDouble("opacity", opacity);
57 value->SetString("blend_mode", SkXfermode::ModeName(blend_mode));
55 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( 58 TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
56 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), 59 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"),
57 value.get(), "cc::SharedQuadState", this); 60 value.get(), "cc::SharedQuadState", this);
58 return value.PassAs<base::Value>(); 61 return value.PassAs<base::Value>();
59 } 62 }
60 63
61 } // namespace cc 64 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/shared_quad_state.h ('k') | cc/test/data/blending_and_filter.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698