From 3480672c5ed57c3e493ead97c7beb7a369210742 Mon Sep 17 00:00:00 2001 From: "piman@chromium.org" Date: Fri, 9 Aug 2013 23:51:21 +0000 Subject: cc: Add frame data to LTHI tracing This adds AddValue support to FrameData, RenderPass, *DrawQuad, FilterOperations, etc. It also adds an optional 'frame' field to the LTHI state which is the frame being produced at this point, with everything mentioned above. BUG=None R=danakj@chromium.org, nduca@chromium.org, vmpstr@chromium.org Review URL: https://codereview.chromium.org/20667002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216782 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/quads/draw_quad.cc | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'cc/quads/draw_quad.cc') diff --git a/cc/quads/draw_quad.cc b/cc/quads/draw_quad.cc index 6c8d9b6..0d021d9 100644 --- a/cc/quads/draw_quad.cc +++ b/cc/quads/draw_quad.cc @@ -5,6 +5,9 @@ #include "cc/quads/draw_quad.h" #include "base/logging.h" +#include "base/values.h" +#include "cc/base/math_util.h" +#include "cc/debug/traced_value.h" #include "cc/quads/checkerboard_draw_quad.h" #include "cc/quads/debug_border_draw_quad.h" #include "cc/quads/io_surface_draw_quad.h" @@ -15,6 +18,7 @@ #include "cc/quads/texture_draw_quad.h" #include "cc/quads/tile_draw_quad.h" #include "cc/quads/yuv_video_draw_quad.h" +#include "ui/gfx/quad_f.h" namespace { template T* TypedCopy(const cc::DrawQuad* other) { @@ -90,4 +94,48 @@ scoped_ptr DrawQuad::Copy( return copy_quad.Pass(); } +scoped_ptr DrawQuad::AsValue() const { + scoped_ptr value(new base::DictionaryValue()); + value->SetInteger("material", material); + value->Set("shared_state", + TracedValue::CreateIDRef(shared_quad_state).release()); + + value->Set("content_space_rect", MathUtil::AsValue(rect).release()); + bool rect_is_clipped; + gfx::QuadF rect_as_target_space_quad = MathUtil::MapQuad( + shared_quad_state->content_to_target_transform, + gfx::QuadF(rect), + &rect_is_clipped); + value->Set("rect_as_target_space_quad", + MathUtil::AsValue(rect_as_target_space_quad).release()); + value->SetBoolean("rect_is_clipped", rect_is_clipped); + + value->Set("content_space_opaque_rect", + MathUtil::AsValue(opaque_rect).release()); + bool opaque_rect_is_clipped; + gfx::QuadF opaque_rect_as_target_space_quad = MathUtil::MapQuad( + shared_quad_state->content_to_target_transform, + gfx::QuadF(opaque_rect), + &opaque_rect_is_clipped); + value->Set("opaque_rect_as_target_space_quad", + MathUtil::AsValue(opaque_rect_as_target_space_quad).release()); + value->SetBoolean("opaque_rect_is_clipped", opaque_rect_is_clipped); + + value->Set("content_space_visible_rect", + MathUtil::AsValue(visible_rect).release()); + bool visible_rect_is_clipped; + gfx::QuadF visible_rect_as_target_space_quad = MathUtil::MapQuad( + shared_quad_state->content_to_target_transform, + gfx::QuadF(visible_rect), + &visible_rect_is_clipped); + value->Set("visible_rect_as_target_space_quad", + MathUtil::AsValue(visible_rect_as_target_space_quad).release()); + value->SetBoolean("visible_rect_is_clipped", visible_rect_is_clipped); + + value->SetBoolean("needs_blending", needs_blending); + value->SetBoolean("should_draw_with_blending", ShouldDrawWithBlending()); + ExtendValue(value.get()); + return value.PassAs(); +} + } // namespace cc -- cgit v1.1