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

Side by Side Diff: cc/layers/tiled_layer_unittest.cc

Issue 295193002: Get rid of graphics layer anchor points, and replace with transform origin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 6 years, 6 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layers/tiled_layer.h" 5 #include "cc/layers/tiled_layer.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 scale_transform.Scale(2.0, 2.0); 1378 scale_transform.Scale(2.0, 2.0);
1379 scale_layer->SetTransform(scale_transform); 1379 scale_layer->SetTransform(scale_transform);
1380 1380
1381 layer_tree_host_->root_layer()->AddChild(scale_layer); 1381 layer_tree_host_->root_layer()->AddChild(scale_layer);
1382 1382
1383 // The tile size is 100x100. 1383 // The tile size is 100x100.
1384 1384
1385 // This makes sure the painting works when the content space is scaled to 1385 // This makes sure the painting works when the content space is scaled to
1386 // a different layer space. 1386 // a different layer space.
1387 layer_tree_host_->SetViewportSize(gfx::Size(600, 600)); 1387 layer_tree_host_->SetViewportSize(gfx::Size(600, 600));
1388 layer->SetAnchorPoint(gfx::PointF()); 1388 layer->SetTransformOrigin(gfx::Point3F());
1389 layer->SetBounds(gfx::Size(300, 300)); 1389 layer->SetBounds(gfx::Size(300, 300));
1390 scale_layer->AddChild(layer); 1390 scale_layer->AddChild(layer);
1391 CalcDrawProps(&render_surface_layer_list); 1391 CalcDrawProps(&render_surface_layer_list);
1392 EXPECT_FLOAT_EQ(2.f, layer->contents_scale_x()); 1392 EXPECT_FLOAT_EQ(2.f, layer->contents_scale_x());
1393 EXPECT_FLOAT_EQ(2.f, layer->contents_scale_y()); 1393 EXPECT_FLOAT_EQ(2.f, layer->contents_scale_y());
1394 EXPECT_EQ(gfx::Size(600, 600).ToString(), 1394 EXPECT_EQ(gfx::Size(600, 600).ToString(),
1395 layer->content_bounds().ToString()); 1395 layer->content_bounds().ToString());
1396 1396
1397 // No tiles are covered by the 300x50 occlusion. 1397 // No tiles are covered by the 300x50 occlusion.
1398 occluded.SetOcclusion(gfx::Rect(200, 200, 300, 50)); 1398 occluded.SetOcclusion(gfx::Rect(200, 200, 300, 50));
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 1547
1548 scoped_refptr<FakeTiledLayer> root = make_scoped_refptr( 1548 scoped_refptr<FakeTiledLayer> root = make_scoped_refptr(
1549 new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); 1549 new FakeTiledLayer(layer_tree_host_->contents_texture_manager()));
1550 scoped_refptr<Layer> surface = Layer::Create(); 1550 scoped_refptr<Layer> surface = Layer::Create();
1551 scoped_refptr<FakeTiledLayer> child = make_scoped_refptr( 1551 scoped_refptr<FakeTiledLayer> child = make_scoped_refptr(
1552 new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); 1552 new FakeTiledLayer(layer_tree_host_->contents_texture_manager()));
1553 scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr( 1553 scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr(
1554 new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); 1554 new FakeTiledLayer(layer_tree_host_->contents_texture_manager()));
1555 1555
1556 root->SetBounds(root_rect.size()); 1556 root->SetBounds(root_rect.size());
1557 root->SetAnchorPoint(gfx::PointF()); 1557 root->SetTransformOrigin(gfx::Point3F());
enne (OOO) 2014/06/03 22:25:52 You're gonna hate me for this, but no need to set
chrishtr 2014/06/03 23:14:54 Done.
1558 root->draw_properties().drawable_content_rect = root_rect; 1558 root->draw_properties().drawable_content_rect = root_rect;
1559 root->draw_properties().visible_content_rect = root_rect; 1559 root->draw_properties().visible_content_rect = root_rect;
1560 root->AddChild(surface); 1560 root->AddChild(surface);
1561 1561
1562 surface->SetForceRenderSurface(true); 1562 surface->SetForceRenderSurface(true);
1563 surface->SetAnchorPoint(gfx::PointF()); 1563 surface->SetTransformOrigin(gfx::Point3F());
1564 surface->SetOpacity(0.5); 1564 surface->SetOpacity(0.5);
1565 surface->AddChild(child); 1565 surface->AddChild(child);
1566 surface->AddChild(child2); 1566 surface->AddChild(child2);
1567 1567
1568 child->SetBounds(child_rect.size()); 1568 child->SetBounds(child_rect.size());
1569 child->SetAnchorPoint(gfx::PointF()); 1569 child->SetTransformOrigin(gfx::Point3F());
1570 child->SetPosition(child_rect.origin()); 1570 child->SetPosition(child_rect.origin());
1571 child->draw_properties().visible_content_rect = child_rect; 1571 child->draw_properties().visible_content_rect = child_rect;
1572 child->draw_properties().drawable_content_rect = root_rect; 1572 child->draw_properties().drawable_content_rect = root_rect;
1573 1573
1574 child2->SetBounds(child2_rect.size()); 1574 child2->SetBounds(child2_rect.size());
1575 child2->SetAnchorPoint(gfx::PointF()); 1575 child2->SetTransformOrigin(gfx::Point3F());
1576 child2->SetPosition(child2_rect.origin()); 1576 child2->SetPosition(child2_rect.origin());
1577 child2->draw_properties().visible_content_rect = child2_rect; 1577 child2->draw_properties().visible_content_rect = child2_rect;
1578 child2->draw_properties().drawable_content_rect = root_rect; 1578 child2->draw_properties().drawable_content_rect = root_rect;
1579 1579
1580 layer_tree_host_->SetRootLayer(root); 1580 layer_tree_host_->SetRootLayer(root);
1581 layer_tree_host_->SetViewportSize(root_rect.size()); 1581 layer_tree_host_->SetViewportSize(root_rect.size());
1582 1582
1583 // With a huge memory limit, all layers should update and push their textures. 1583 // With a huge memory limit, all layers should update and push their textures.
1584 root->InvalidateContentRect(root_rect); 1584 root->InvalidateContentRect(root_rect);
1585 child->InvalidateContentRect(child_rect); 1585 child->InvalidateContentRect(child_rect);
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 // Invalidate the entire layer in layer space. When painting, the rect given 1815 // Invalidate the entire layer in layer space. When painting, the rect given
1816 // to webkit should match the layer's bounds. 1816 // to webkit should match the layer's bounds.
1817 layer->SetNeedsDisplayRect(layer_rect); 1817 layer->SetNeedsDisplayRect(layer_rect);
1818 layer->Update(queue_.get(), NULL); 1818 layer->Update(queue_.get(), NULL);
1819 1819
1820 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); 1820 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect());
1821 } 1821 }
1822 1822
1823 } // namespace 1823 } // namespace
1824 } // namespace cc 1824 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698