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

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

Issue 2859483006: cc: Enable composited border-radius scrolling.
Patch Set: Make respect-clip-for-non-composited-scrollers-when-prefering-compositing-to-lcd-text.html not a re… Created 3 years, 7 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
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 mask->SetBounds(mask_bounds); 144 mask->SetBounds(mask_bounds);
145 mask->SetIsDrawable(true); 145 mask->SetIsDrawable(true);
146 mask->SetLayerMaskType(mask_type_); 146 mask->SetLayerMaskType(mask_type_);
147 green->SetMaskLayer(mask.get()); 147 green->SetMaskLayer(mask.get());
148 148
149 RunPixelResourceTest( 149 RunPixelResourceTest(
150 background, 150 background,
151 base::FilePath(FILE_PATH_LITERAL("mask_of_clipped_layer.png"))); 151 base::FilePath(FILE_PATH_LITERAL("mask_of_clipped_layer.png")));
152 } 152 }
153 153
154 TEST_P(LayerTreeHostMasksPixelTest, MaskOfLargerLayer) {
155 scoped_refptr<SolidColorLayer> background =
156 CreateSolidColorLayer(gfx::Rect(100, 100), SK_ColorWHITE);
157
158 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayerWithBorder(
159 gfx::Rect(0, 0, 100, 100), kCSSGreen, 1, SK_ColorBLACK);
160 background->AddChild(green);
161
162 gfx::Size mask_bounds(50, 50);
163 MaskContentLayerClient client(mask_bounds);
164 scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client);
165 mask->SetBounds(mask_bounds);
166 mask->SetIsDrawable(true);
167 mask->SetLayerMaskType(mask_type_);
168 green->SetMaskLayer(mask.get());
169
170 if (raster_buffer_provider_type_ == RASTER_BUFFER_PROVIDER_TYPE_BITMAP) {
171 // Bitmap produces a sharper (but equivalent sized) mask.
172 float percentage_pixels_large_error = 40.0f;
173 float percentage_pixels_small_error = 0.0f;
174 float average_error_allowed_in_bad_pixels = 65.0f;
175 int large_error_allowed = 120;
176 int small_error_allowed = 0;
177 pixel_comparator_.reset(new FuzzyPixelComparator(
178 true, // discard_alpha
179 percentage_pixels_large_error, percentage_pixels_small_error,
180 average_error_allowed_in_bad_pixels, large_error_allowed,
181 small_error_allowed));
182 }
183
184 RunPixelResourceTest(
185 background,
186 base::FilePath(FILE_PATH_LITERAL("mask_of_larger_layer.png")));
187 }
188
189 TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayerNonExactTextureSize) { 154 TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayerNonExactTextureSize) {
190 scoped_refptr<SolidColorLayer> background = 155 scoped_refptr<SolidColorLayer> background =
191 CreateSolidColorLayer(gfx::Rect(100, 100), SK_ColorWHITE); 156 CreateSolidColorLayer(gfx::Rect(100, 100), SK_ColorWHITE);
192 157
193 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayerWithBorder( 158 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayerWithBorder(
194 gfx::Rect(0, 0, 100, 100), kCSSGreen, 1, SK_ColorBLACK); 159 gfx::Rect(0, 0, 100, 100), kCSSGreen, 1, SK_ColorBLACK);
195 background->AddChild(green); 160 background->AddChild(green);
196 161
197 gfx::Size mask_bounds(100, 100); 162 gfx::Size mask_bounds(100, 100);
198 MaskContentLayerClient client(mask_bounds); 163 MaskContentLayerClient client(mask_bounds);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 363
399 RunPixelResourceTest(background, 364 RunPixelResourceTest(background,
400 base::FilePath( 365 base::FilePath(
401 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); 366 FILE_PATH_LITERAL("mask_of_layer_with_blend.png")));
402 } 367 }
403 368
404 } // namespace 369 } // namespace
405 } // namespace cc 370 } // namespace cc
406 371
407 #endif // !defined(OS_ANDROID) 372 #endif // !defined(OS_ANDROID)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698