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" | 8 #include "base/values.h" |
9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
10 #include "ui/gfx/vector2d_f.h" | 10 #include "ui/gfx/vector2d_f.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 TextureDrawQuad::TextureDrawQuad() | 14 TextureDrawQuad::TextureDrawQuad() |
15 : resource_id(0), | 15 : resource_id(0), |
16 premultiplied_alpha(false), | 16 premultiplied_alpha(false), |
17 background_color(SK_ColorTRANSPARENT), | 17 background_color(SK_ColorTRANSPARENT), |
18 flipped(false) { | 18 flipped(false) { |
19 this->vertex_opacity[0] = 0.f; | 19 this->vertex_opacity[0] = 0.f; |
20 this->vertex_opacity[1] = 0.f; | 20 this->vertex_opacity[1] = 0.f; |
21 this->vertex_opacity[2] = 0.f; | 21 this->vertex_opacity[2] = 0.f; |
22 this->vertex_opacity[3] = 0.f; | 22 this->vertex_opacity[3] = 0.f; |
23 } | 23 } |
24 | 24 |
25 scoped_ptr<TextureDrawQuad> TextureDrawQuad::Create() { | |
26 return make_scoped_ptr(new TextureDrawQuad); | |
27 } | |
28 | |
29 void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, | 25 void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
30 const gfx::Rect& rect, | 26 const gfx::Rect& rect, |
31 const gfx::Rect& opaque_rect, | 27 const gfx::Rect& opaque_rect, |
32 const gfx::Rect& visible_rect, | 28 const gfx::Rect& visible_rect, |
33 unsigned resource_id, | 29 unsigned resource_id, |
34 bool premultiplied_alpha, | 30 bool premultiplied_alpha, |
35 const gfx::PointF& uv_top_left, | 31 const gfx::PointF& uv_top_left, |
36 const gfx::PointF& uv_bottom_right, | 32 const gfx::PointF& uv_bottom_right, |
37 SkColor background_color, | 33 SkColor background_color, |
38 const float vertex_opacity[4], | 34 const float vertex_opacity[4], |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 value->Set("uv_bottom_right", MathUtil::AsValue(uv_bottom_right).release()); | 90 value->Set("uv_bottom_right", MathUtil::AsValue(uv_bottom_right).release()); |
95 value->SetInteger("background_color", background_color); | 91 value->SetInteger("background_color", background_color); |
96 scoped_ptr<base::ListValue> vertex_opacity_value(new base::ListValue); | 92 scoped_ptr<base::ListValue> vertex_opacity_value(new base::ListValue); |
97 for (size_t i = 0; i < 4; ++i) | 93 for (size_t i = 0; i < 4; ++i) |
98 vertex_opacity_value->AppendDouble(vertex_opacity[i]); | 94 vertex_opacity_value->AppendDouble(vertex_opacity[i]); |
99 value->Set("vertex_opacity", vertex_opacity_value.release()); | 95 value->Set("vertex_opacity", vertex_opacity_value.release()); |
100 value->SetBoolean("flipped", flipped); | 96 value->SetBoolean("flipped", flipped); |
101 } | 97 } |
102 | 98 |
103 } // namespace cc | 99 } // namespace cc |
OLD | NEW |