Commit bb209bf4 authored by dominikg@chromium.org's avatar dominikg@chromium.org

Use factory methods for Skia effects in unit tests.

To avoid stack allocation of Skia effects we made their constructors non-public
and provide factory methods instead. This patch updates the remaining uses of
the constructors in Chrome.

BUG=skia:2187

Review URL: https://codereview.chromium.org/271073002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269653 0039d316-1c4b-4281-b951-d872f2087c98
parent c09fb1f2
......@@ -505,10 +505,10 @@ TEST(FilterOperationsTest, BlendSaturatingBrightnessWithNull) {
}
TEST(FilterOperationsTest, BlendReferenceFilters) {
skia::RefPtr<SkImageFilter> from_filter = skia::AdoptRef(
new SkBlurImageFilter(1.f, 1.f));
skia::RefPtr<SkImageFilter> to_filter = skia::AdoptRef(
new SkBlurImageFilter(2.f, 2.f));
skia::RefPtr<SkImageFilter> from_filter =
skia::AdoptRef(SkBlurImageFilter::Create(1.f, 1.f));
skia::RefPtr<SkImageFilter> to_filter =
skia::AdoptRef(SkBlurImageFilter::Create(2.f, 2.f));
FilterOperation from = FilterOperation::CreateReferenceFilter(from_filter);
FilterOperation to = FilterOperation::CreateReferenceFilter(to_filter);
......@@ -526,8 +526,8 @@ TEST(FilterOperationsTest, BlendReferenceFilters) {
}
TEST(FilterOperationsTest, BlendReferenceWithNull) {
skia::RefPtr<SkImageFilter> image_filter = skia::AdoptRef(
new SkBlurImageFilter(1.f, 1.f));
skia::RefPtr<SkImageFilter> image_filter =
skia::AdoptRef(SkBlurImageFilter::Create(1.f, 1.f));
FilterOperation filter = FilterOperation::CreateReferenceFilter(image_filter);
FilterOperation null_filter =
FilterOperation::CreateReferenceFilter(skia::RefPtr<SkImageFilter>());
......
......@@ -1315,7 +1315,7 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) {
matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0;
matrix[18] = 1;
skia::RefPtr<SkColorFilter> color_filter(
skia::AdoptRef(new SkColorMatrixFilter(matrix)));
skia::AdoptRef(SkColorMatrixFilter::Create(matrix)));
skia::RefPtr<SkImageFilter> filter = skia::AdoptRef(
SkColorFilterImageFilter::Create(color_filter.get(), NULL));
FilterOperations filters;
......
......@@ -812,8 +812,8 @@ TYPED_TEST(RendererPixelTest, FastPassColorFilterAlpha) {
matrix[13] = matrix[14] = 0;
matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0;
matrix[18] = 1;
skia::RefPtr<SkColorFilter> colorFilter(skia::AdoptRef(
new SkColorMatrixFilter(matrix)));
skia::RefPtr<SkColorFilter> colorFilter(
skia::AdoptRef(SkColorMatrixFilter::Create(matrix)));
skia::RefPtr<SkImageFilter> filter =
skia::AdoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), NULL));
FilterOperations filters;
......@@ -1057,8 +1057,8 @@ TYPED_TEST(RendererPixelTest, FastPassColorFilterAlphaTranslation) {
matrix[14] = 1.5f;
matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0;
matrix[18] = 1;
skia::RefPtr<SkColorFilter> colorFilter(skia::AdoptRef(
new SkColorMatrixFilter(matrix)));
skia::RefPtr<SkColorFilter> colorFilter(
skia::AdoptRef(SkColorMatrixFilter::Create(matrix)));
skia::RefPtr<SkImageFilter> filter =
skia::AdoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), NULL));
FilterOperations filters;
......
......@@ -540,9 +540,8 @@ TEST_F(DamageTrackerTest, VerifyDamageForImageFilter) {
// Allow us to set damage on child too.
child->SetDrawsContent(true);
skia::RefPtr<SkImageFilter> filter =
skia::AdoptRef(new SkBlurImageFilter(SkIntToScalar(2),
SkIntToScalar(2)));
skia::RefPtr<SkImageFilter> filter = skia::AdoptRef(
SkBlurImageFilter::Create(SkIntToScalar(2), SkIntToScalar(2)));
FilterOperations filters;
filters.Append(FilterOperation::CreateReferenceFilter(filter));
......
......@@ -176,7 +176,7 @@ class ImageFilterClippedPixelTest : public LayerTreeHostFiltersPixelTest {
// This filter does a red-blue swap, so the foreground becomes blue.
matrix[2] = matrix[6] = matrix[10] = matrix[18] = SK_Scalar1;
skia::RefPtr<SkColorFilter> colorFilter(
skia::AdoptRef(new SkColorMatrixFilter(matrix)));
skia::AdoptRef(SkColorMatrixFilter::Create(matrix)));
// We filter only the bottom 200x100 pixels of the foreground.
SkImageFilter::CropRect crop_rect(SkRect::MakeXYWH(0, 100, 200, 100));
skia::RefPtr<SkImageFilter> filter = skia::AdoptRef(
......
......@@ -267,7 +267,7 @@ TEST_F(CCMessagesTest, AllQuads) {
arbitrary_filters1.Append(FilterOperation::CreateGrayscaleFilter(
arbitrary_float1));
skia::RefPtr<SkImageFilter> arbitrary_filter = skia::AdoptRef(
new SkBlurImageFilter(arbitrary_sigma, arbitrary_sigma));
SkBlurImageFilter::Create(arbitrary_sigma, arbitrary_sigma));
arbitrary_filters1.Append(
cc::FilterOperation::CreateReferenceFilter(arbitrary_filter));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment