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

Side by Side Diff: cc/nine_patch_layer_impl_unittest.cc

Issue 11519018: [cc] Make LayerImpls point at LayerTreeImpl instead of LTHI (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "cc/nine_patch_layer_impl.h" 7 #include "cc/nine_patch_layer_impl.h"
8 8
9 #include "cc/append_quads_data.h" 9 #include "cc/append_quads_data.h"
10 #include "cc/single_thread_proxy.h" 10 #include "cc/single_thread_proxy.h"
(...skipping 23 matching lines...) Expand all
34 // generated should leave the border width (40) intact. 34 // generated should leave the border width (40) intact.
35 MockQuadCuller quadCuller; 35 MockQuadCuller quadCuller;
36 gfx::Size bitmapSize(100, 100); 36 gfx::Size bitmapSize(100, 100);
37 gfx::Size layerSize(400, 400); 37 gfx::Size layerSize(400, 400);
38 gfx::Rect visibleContentRect(gfx::Point(), layerSize); 38 gfx::Rect visibleContentRect(gfx::Point(), layerSize);
39 gfx::Rect apertureRect(20, 30, 40, 50); 39 gfx::Rect apertureRect(20, 30, 40, 50);
40 gfx::Rect scaledApertureNonUniform(20, 30, 340, 350); 40 gfx::Rect scaledApertureNonUniform(20, 30, 340, 350);
41 41
42 FakeImplProxy proxy; 42 FakeImplProxy proxy;
43 FakeLayerTreeHostImpl hostImpl(&proxy); 43 FakeLayerTreeHostImpl hostImpl(&proxy);
44 scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::create(&hostImpl, 1); 44 scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::create(hostImpl.a ctiveTree(), 1);
45 layer->drawProperties().visible_content_rect = visibleContentRect; 45 layer->drawProperties().visible_content_rect = visibleContentRect;
46 layer->setBounds(layerSize); 46 layer->setBounds(layerSize);
47 layer->setContentBounds(layerSize); 47 layer->setContentBounds(layerSize);
48 layer->createRenderSurface(); 48 layer->createRenderSurface();
49 layer->drawProperties().render_target = layer.get(); 49 layer->drawProperties().render_target = layer.get();
50 layer->setLayout(bitmapSize, apertureRect); 50 layer->setLayout(bitmapSize, apertureRect);
51 layer->setResourceId(1); 51 layer->setResourceId(1);
52 52
53 // This scale should not affect the generated quad geometry, but only 53 // This scale should not affect the generated quad geometry, but only
54 // the shared draw transform. 54 // the shared draw transform.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 { 95 {
96 // Test with a layer much smaller than the bitmap. 96 // Test with a layer much smaller than the bitmap.
97 MockQuadCuller quadCuller; 97 MockQuadCuller quadCuller;
98 gfx::Size bitmapSize(101, 101); 98 gfx::Size bitmapSize(101, 101);
99 gfx::Size layerSize(51, 51); 99 gfx::Size layerSize(51, 51);
100 gfx::Rect visibleContentRect(gfx::Point(), layerSize); 100 gfx::Rect visibleContentRect(gfx::Point(), layerSize);
101 gfx::Rect apertureRect(20, 30, 40, 45); // rightWidth: 40, botHeight: 25 101 gfx::Rect apertureRect(20, 30, 40, 45); // rightWidth: 40, botHeight: 25
102 102
103 FakeImplProxy proxy; 103 FakeImplProxy proxy;
104 FakeLayerTreeHostImpl hostImpl(&proxy); 104 FakeLayerTreeHostImpl hostImpl(&proxy);
105 scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::create(&hostImpl, 1); 105 scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::create(hostImpl.a ctiveTree(), 1);
106 layer->drawProperties().visible_content_rect = visibleContentRect; 106 layer->drawProperties().visible_content_rect = visibleContentRect;
107 layer->setBounds(layerSize); 107 layer->setBounds(layerSize);
108 layer->setContentBounds(layerSize); 108 layer->setContentBounds(layerSize);
109 layer->createRenderSurface(); 109 layer->createRenderSurface();
110 layer->drawProperties().render_target = layer.get(); 110 layer->drawProperties().render_target = layer.get();
111 layer->setLayout(bitmapSize, apertureRect); 111 layer->setLayout(bitmapSize, apertureRect);
112 layer->setResourceId(1); 112 layer->setResourceId(1);
113 113
114 AppendQuadsData data; 114 AppendQuadsData data;
115 layer->appendQuads(quadCuller, data); 115 layer->appendQuads(quadCuller, data);
(...skipping 26 matching lines...) Expand all
142 Region expectedRemainingRegion = Region(gfx::Rect(bitmapSize)); 142 Region expectedRemainingRegion = Region(gfx::Rect(bitmapSize));
143 expectedRemainingRegion.Subtract(gfx::Rect(0, 0, 17, 28)); 143 expectedRemainingRegion.Subtract(gfx::Rect(0, 0, 17, 28));
144 expectedRemainingRegion.Subtract(gfx::Rect(67, 0, 34, 28)); 144 expectedRemainingRegion.Subtract(gfx::Rect(67, 0, 34, 28));
145 expectedRemainingRegion.Subtract(gfx::Rect(0, 78, 17, 23)); 145 expectedRemainingRegion.Subtract(gfx::Rect(0, 78, 17, 23));
146 expectedRemainingRegion.Subtract(gfx::Rect(67, 78, 34, 23)); 146 expectedRemainingRegion.Subtract(gfx::Rect(67, 78, 34, 23));
147 EXPECT_EQ(expectedRemainingRegion, texRemaining); 147 EXPECT_EQ(expectedRemainingRegion, texRemaining);
148 } 148 }
149 149
150 } // namespace 150 } // namespace
151 } // namespace cc 151 } // namespace cc
OLDNEW
« cc/layer.h ('K') | « cc/nine_patch_layer_impl.cc ('k') | cc/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698