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_client.h" | 6 #include "cc/layers/content_layer_client.h" |
7 #include "cc/layers/picture_image_layer.h" | 7 #include "cc/layers/picture_image_layer.h" |
8 #include "cc/layers/picture_layer.h" | 8 #include "cc/layers/picture_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_resource_test.h" | 10 #include "cc/test/layer_tree_pixel_resource_test.h" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 GL_ONE_COPY_RECT_STAGING_2D_DRAW, | 358 GL_ONE_COPY_RECT_STAGING_2D_DRAW, |
359 GL_ONE_COPY_EXTERNAL_STAGING_2D_DRAW, | 359 GL_ONE_COPY_EXTERNAL_STAGING_2D_DRAW, |
360 GL_ZERO_COPY_2D_DRAW, | 360 GL_ZERO_COPY_2D_DRAW, |
361 GL_ZERO_COPY_RECT_DRAW, | 361 GL_ZERO_COPY_RECT_DRAW, |
362 GL_ZERO_COPY_EXTERNAL_DRAW, | 362 GL_ZERO_COPY_EXTERNAL_DRAW, |
363 GL_ASYNC_UPLOAD_2D_DRAW)); | 363 GL_ASYNC_UPLOAD_2D_DRAW)); |
364 | 364 |
365 TEST_P(LayerTreeHostMasksForBackgroundFiltersPixelTest, | 365 TEST_P(LayerTreeHostMasksForBackgroundFiltersPixelTest, |
366 MaskOfLayerWithBackgroundFilter) { | 366 MaskOfLayerWithBackgroundFilter) { |
367 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( | 367 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
368 gfx::Rect(128, 128), SK_ColorWHITE); | 368 gfx::Rect(100, 100), SK_ColorWHITE); |
369 | 369 |
370 gfx::Size picture_bounds(128, 128); | 370 gfx::Size picture_bounds(100, 100); |
371 CheckerContentLayerClient picture_client(picture_bounds, SK_ColorGREEN, true); | 371 CheckerContentLayerClient picture_client(picture_bounds, SK_ColorGREEN, true); |
372 scoped_refptr<PictureLayer> picture = PictureLayer::Create(&picture_client); | 372 scoped_refptr<PictureLayer> picture = PictureLayer::Create(&picture_client); |
373 picture->SetBounds(picture_bounds); | 373 picture->SetBounds(picture_bounds); |
374 picture->SetIsDrawable(true); | 374 picture->SetIsDrawable(true); |
375 | 375 |
376 scoped_refptr<SolidColorLayer> blur = CreateSolidColorLayer( | 376 scoped_refptr<SolidColorLayer> blur = CreateSolidColorLayer( |
377 gfx::Rect(128, 128), SK_ColorTRANSPARENT); | 377 gfx::Rect(100, 100), SK_ColorTRANSPARENT); |
378 background->AddChild(picture); | 378 background->AddChild(picture); |
379 background->AddChild(blur); | 379 background->AddChild(blur); |
380 | 380 |
381 FilterOperations filters; | 381 FilterOperations filters; |
382 filters.Append(FilterOperation::CreateBlurFilter(2.f)); | 382 filters.Append(FilterOperation::CreateBlurFilter(1.5f)); |
383 blur->SetBackgroundFilters(filters); | 383 blur->SetBackgroundFilters(filters); |
384 | 384 |
385 gfx::Size mask_bounds(128, 128); | 385 gfx::Size mask_bounds(100, 100); |
386 CircleContentLayerClient mask_client(mask_bounds); | 386 CircleContentLayerClient mask_client(mask_bounds); |
387 scoped_refptr<PictureLayer> mask = PictureLayer::Create(&mask_client); | 387 scoped_refptr<PictureLayer> mask = PictureLayer::Create(&mask_client); |
388 mask->SetBounds(mask_bounds); | 388 mask->SetBounds(mask_bounds); |
389 mask->SetIsDrawable(true); | 389 mask->SetIsDrawable(true); |
390 mask->SetIsMask(true); | 390 mask->SetIsMask(true); |
391 blur->SetMaskLayer(mask.get()); | 391 blur->SetMaskLayer(mask.get()); |
392 | 392 |
393 float percentage_pixels_large_error = 2.5f; // 2.5%, ~400px / (128*128) | 393 float percentage_pixels_large_error = 2.5f; // 2.5%, ~250px / (100*100) |
394 float percentage_pixels_small_error = 0.0f; | 394 float percentage_pixels_small_error = 0.0f; |
395 float average_error_allowed_in_bad_pixels = 100.0f; | 395 float average_error_allowed_in_bad_pixels = 100.0f; |
396 int large_error_allowed = 256; | 396 int large_error_allowed = 256; |
397 int small_error_allowed = 0; | 397 int small_error_allowed = 0; |
398 pixel_comparator_.reset(new FuzzyPixelComparator( | 398 pixel_comparator_.reset(new FuzzyPixelComparator( |
399 true, // discard_alpha | 399 true, // discard_alpha |
400 percentage_pixels_large_error, | 400 percentage_pixels_large_error, |
401 percentage_pixels_small_error, | 401 percentage_pixels_small_error, |
402 average_error_allowed_in_bad_pixels, | 402 average_error_allowed_in_bad_pixels, |
403 large_error_allowed, | 403 large_error_allowed, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 456 |
457 RunPixelResourceTest(background, | 457 RunPixelResourceTest(background, |
458 base::FilePath( | 458 base::FilePath( |
459 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); | 459 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); |
460 } | 460 } |
461 | 461 |
462 } // namespace | 462 } // namespace |
463 } // namespace cc | 463 } // namespace cc |
464 | 464 |
465 #endif // !defined(OS_ANDROID) | 465 #endif // !defined(OS_ANDROID) |
OLD | NEW |