Run WebGL conformance tests on Android GPU bot
[chromium-blink-merge.git] / cc / quads / shared_quad_state.cc
blob6a53d9f6a9f8d1a410deacb6ae8fc44d745d28ed
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
3 // found in the LICENSE file.
5 #include "cc/quads/shared_quad_state.h"
7 #include "base/values.h"
8 #include "cc/base/math_util.h"
9 #include "cc/debug/traced_value.h"
11 namespace cc {
13 SharedQuadState::SharedQuadState() : is_clipped(false), opacity(0.f) {}
15 SharedQuadState::~SharedQuadState() {
16 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
17 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"),
18 "cc::SharedQuadState", this);
21 scoped_ptr<SharedQuadState> SharedQuadState::Create() {
22 return make_scoped_ptr(new SharedQuadState);
25 scoped_ptr<SharedQuadState> SharedQuadState::Copy() const {
26 return make_scoped_ptr(new SharedQuadState(*this));
29 void SharedQuadState::SetAll(
30 const gfx::Transform& content_to_target_transform,
31 gfx::Size content_bounds,
32 gfx::Rect visible_content_rect,
33 gfx::Rect clip_rect,
34 bool is_clipped,
35 float opacity) {
36 this->content_to_target_transform = content_to_target_transform;
37 this->content_bounds = content_bounds;
38 this->visible_content_rect = visible_content_rect;
39 this->clip_rect = clip_rect;
40 this->is_clipped = is_clipped;
41 this->opacity = opacity;
44 scoped_ptr<base::Value> SharedQuadState::AsValue() const {
45 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
46 value->Set("transform",
47 MathUtil::AsValue(content_to_target_transform).release());
48 value->Set("layer_content_bounds",
49 MathUtil::AsValue(content_bounds).release());
50 value->Set("layer_visible_content_rect",
51 MathUtil::AsValue(visible_content_rect).release());
52 value->SetBoolean("is_clipped", is_clipped);
53 value->Set("clip_rect", MathUtil::AsValue(clip_rect).release());
54 value->SetDouble("opacity", opacity);
55 TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
56 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"),
57 value.get(), "cc::SharedQuadState", this);
58 return value.PassAs<base::Value>();
61 } // namespace cc