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

Unified Diff: cc/layer_tree_host_perftest.cc

Issue 11446076: Added LayerTreeHostImpl::layerTreeAsJson which serializes a layer tree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/nine_patch_layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_perftest.cc
diff --git a/cc/layer_tree_host_perftest.cc b/cc/layer_tree_host_perftest.cc
index ca7031d13fa9b6b852e294f13af8656d2116467c..ae2958c3b19120affca7d2eda2a47f1c06b92410 100644
--- a/cc/layer_tree_host_perftest.cc
+++ b/cc/layer_tree_host_perftest.cc
@@ -60,21 +60,21 @@ class LayerTreeHostPerfTest : public WebKitTests::ThreadedTest {
return layer;
}
- scoped_refptr<ContentLayer> CreateContentLayer(float x, float y, int width, int height) {
+ scoped_refptr<ContentLayer> CreateContentLayer(float x, float y, int width, int height, bool drawable=true) {
scoped_refptr<ContentLayer> layer = ContentLayer::create(&fake_delegate_);
layer->setAnchorPoint(gfx::Point());
layer->setPosition(gfx::PointF(x, y));
layer->setBounds(gfx::Size(width, height));
- layer->setIsDrawable(true);
+ layer->setIsDrawable(drawable);
return layer;
}
- scoped_refptr<SolidColorLayer> CreateColorLayer(float x, float y, int width, int height) {
+ scoped_refptr<SolidColorLayer> CreateColorLayer(float x, float y, int width, int height, bool drawable=true) {
scoped_refptr<SolidColorLayer> layer = SolidColorLayer::create();
layer->setAnchorPoint(gfx::Point());
layer->setPosition(gfx::PointF(x, y));
layer->setBounds(gfx::Size(width, height));
- layer->setIsDrawable(true);
+ layer->setIsDrawable(drawable);
return layer;
}
@@ -82,12 +82,12 @@ class LayerTreeHostPerfTest : public WebKitTests::ThreadedTest {
return CreateDecorationLayer(x, y, width, height, gfx::Rect(0, 0, width, height));
}
- scoped_refptr<NinePatchLayer> CreateDecorationLayer(float x, float y, int width, int height, gfx::Rect aperture) {
+ scoped_refptr<NinePatchLayer> CreateDecorationLayer(float x, float y, int width, int height, gfx::Rect aperture, bool drawable=true) {
scoped_refptr<NinePatchLayer> layer = NinePatchLayer::create();
layer->setAnchorPoint(gfx::Point());
layer->setPosition(gfx::PointF(x, y));
layer->setBounds(gfx::Size(width, height));
- layer->setIsDrawable(true);
+ layer->setIsDrawable(drawable);
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, 1, 1);
@@ -265,11 +265,14 @@ class LayerTreeHostPerfTestJsonReader : public LayerTreeHostPerfTest {
success &= list->GetDouble(0, &position_x);
success &= list->GetDouble(1, &position_y);
+ bool draws_content;
+ success &= dict->GetBoolean("DrawsContent", &draws_content);
+
scoped_refptr<Layer> new_layer;
if (layer_type == "SolidColorLayer") {
- new_layer = CreateColorLayer(position_x, position_y, width, height);
+ new_layer = CreateColorLayer(position_x, position_y, width, height, draws_content);
} else if (layer_type == "ContentLayer") {
- new_layer = CreateContentLayer(position_x, position_y, width, height);
+ new_layer = CreateContentLayer(position_x, position_y, width, height, draws_content);
} else if (layer_type == "NinePatchLayer") {
success &= dict->GetList("ImageAperture", &list);
int aperture_x, aperture_y, aperture_width, aperture_height;
@@ -280,12 +283,17 @@ class LayerTreeHostPerfTestJsonReader : public LayerTreeHostPerfTest {
new_layer = CreateDecorationLayer(
position_x, position_y, width, height,
- gfx::Rect(aperture_x, aperture_y, aperture_width, aperture_height));
+ gfx::Rect(aperture_x, aperture_y, aperture_width, aperture_height),
+ draws_content);
} else { // Type "Layer" or "unknown"
new_layer = CreateLayer(position_x, position_y, width, height);
}
+ double opacity;
+ if (dict->GetDouble("Opacity", &opacity))
+ new_layer->setOpacity(opacity);
+
success &= dict->GetList("DrawTransform", &list);
double transform[16];
for (int i = 0; i < 16; ++i)
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/nine_patch_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698