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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" |
| 9 #include "cc/base/math_util.h" |
8 #include "ui/gfx/vector2d_f.h" | 10 #include "ui/gfx/vector2d_f.h" |
9 | 11 |
10 namespace cc { | 12 namespace cc { |
11 | 13 |
12 TextureDrawQuad::TextureDrawQuad() | 14 TextureDrawQuad::TextureDrawQuad() |
13 : resource_id(0), | 15 : resource_id(0), |
14 premultiplied_alpha(false), | 16 premultiplied_alpha(false), |
15 background_color(SK_ColorTRANSPARENT), | 17 background_color(SK_ColorTRANSPARENT), |
16 flipped(false) { | 18 flipped(false) { |
17 this->vertex_opacity[0] = 0.f; | 19 this->vertex_opacity[0] = 0.f; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Move the clipped rectangle back into its space. | 151 // Move the clipped rectangle back into its space. |
150 clipped_rect -= offset; | 152 clipped_rect -= offset; |
151 clipped_rect.Scale(1.0f / x_scale, 1.0f / y_scale); | 153 clipped_rect.Scale(1.0f / x_scale, 1.0f / y_scale); |
152 rect = gfx::Rect(static_cast<int>(clipped_rect.x() + 0.5f), | 154 rect = gfx::Rect(static_cast<int>(clipped_rect.x() + 0.5f), |
153 static_cast<int>(clipped_rect.y() + 0.5f), | 155 static_cast<int>(clipped_rect.y() + 0.5f), |
154 static_cast<int>(clipped_rect.width() + 0.5f), | 156 static_cast<int>(clipped_rect.width() + 0.5f), |
155 static_cast<int>(clipped_rect.height() + 0.5f)); | 157 static_cast<int>(clipped_rect.height() + 0.5f)); |
156 return true; | 158 return true; |
157 } | 159 } |
158 | 160 |
| 161 void TextureDrawQuad::ExtendValue(base::DictionaryValue* value) const { |
| 162 value->SetInteger("resource_id", resource_id); |
| 163 value->SetBoolean("premultiplied_alpha", premultiplied_alpha); |
| 164 value->Set("uv_top_left", MathUtil::AsValue(uv_top_left).release()); |
| 165 value->Set("uv_bottom_right", MathUtil::AsValue(uv_bottom_right).release()); |
| 166 value->SetInteger("background_color", background_color); |
| 167 scoped_ptr<ListValue> vertex_opacity_value(new ListValue); |
| 168 for (size_t i = 0; i < 4; ++i) |
| 169 vertex_opacity_value->AppendDouble(vertex_opacity[i]); |
| 170 value->Set("vertex_opacity", vertex_opacity_value.release()); |
| 171 value->SetBoolean("flipped", flipped); |
| 172 } |
| 173 |
159 } // namespace cc | 174 } // namespace cc |
OLD | NEW |