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/texture_draw_quad.h" | 5 #include "cc/quads/texture_draw_quad.h" |
6 | 6 |
7 #include "base/debug/trace_event_argument.h" | |
8 #include "base/logging.h" | 7 #include "base/logging.h" |
9 #include "base/values.h" | 8 #include "base/values.h" |
10 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
11 #include "ui/gfx/vector2d_f.h" | 10 #include "ui/gfx/vector2d_f.h" |
12 | 11 |
13 namespace cc { | 12 namespace cc { |
14 | 13 |
15 TextureDrawQuad::TextureDrawQuad() | 14 TextureDrawQuad::TextureDrawQuad() |
16 : resource_id(0), | 15 : resource_id(0), |
17 premultiplied_alpha(false), | 16 premultiplied_alpha(false), |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void TextureDrawQuad::IterateResources( | 76 void TextureDrawQuad::IterateResources( |
78 const ResourceIteratorCallback& callback) { | 77 const ResourceIteratorCallback& callback) { |
79 resource_id = callback.Run(resource_id); | 78 resource_id = callback.Run(resource_id); |
80 } | 79 } |
81 | 80 |
82 const TextureDrawQuad* TextureDrawQuad::MaterialCast(const DrawQuad* quad) { | 81 const TextureDrawQuad* TextureDrawQuad::MaterialCast(const DrawQuad* quad) { |
83 DCHECK(quad->material == DrawQuad::TEXTURE_CONTENT); | 82 DCHECK(quad->material == DrawQuad::TEXTURE_CONTENT); |
84 return static_cast<const TextureDrawQuad*>(quad); | 83 return static_cast<const TextureDrawQuad*>(quad); |
85 } | 84 } |
86 | 85 |
87 void TextureDrawQuad::ExtendValue(base::debug::TracedValue* value) const { | 86 void TextureDrawQuad::ExtendValue(base::DictionaryValue* value) const { |
88 value->SetInteger("resource_id", resource_id); | 87 value->SetInteger("resource_id", resource_id); |
89 value->SetBoolean("premultiplied_alpha", premultiplied_alpha); | 88 value->SetBoolean("premultiplied_alpha", premultiplied_alpha); |
90 value->BeginArray("uv_top_left"); | 89 value->Set("uv_top_left", MathUtil::AsValue(uv_top_left).release()); |
91 MathUtil::AddToTracedValue(uv_top_left, value); | 90 value->Set("uv_bottom_right", MathUtil::AsValue(uv_bottom_right).release()); |
92 value->EndArray(); | |
93 | |
94 value->BeginArray("uv_bottom_right"); | |
95 MathUtil::AddToTracedValue(uv_bottom_right, value); | |
96 value->EndArray(); | |
97 | |
98 value->SetInteger("background_color", background_color); | 91 value->SetInteger("background_color", background_color); |
99 | 92 scoped_ptr<base::ListValue> vertex_opacity_value(new base::ListValue); |
100 value->BeginArray("vertex_opacity"); | |
101 for (size_t i = 0; i < 4; ++i) | 93 for (size_t i = 0; i < 4; ++i) |
102 value->AppendDouble(vertex_opacity[i]); | 94 vertex_opacity_value->AppendDouble(vertex_opacity[i]); |
103 value->EndArray(); | 95 value->Set("vertex_opacity", vertex_opacity_value.release()); |
104 | |
105 value->SetBoolean("flipped", flipped); | 96 value->SetBoolean("flipped", flipped); |
106 } | 97 } |
107 | 98 |
108 } // namespace cc | 99 } // namespace cc |
OLD | NEW |