Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: cc/quads/draw_quad.cc

Issue 20667002: cc: Add frame data to LTHI tracing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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());
danakj 2013/08/06 23:39:27 Oh I see, so this is so that you don't have to AsV
102
103 value->Set("content_space_rect", MathUtil::AsValue(rect).release());
104 bool rect_is_clipped;
105 gfx::QuadF rect_as_target_space_quad = MathUtil::MapQuad(
106 shared_quad_state->content_to_target_transform,
107 gfx::QuadF(rect),
108 &rect_is_clipped);
109 value->Set("rect_as_target_space_quad",
110 MathUtil::AsValue(rect_as_target_space_quad).release());
111 value->SetBoolean("rect_is_clipped", rect_is_clipped);
112
113 value->Set("content_space_opaque_rect",
114 MathUtil::AsValue(opaque_rect).release());
115 bool opaque_rect_is_clipped;
116 gfx::QuadF opaque_rect_as_target_space_quad = MathUtil::MapQuad(
117 shared_quad_state->content_to_target_transform,
118 gfx::QuadF(opaque_rect),
119 &opaque_rect_is_clipped);
120 value->Set("opaque_rect_as_target_space_quad",
121 MathUtil::AsValue(opaque_rect_as_target_space_quad).release());
122 value->SetBoolean("opaque_rect_is_clipped", opaque_rect_is_clipped);
123
124 value->Set("content_space_visible_rect",
125 MathUtil::AsValue(visible_rect).release());
126 bool visible_rect_is_clipped;
127 gfx::QuadF visible_rect_as_target_space_quad = MathUtil::MapQuad(
128 shared_quad_state->content_to_target_transform,
129 gfx::QuadF(visible_rect),
130 &visible_rect_is_clipped);
131 value->Set("visible_rect_as_target_space_quad",
132 MathUtil::AsValue(visible_rect_as_target_space_quad).release());
133 value->SetBoolean("visible_rect_is_clipped", visible_rect_is_clipped);
134
135 value->SetBoolean("needs_blending", needs_blending);
136 value->SetBoolean("should_draw_with_blending", ShouldDrawWithBlending());
137 ExtendValue(value.get());
138 return value.PassAs<base::Value>();
139 }
140
93 } // namespace cc 141 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698