OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/append_quads_data.h" | 5 #include "cc/layers/append_quads_data.h" |
6 #include "cc/layers/content_layer_client.h" | 6 #include "cc/layers/content_layer_client.h" |
7 #include "cc/layers/picture_layer.h" | 7 #include "cc/layers/picture_layer.h" |
8 #include "cc/layers/picture_layer_impl.h" | 8 #include "cc/layers/picture_layer_impl.h" |
9 #include "cc/quads/draw_quad.h" | 9 #include "cc/quads/draw_quad.h" |
10 #include "cc/test/layer_tree_pixel_test.h" | 10 #include "cc/test/layer_tree_pixel_test.h" |
11 #include "cc/trees/layer_tree_impl.h" | 11 #include "cc/trees/layer_tree_impl.h" |
12 #include "third_party/skia/include/core/SkCanvas.h" | 12 #include "third_party/skia/include/core/SkCanvas.h" |
13 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
15 #include "ui/gfx/rect_f.h" | 15 #include "ui/gfx/geometry/rect_f.h" |
16 | 16 |
17 #if !defined(OS_ANDROID) | 17 #if !defined(OS_ANDROID) |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 namespace { | 20 namespace { |
21 | 21 |
22 class LayerTreeHostOnDemandRasterPixelTest : public LayerTreePixelTest { | 22 class LayerTreeHostOnDemandRasterPixelTest : public LayerTreePixelTest { |
23 public: | 23 public: |
24 void InitializeSettings(LayerTreeSettings* settings) override { | 24 void InitializeSettings(LayerTreeSettings* settings) override { |
25 settings->impl_side_painting = true; | 25 settings->impl_side_painting = true; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // Use multiple colors in a single layer to prevent bypassing on-demand | 90 // Use multiple colors in a single layer to prevent bypassing on-demand |
91 // rasterization if a single solid color is detected in picture analysis. | 91 // rasterization if a single solid color is detected in picture analysis. |
92 gfx::Rect layer_rect(200, 200); | 92 gfx::Rect layer_rect(200, 200); |
93 BlueYellowLayerClient client(layer_rect); | 93 BlueYellowLayerClient client(layer_rect); |
94 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 94 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
95 | 95 |
96 layer->SetIsDrawable(true); | 96 layer->SetIsDrawable(true); |
97 layer->SetBounds(layer_rect.size()); | 97 layer->SetBounds(layer_rect.size()); |
98 layer->SetPosition(layer_rect.origin()); | 98 layer->SetPosition(layer_rect.origin()); |
99 | 99 |
100 RunPixelTest(GL_WITH_BITMAP, | 100 RunPixelTest(PIXEL_TEST_GL, |
101 layer, | 101 layer, |
102 base::FilePath(FILE_PATH_LITERAL("blue_yellow.png"))); | 102 base::FilePath(FILE_PATH_LITERAL("blue_yellow.png"))); |
103 } | 103 } |
104 | 104 |
105 TEST_F(LayerTreeHostOnDemandRasterPixelTest, RasterPictureLayer) { | 105 TEST_F(LayerTreeHostOnDemandRasterPixelTest, RasterPictureLayer) { |
106 RunOnDemandRasterPixelTest(); | 106 RunOnDemandRasterPixelTest(); |
107 } | 107 } |
108 | 108 |
109 class LayerTreeHostOnDemandRasterPixelTestWithGpuRasterizationForced | 109 class LayerTreeHostOnDemandRasterPixelTestWithGpuRasterizationForced |
110 : public LayerTreeHostOnDemandRasterPixelTest { | 110 : public LayerTreeHostOnDemandRasterPixelTest { |
111 void InitializeSettings(LayerTreeSettings* settings) override { | 111 void InitializeSettings(LayerTreeSettings* settings) override { |
112 LayerTreeHostOnDemandRasterPixelTest::InitializeSettings(settings); | 112 LayerTreeHostOnDemandRasterPixelTest::InitializeSettings(settings); |
113 settings->gpu_rasterization_forced = true; | 113 settings->gpu_rasterization_forced = true; |
114 } | 114 } |
115 }; | 115 }; |
116 | 116 |
117 TEST_F(LayerTreeHostOnDemandRasterPixelTestWithGpuRasterizationForced, | 117 TEST_F(LayerTreeHostOnDemandRasterPixelTestWithGpuRasterizationForced, |
118 RasterPictureLayer) { | 118 RasterPictureLayer) { |
119 RunOnDemandRasterPixelTest(); | 119 RunOnDemandRasterPixelTest(); |
120 } | 120 } |
121 | 121 |
122 } // namespace | 122 } // namespace |
123 } // namespace cc | 123 } // namespace cc |
124 | 124 |
125 #endif // OS_ANDROID | 125 #endif // OS_ANDROID |
OLD | NEW |