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

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: Fix nit. 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
« no previous file with comments | « cc/layers/tiled_layer_impl_unittest.cc ('k') | cc/layers/ui_resource_layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
1389 layer->SetBounds(gfx::Size(300, 300)); 1388 layer->SetBounds(gfx::Size(300, 300));
1390 scale_layer->AddChild(layer); 1389 scale_layer->AddChild(layer);
1391 CalcDrawProps(&render_surface_layer_list); 1390 CalcDrawProps(&render_surface_layer_list);
1392 EXPECT_FLOAT_EQ(2.f, layer->contents_scale_x()); 1391 EXPECT_FLOAT_EQ(2.f, layer->contents_scale_x());
1393 EXPECT_FLOAT_EQ(2.f, layer->contents_scale_y()); 1392 EXPECT_FLOAT_EQ(2.f, layer->contents_scale_y());
1394 EXPECT_EQ(gfx::Size(600, 600).ToString(), 1393 EXPECT_EQ(gfx::Size(600, 600).ToString(),
1395 layer->content_bounds().ToString()); 1394 layer->content_bounds().ToString());
1396 1395
1397 // No tiles are covered by the 300x50 occlusion. 1396 // No tiles are covered by the 300x50 occlusion.
1398 occluded.SetOcclusion(gfx::Rect(200, 200, 300, 50)); 1397 occluded.SetOcclusion(gfx::Rect(200, 200, 300, 50));
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 1546
1548 scoped_refptr<FakeTiledLayer> root = make_scoped_refptr( 1547 scoped_refptr<FakeTiledLayer> root = make_scoped_refptr(
1549 new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); 1548 new FakeTiledLayer(layer_tree_host_->contents_texture_manager()));
1550 scoped_refptr<Layer> surface = Layer::Create(); 1549 scoped_refptr<Layer> surface = Layer::Create();
1551 scoped_refptr<FakeTiledLayer> child = make_scoped_refptr( 1550 scoped_refptr<FakeTiledLayer> child = make_scoped_refptr(
1552 new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); 1551 new FakeTiledLayer(layer_tree_host_->contents_texture_manager()));
1553 scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr( 1552 scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr(
1554 new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); 1553 new FakeTiledLayer(layer_tree_host_->contents_texture_manager()));
1555 1554
1556 root->SetBounds(root_rect.size()); 1555 root->SetBounds(root_rect.size());
1557 root->SetAnchorPoint(gfx::PointF());
1558 root->draw_properties().drawable_content_rect = root_rect; 1556 root->draw_properties().drawable_content_rect = root_rect;
1559 root->draw_properties().visible_content_rect = root_rect; 1557 root->draw_properties().visible_content_rect = root_rect;
1560 root->AddChild(surface); 1558 root->AddChild(surface);
1561 1559
1562 surface->SetForceRenderSurface(true); 1560 surface->SetForceRenderSurface(true);
1563 surface->SetAnchorPoint(gfx::PointF());
1564 surface->SetOpacity(0.5); 1561 surface->SetOpacity(0.5);
1565 surface->AddChild(child); 1562 surface->AddChild(child);
1566 surface->AddChild(child2); 1563 surface->AddChild(child2);
1567 1564
1568 child->SetBounds(child_rect.size()); 1565 child->SetBounds(child_rect.size());
1569 child->SetAnchorPoint(gfx::PointF());
1570 child->SetPosition(child_rect.origin()); 1566 child->SetPosition(child_rect.origin());
1571 child->draw_properties().visible_content_rect = child_rect; 1567 child->draw_properties().visible_content_rect = child_rect;
1572 child->draw_properties().drawable_content_rect = root_rect; 1568 child->draw_properties().drawable_content_rect = root_rect;
1573 1569
1574 child2->SetBounds(child2_rect.size()); 1570 child2->SetBounds(child2_rect.size());
1575 child2->SetAnchorPoint(gfx::PointF());
1576 child2->SetPosition(child2_rect.origin()); 1571 child2->SetPosition(child2_rect.origin());
1577 child2->draw_properties().visible_content_rect = child2_rect; 1572 child2->draw_properties().visible_content_rect = child2_rect;
1578 child2->draw_properties().drawable_content_rect = root_rect; 1573 child2->draw_properties().drawable_content_rect = root_rect;
1579 1574
1580 layer_tree_host_->SetRootLayer(root); 1575 layer_tree_host_->SetRootLayer(root);
1581 layer_tree_host_->SetViewportSize(root_rect.size()); 1576 layer_tree_host_->SetViewportSize(root_rect.size());
1582 1577
1583 // With a huge memory limit, all layers should update and push their textures. 1578 // With a huge memory limit, all layers should update and push their textures.
1584 root->InvalidateContentRect(root_rect); 1579 root->InvalidateContentRect(root_rect);
1585 child->InvalidateContentRect(child_rect); 1580 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 1810 // Invalidate the entire layer in layer space. When painting, the rect given
1816 // to webkit should match the layer's bounds. 1811 // to webkit should match the layer's bounds.
1817 layer->SetNeedsDisplayRect(layer_rect); 1812 layer->SetNeedsDisplayRect(layer_rect);
1818 layer->Update(queue_.get(), NULL); 1813 layer->Update(queue_.get(), NULL);
1819 1814
1820 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); 1815 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect());
1821 } 1816 }
1822 1817
1823 } // namespace 1818 } // namespace
1824 } // namespace cc 1819 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/tiled_layer_impl_unittest.cc ('k') | cc/layers/ui_resource_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698