summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-23 22:02:02 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-23 22:02:02 +0000
commitdaf9ea2d78a8913f6e736eb303c089a63e92430e (patch)
treec71608284a0fbdfde6434569b8b08d8342f5fee2 /cc
parenta27cbde25cff84614708e45f3069347d4d3dfd11 (diff)
downloadchromium_src-daf9ea2d78a8913f6e736eb303c089a63e92430e.zip
chromium_src-daf9ea2d78a8913f6e736eb303c089a63e92430e.tar.gz
chromium_src-daf9ea2d78a8913f6e736eb303c089a63e92430e.tar.bz2
cc: Add a debug border for delegated renderer layer.
The layer has no debug border right now, so you can't tell visually if you are using ubercomp or not. Since most colors are already taken, we've gone with a multi-color approach. R=piman,enne BUG=223231 Review URL: https://chromiumcodereview.appspot.com/12893028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/layers/delegated_renderer_layer_impl.cc75
-rw-r--r--cc/layers/delegated_renderer_layer_impl.h3
2 files changed, 78 insertions, 0 deletions
diff --git a/cc/layers/delegated_renderer_layer_impl.cc b/cc/layers/delegated_renderer_layer_impl.cc
index cfd4897..2614b0c 100644
--- a/cc/layers/delegated_renderer_layer_impl.cc
+++ b/cc/layers/delegated_renderer_layer_impl.cc
@@ -11,6 +11,7 @@
#include "cc/layers/render_pass_sink.h"
#include "cc/output/delegated_frame_data.h"
#include "cc/quads/render_pass_draw_quad.h"
+#include "cc/quads/solid_color_draw_quad.h"
#include "cc/trees/layer_tree_impl.h"
namespace cc {
@@ -219,6 +220,8 @@ void DelegatedRendererLayerImpl::AppendContributingRenderPasses(
void DelegatedRendererLayerImpl::AppendQuads(
QuadSink* quad_sink,
AppendQuadsData* append_quads_data) {
+ AppendRainbowDebugBorder(quad_sink, append_quads_data);
+
if (render_passes_in_draw_order_.empty())
return;
@@ -254,6 +257,78 @@ void DelegatedRendererLayerImpl::AppendQuads(
}
}
+void DelegatedRendererLayerImpl::AppendRainbowDebugBorder(
+ QuadSink* quad_sink,
+ AppendQuadsData* append_quads_data) {
+ if (!ShowDebugBorders())
+ return;
+
+ SharedQuadState* shared_quad_state =
+ quad_sink->UseSharedQuadState(CreateSharedQuadState());
+
+ SkColor color;
+ float border_width;
+ GetDebugBorderProperties(&color, &border_width);
+
+ SkColor colors[] = {
+ 0x80ff0000, // Red.
+ 0x80ffa500, // Orange.
+ 0x80ffff00, // Yellow.
+ 0x80008000, // Green.
+ 0x800000ff, // Blue.
+ 0x80ee82ee, // Violet.
+ };
+ const int kNumColors = arraysize(colors);
+
+ const int kStripeWidth = 300;
+ const int kStripeHeight = 300;
+
+ for (size_t i = 0; ; ++i) {
+ // For horizontal lines.
+ int x = kStripeWidth * i;
+ int width = std::min(kStripeWidth, content_bounds().width() - x - 1);
+
+ // For vertical lines.
+ int y = kStripeHeight * i;
+ int height = std::min(kStripeHeight, content_bounds().height() - y - 1);
+
+ gfx::Rect top(x, 0, width, border_width);
+ gfx::Rect bottom(x,
+ content_bounds().height() - border_width,
+ width,
+ border_width);
+ gfx::Rect left(0, y, border_width, height);
+ gfx::Rect right(content_bounds().width() - border_width,
+ y,
+ border_width,
+ height);
+
+ if (top.IsEmpty() && left.IsEmpty())
+ break;
+
+ if (!top.IsEmpty()) {
+ scoped_ptr<SolidColorDrawQuad> top_quad = SolidColorDrawQuad::Create();
+ top_quad->SetNew(shared_quad_state, top, colors[i % kNumColors]);
+ quad_sink->Append(top_quad.PassAs<DrawQuad>(), append_quads_data);
+
+ scoped_ptr<SolidColorDrawQuad> bottom_quad = SolidColorDrawQuad::Create();
+ bottom_quad->SetNew(
+ shared_quad_state, bottom, colors[kNumColors - 1 - (i % kNumColors)]);
+ quad_sink->Append(bottom_quad.PassAs<DrawQuad>(), append_quads_data);
+ }
+ if (!left.IsEmpty()) {
+ scoped_ptr<SolidColorDrawQuad> left_quad = SolidColorDrawQuad::Create();
+ left_quad->SetNew(
+ shared_quad_state, left, colors[kNumColors - 1 - (i % kNumColors)]);
+ quad_sink->Append(left_quad.PassAs<DrawQuad>(), append_quads_data);
+
+ scoped_ptr<SolidColorDrawQuad> right_quad = SolidColorDrawQuad::Create();
+ right_quad->SetNew(shared_quad_state, right, colors[i % kNumColors]);
+ quad_sink->Append(right_quad.PassAs<DrawQuad>(), append_quads_data);
+ }
+ }
+}
+
void DelegatedRendererLayerImpl::AppendRenderPassQuads(
QuadSink* quad_sink,
AppendQuadsData* append_quads_data,
diff --git a/cc/layers/delegated_renderer_layer_impl.h b/cc/layers/delegated_renderer_layer_impl.h
index 1f6e214..d768ea6 100644
--- a/cc/layers/delegated_renderer_layer_impl.h
+++ b/cc/layers/delegated_renderer_layer_impl.h
@@ -57,6 +57,9 @@ class CC_EXPORT DelegatedRendererLayerImpl : public LayerImpl {
void CreateChildIdIfNeeded();
void ClearChildId();
+ void AppendRainbowDebugBorder(QuadSink* quad_sink,
+ AppendQuadsData* append_quads_data);
+
void SetRenderPasses(
ScopedPtrVector<RenderPass>* render_passes_in_draw_order);
void ClearRenderPasses();