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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "cc/layers/picture_image_layer.h" | 7 #include "cc/layers/picture_image_layer.h" |
8 #include "cc/layers/solid_color_layer.h" | 8 #include "cc/layers/solid_color_layer.h" |
9 #include "cc/test/layer_tree_pixel_resource_test.h" | 9 #include "cc/test/layer_tree_pixel_resource_test.h" |
10 #include "cc/test/pixel_comparator.h" | 10 #include "cc/test/pixel_comparator.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 layer->SetBounds(gfx::Size(width, height)); | 147 layer->SetBounds(gfx::Size(width, height)); |
148 layer->SetImage(backing_store->makeImageSnapshot()); | 148 layer->SetImage(backing_store->makeImageSnapshot()); |
149 return layer; | 149 return layer; |
150 } | 150 } |
151 | 151 |
152 void SetupMaskLayer(scoped_refptr<Layer> layer) { | 152 void SetupMaskLayer(scoped_refptr<Layer> layer) { |
153 const int kMaskOffset = 2; | 153 const int kMaskOffset = 2; |
154 gfx::Size bounds = layer->bounds(); | 154 gfx::Size bounds = layer->bounds(); |
155 scoped_refptr<PictureImageLayer> mask = PictureImageLayer::Create(); | 155 scoped_refptr<PictureImageLayer> mask = PictureImageLayer::Create(); |
156 mask->SetIsDrawable(true); | 156 mask->SetIsDrawable(true); |
157 mask->SetIsMask(true); | 157 mask->SetLayerMaskType(Layer::LayerMaskType::MULTI_TEXTURE_MASK); |
158 mask->SetBounds(bounds); | 158 mask->SetBounds(bounds); |
159 | 159 |
160 sk_sp<SkSurface> surface = | 160 sk_sp<SkSurface> surface = |
161 SkSurface::MakeRasterN32Premul(bounds.width(), bounds.height()); | 161 SkSurface::MakeRasterN32Premul(bounds.width(), bounds.height()); |
162 SkCanvas* canvas = surface->getCanvas(); | 162 SkCanvas* canvas = surface->getCanvas(); |
163 SkPaint paint; | 163 SkPaint paint; |
164 paint.setColor(SK_ColorWHITE); | 164 paint.setColor(SK_ColorWHITE); |
165 canvas->clear(SK_ColorTRANSPARENT); | 165 canvas->clear(SK_ColorTRANSPARENT); |
166 canvas->drawRect(SkRect::MakeXYWH(kMaskOffset, kMaskOffset, | 166 canvas->drawRect(SkRect::MakeXYWH(kMaskOffset, kMaskOffset, |
167 bounds.width() - kMaskOffset * 2, | 167 bounds.width() - kMaskOffset * 2, |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 RunBlendingWithRenderPass( | 500 RunBlendingWithRenderPass( |
501 GL_ZERO_COPY_RECT_DRAW, | 501 GL_ZERO_COPY_RECT_DRAW, |
502 FILE_PATH_LITERAL("blending_render_pass_mask.png"), | 502 FILE_PATH_LITERAL("blending_render_pass_mask.png"), |
503 kUseMasks | kUseAntialiasing | kUseColorMatrix | kForceShaders); | 503 kUseMasks | kUseAntialiasing | kUseColorMatrix | kForceShaders); |
504 } | 504 } |
505 | 505 |
506 } // namespace | 506 } // namespace |
507 } // namespace cc | 507 } // namespace cc |
508 | 508 |
509 #endif // OS_ANDROID | 509 #endif // OS_ANDROID |
OLD | NEW |