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