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/draw_quad.h" | 5 #include "cc/quads/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" | |
10 #include "cc/debug/traced_value.h" | |
8 #include "cc/quads/checkerboard_draw_quad.h" | 11 #include "cc/quads/checkerboard_draw_quad.h" |
9 #include "cc/quads/debug_border_draw_quad.h" | 12 #include "cc/quads/debug_border_draw_quad.h" |
10 #include "cc/quads/io_surface_draw_quad.h" | 13 #include "cc/quads/io_surface_draw_quad.h" |
11 #include "cc/quads/picture_draw_quad.h" | 14 #include "cc/quads/picture_draw_quad.h" |
12 #include "cc/quads/render_pass_draw_quad.h" | 15 #include "cc/quads/render_pass_draw_quad.h" |
13 #include "cc/quads/solid_color_draw_quad.h" | 16 #include "cc/quads/solid_color_draw_quad.h" |
14 #include "cc/quads/stream_video_draw_quad.h" | 17 #include "cc/quads/stream_video_draw_quad.h" |
15 #include "cc/quads/texture_draw_quad.h" | 18 #include "cc/quads/texture_draw_quad.h" |
16 #include "cc/quads/tile_draw_quad.h" | 19 #include "cc/quads/tile_draw_quad.h" |
17 #include "cc/quads/yuv_video_draw_quad.h" | 20 #include "cc/quads/yuv_video_draw_quad.h" |
21 #include "ui/gfx/quad_f.h" | |
18 | 22 |
19 namespace { | 23 namespace { |
20 template<typename T> T* TypedCopy(const cc::DrawQuad* other) { | 24 template<typename T> T* TypedCopy(const cc::DrawQuad* other) { |
21 return new T(*T::MaterialCast(other)); | 25 return new T(*T::MaterialCast(other)); |
22 } | 26 } |
23 } // namespace | 27 } // namespace |
24 | 28 |
25 namespace cc { | 29 namespace cc { |
26 | 30 |
27 DrawQuad::DrawQuad() | 31 DrawQuad::DrawQuad() |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 break; | 87 break; |
84 case RENDER_PASS: // RenderPass quads have their own copy() method. | 88 case RENDER_PASS: // RenderPass quads have their own copy() method. |
85 case INVALID: | 89 case INVALID: |
86 LOG(FATAL) << "Invalid DrawQuad material " << material; | 90 LOG(FATAL) << "Invalid DrawQuad material " << material; |
87 break; | 91 break; |
88 } | 92 } |
89 copy_quad->shared_quad_state = copied_shared_quad_state; | 93 copy_quad->shared_quad_state = copied_shared_quad_state; |
90 return copy_quad.Pass(); | 94 return copy_quad.Pass(); |
91 } | 95 } |
92 | 96 |
97 scoped_ptr<base::Value> DrawQuad::AsValue() const { | |
98 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | |
99 value->SetInteger("material", material); | |
100 value->Set("shared_state", | |
101 TracedValue::CreateIDRef(shared_quad_state).release()); | |
102 | |
103 value->Set("rect_in_content_space", MathUtil::AsValue(rect).release()); | |
vmpstr
2013/07/31 16:23:25
nit: A little note for the future (or maybe for he
piman
2013/08/06 04:19:32
It did it that way, I think the names work.
| |
104 bool clipped; | |
105 gfx::QuadF rect_as_target_space_quad = MathUtil::MapQuad( | |
106 shared_quad_state->content_to_target_transform, | |
107 gfx::QuadF(rect), | |
108 &clipped); | |
109 value->Set("rect_as_target_space_quad", | |
110 MathUtil::AsValue(rect_as_target_space_quad).release()); | |
111 | |
112 value->Set("opaque_rect_in_content_space", | |
113 MathUtil::AsValue(opaque_rect).release()); | |
114 gfx::QuadF opaque_rect_as_target_space_quad = MathUtil::MapQuad( | |
115 shared_quad_state->content_to_target_transform, | |
116 gfx::QuadF(opaque_rect), | |
117 &clipped); | |
118 value->Set("opaque_rect_as_target_space_quad", | |
119 MathUtil::AsValue(opaque_rect_as_target_space_quad).release()); | |
120 | |
121 value->Set("visible_rect_in_content_space", | |
122 MathUtil::AsValue(visible_rect).release()); | |
123 gfx::QuadF visible_rect_as_target_space_quad = MathUtil::MapQuad( | |
124 shared_quad_state->content_to_target_transform, | |
125 gfx::QuadF(visible_rect), | |
126 &clipped); | |
127 value->Set("visible_rect_as_target_space_quad", | |
128 MathUtil::AsValue(visible_rect_as_target_space_quad).release()); | |
129 | |
130 value->SetBoolean("needs_blending", needs_blending); | |
131 value->SetBoolean("should_draw_with_blending", ShouldDrawWithBlending()); | |
132 ExtendValue(value.get()); | |
133 return value.PassAs<base::Value>(); | |
134 } | |
135 | |
93 } // namespace cc | 136 } // namespace cc |
OLD | NEW |