| OLD | NEW |
| 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 Loading... |
| 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.a
ctiveTree(), 1); | 44 scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::Create(hostImpl.a
ctive_tree(), 1); |
| 45 layer->draw_properties().visible_content_rect = visibleContentRect; | 45 layer->draw_properties().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->draw_properties().render_target = layer.get(); | 49 layer->draw_properties().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 Loading... |
| 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.a
ctiveTree(), 1); | 105 scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::Create(hostImpl.a
ctive_tree(), 1); |
| 106 layer->draw_properties().visible_content_rect = visibleContentRect; | 106 layer->draw_properties().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->draw_properties().render_target = layer.get(); | 110 layer->draw_properties().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 Loading... |
| 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 |
| OLD | NEW |