Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: cc/trees/layer_tree_host_pixeltest_masks.cc

Issue 2828353003: Determine mask UVs based on texture size (Closed)
Patch Set: Add tolerance to filter_effects.html Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/effect_node.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "cc/layers/content_layer_client.h" 8 #include "cc/layers/content_layer_client.h"
9 #include "cc/layers/picture_image_layer.h" 9 #include "cc/layers/picture_image_layer.h"
10 #include "cc/layers/picture_layer.h" 10 #include "cc/layers/picture_layer.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 mask->SetBounds(mask_bounds); 141 mask->SetBounds(mask_bounds);
142 mask->SetIsDrawable(true); 142 mask->SetIsDrawable(true);
143 mask->SetLayerMaskType(Layer::LayerMaskType::MULTI_TEXTURE_MASK); 143 mask->SetLayerMaskType(Layer::LayerMaskType::MULTI_TEXTURE_MASK);
144 green->SetMaskLayer(mask.get()); 144 green->SetMaskLayer(mask.get());
145 145
146 RunPixelResourceTest( 146 RunPixelResourceTest(
147 background, 147 background,
148 base::FilePath(FILE_PATH_LITERAL("mask_of_clipped_layer.png"))); 148 base::FilePath(FILE_PATH_LITERAL("mask_of_clipped_layer.png")));
149 } 149 }
150 150
151 TEST_P(LayerTreeHostMasksPixelTest, MaskOfLargerLayer) {
152 scoped_refptr<SolidColorLayer> background =
153 CreateSolidColorLayer(gfx::Rect(100, 100), SK_ColorWHITE);
154
155 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayerWithBorder(
156 gfx::Rect(0, 0, 100, 100), kCSSGreen, 1, SK_ColorBLACK);
157 background->AddChild(green);
158
159 gfx::Size mask_bounds(40, 40);
160 MaskContentLayerClient client(mask_bounds);
161 scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client);
162 mask->SetBounds(mask_bounds);
163 mask->SetIsDrawable(true);
164 mask->SetLayerMaskType(Layer::LayerMaskType::SINGLE_TEXTURE_MASK);
165 green->SetMaskLayer(mask.get());
166
167 RunPixelResourceTest(
168 background,
169 base::FilePath(FILE_PATH_LITERAL("mask_of_larger_layer.png")));
170 }
171
151 class CheckerContentLayerClient : public ContentLayerClient { 172 class CheckerContentLayerClient : public ContentLayerClient {
152 public: 173 public:
153 CheckerContentLayerClient(const gfx::Size& bounds, 174 CheckerContentLayerClient(const gfx::Size& bounds,
154 SkColor color, 175 SkColor color,
155 bool vertical) 176 bool vertical)
156 : bounds_(bounds), color_(color), vertical_(vertical) {} 177 : bounds_(bounds), color_(color), vertical_(vertical) {}
157 ~CheckerContentLayerClient() override {} 178 ~CheckerContentLayerClient() override {}
158 bool FillsBoundsCompletely() const override { return false; } 179 bool FillsBoundsCompletely() const override { return false; }
159 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } 180 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; }
160 gfx::Rect PaintableRegion() override { return gfx::Rect(bounds_); } 181 gfx::Rect PaintableRegion() override { return gfx::Rect(bounds_); }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 355
335 RunPixelResourceTest(background, 356 RunPixelResourceTest(background,
336 base::FilePath( 357 base::FilePath(
337 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); 358 FILE_PATH_LITERAL("mask_of_layer_with_blend.png")));
338 } 359 }
339 360
340 } // namespace 361 } // namespace
341 } // namespace cc 362 } // namespace cc
342 363
343 #endif // !defined(OS_ANDROID) 364 #endif // !defined(OS_ANDROID)
OLDNEW
« no previous file with comments | « cc/trees/effect_node.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698