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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 #include "cc/layers/content_layer.h" | 6 #include "cc/layers/content_layer.h" |
7 #include "cc/layers/content_layer_client.h" | 7 #include "cc/layers/content_layer_client.h" |
8 #include "cc/layers/image_layer.h" | 8 #include "cc/layers/image_layer.h" |
9 #include "cc/layers/solid_color_layer.h" | 9 #include "cc/layers/solid_color_layer.h" |
10 #include "cc/test/layer_tree_pixel_test.h" | 10 #include "cc/test/layer_tree_pixel_test.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 TEST_F(LayerTreeHostMasksPixelTest, ImageMaskOfLayer) { | 71 TEST_F(LayerTreeHostMasksPixelTest, ImageMaskOfLayer) { |
72 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( | 72 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
73 gfx::Rect(200, 200), SK_ColorWHITE); | 73 gfx::Rect(200, 200), SK_ColorWHITE); |
74 | 74 |
75 scoped_refptr<ImageLayer> mask = ImageLayer::Create(); | 75 scoped_refptr<ImageLayer> mask = ImageLayer::Create(); |
76 mask->SetIsDrawable(true); | 76 mask->SetIsDrawable(true); |
77 mask->SetIsMask(true); | 77 mask->SetIsMask(true); |
78 mask->SetBounds(gfx::Size(100, 100)); | 78 mask->SetBounds(gfx::Size(100, 100)); |
79 | 79 |
80 SkBitmap bitmap; | 80 SkBitmap bitmap; |
81 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 400, 400); | 81 bitmap.allocN32Pixels(400, 400); |
82 bitmap.allocPixels(); | |
83 SkCanvas canvas(bitmap); | 82 SkCanvas canvas(bitmap); |
84 canvas.scale(SkIntToScalar(4), SkIntToScalar(4)); | 83 canvas.scale(SkIntToScalar(4), SkIntToScalar(4)); |
85 MaskContentLayerClient client; | 84 MaskContentLayerClient client; |
86 client.PaintContents(&canvas, | 85 client.PaintContents(&canvas, |
87 gfx::Rect(100, 100), | 86 gfx::Rect(100, 100), |
88 NULL); | 87 NULL); |
89 mask->SetBitmap(bitmap); | 88 mask->SetBitmap(bitmap); |
90 | 89 |
91 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayerWithBorder( | 90 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayerWithBorder( |
92 gfx::Rect(50, 50, 100, 100), kCSSGreen, 1, SK_ColorBLACK); | 91 gfx::Rect(50, 50, 100, 100), kCSSGreen, 1, SK_ColorBLACK); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 RunPixelTest(GL_WITH_BITMAP, | 273 RunPixelTest(GL_WITH_BITMAP, |
275 background, | 274 background, |
276 base::FilePath(FILE_PATH_LITERAL( | 275 base::FilePath(FILE_PATH_LITERAL( |
277 "mask_of_replica_of_clipped_layer.png"))); | 276 "mask_of_replica_of_clipped_layer.png"))); |
278 } | 277 } |
279 | 278 |
280 } // namespace | 279 } // namespace |
281 } // namespace cc | 280 } // namespace cc |
282 | 281 |
283 #endif // OS_ANDROID | 282 #endif // OS_ANDROID |
OLD | NEW |