| 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 "cc/solid_color_layer_impl.h" | 5 #include "cc/solid_color_layer_impl.h" |
| 6 | 6 |
| 7 #include "cc/append_quads_data.h" | 7 #include "cc/append_quads_data.h" |
| 8 #include "cc/single_thread_proxy.h" | 8 #include "cc/single_thread_proxy.h" |
| 9 #include "cc/solid_color_draw_quad.h" | 9 #include "cc/solid_color_draw_quad.h" |
| 10 #include "cc/solid_color_layer.h" | 10 #include "cc/solid_color_layer.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 EXPECT_TRUE(layerImpl->contentsOpaque()); | 106 EXPECT_TRUE(layerImpl->contentsOpaque()); |
| 107 | 107 |
| 108 // Impl layer has 1 opacity, and the color is opaque, so the opaqueRect
should be the full tile. | 108 // Impl layer has 1 opacity, and the color is opaque, so the opaqueRect
should be the full tile. |
| 109 layerImpl->setDrawOpacity(1); | 109 layerImpl->setDrawOpacity(1); |
| 110 | 110 |
| 111 MockQuadCuller quadCuller; | 111 MockQuadCuller quadCuller; |
| 112 AppendQuadsData data; | 112 AppendQuadsData data; |
| 113 layerImpl->appendQuads(quadCuller, data); | 113 layerImpl->appendQuads(quadCuller, data); |
| 114 | 114 |
| 115 ASSERT_EQ(quadCuller.quadList().size(), 1U); | 115 ASSERT_EQ(quadCuller.quadList().size(), 1U); |
| 116 EXPECT_EQ(visibleContentRect.ToString(), quadCuller.quadList()[0]->opaqu
e_rect().ToString()); | 116 EXPECT_EQ(visibleContentRect.ToString(), quadCuller.quadList()[0]->opaqu
e_rect.ToString()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 EXPECT_TRUE(layer->contentsOpaque()); | 119 EXPECT_TRUE(layer->contentsOpaque()); |
| 120 layer->setBackgroundColor(SkColorSetARGBInline(254, 10, 20, 30)); | 120 layer->setBackgroundColor(SkColorSetARGBInline(254, 10, 20, 30)); |
| 121 EXPECT_FALSE(layer->contentsOpaque()); | 121 EXPECT_FALSE(layer->contentsOpaque()); |
| 122 | 122 |
| 123 { | 123 { |
| 124 scoped_ptr<SolidColorLayerImpl> layerImpl = SolidColorLayerImpl::create(
layer->id()); | 124 scoped_ptr<SolidColorLayerImpl> layerImpl = SolidColorLayerImpl::create(
layer->id()); |
| 125 layer->pushPropertiesTo(layerImpl.get()); | 125 layer->pushPropertiesTo(layerImpl.get()); |
| 126 | 126 |
| 127 // The impl layer should callnot itself opaque anymore. | 127 // The impl layer should callnot itself opaque anymore. |
| 128 EXPECT_FALSE(layerImpl->contentsOpaque()); | 128 EXPECT_FALSE(layerImpl->contentsOpaque()); |
| 129 | 129 |
| 130 // Impl layer has 1 opacity, but the color is not opaque, so the opaque_
rect should be empty. | 130 // Impl layer has 1 opacity, but the color is not opaque, so the opaque_
rect should be empty. |
| 131 layerImpl->setDrawOpacity(1); | 131 layerImpl->setDrawOpacity(1); |
| 132 | 132 |
| 133 MockQuadCuller quadCuller; | 133 MockQuadCuller quadCuller; |
| 134 AppendQuadsData data; | 134 AppendQuadsData data; |
| 135 layerImpl->appendQuads(quadCuller, data); | 135 layerImpl->appendQuads(quadCuller, data); |
| 136 | 136 |
| 137 ASSERT_EQ(quadCuller.quadList().size(), 1U); | 137 ASSERT_EQ(quadCuller.quadList().size(), 1U); |
| 138 EXPECT_EQ(gfx::Rect().ToString(), quadCuller.quadList()[0]->opaque_rect(
).ToString()); | 138 EXPECT_EQ(gfx::Rect().ToString(), quadCuller.quadList()[0]->opaque_rect.
ToString()); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace | 142 } // namespace |
| 143 } // namespace cc | 143 } // namespace cc |
| OLD | NEW |