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

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 1925313002: Tighten up SkSpecialSurface factory functions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
« no previous file with comments | « src/core/SkSpecialSurface.cpp ('k') | tests/SpecialSurfaceTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 static sk_sp<SkImageFilter> make_blue(sk_sp<SkImageFilter> input, 363 static sk_sp<SkImageFilter> make_blue(sk_sp<SkImageFilter> input,
364 const SkImageFilter::CropRect* cropRect) { 364 const SkImageFilter::CropRect* cropRect) {
365 sk_sp<SkColorFilter> filter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, 365 sk_sp<SkColorFilter> filter(SkColorFilter::MakeModeFilter(SK_ColorBLUE,
366 SkXfermode::kSrcIn _Mode)); 366 SkXfermode::kSrcIn _Mode));
367 return SkColorFilterImageFilter::Make(std::move(filter), std::move(input), c ropRect); 367 return SkColorFilterImageFilter::Make(std::move(filter), std::move(input), c ropRect);
368 } 368 }
369 369
370 static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context, int widthHeight) { 370 static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context, int widthHeight) {
371 #if SK_SUPPORT_GPU 371 #if SK_SUPPORT_GPU
372 if (context) { 372 if (context) {
373 GrSurfaceDesc desc; 373 return SkSpecialSurface::MakeRenderTarget(context,
374 desc.fConfig = kSkia8888_GrPixelConfig; 374 widthHeight, widthHeight,
375 desc.fFlags = kRenderTarget_GrSurfaceFlag; 375 kSkia8888_GrPixelConfig);
376 desc.fWidth = widthHeight;
377 desc.fHeight = widthHeight;
378 return SkSpecialSurface::MakeRenderTarget(context, desc);
379 } else 376 } else
380 #endif 377 #endif
381 { 378 {
382 const SkImageInfo info = SkImageInfo::MakeN32(widthHeight, widthHeight, 379 const SkImageInfo info = SkImageInfo::MakeN32(widthHeight, widthHeight,
383 kOpaque_SkAlphaType); 380 kOpaque_SkAlphaType);
384 return SkSpecialSurface::MakeRaster(info); 381 return SkSpecialSurface::MakeRaster(info);
385 } 382 }
386 } 383 }
387 384
388 static sk_sp<SkSpecialImage> create_empty_special_image(GrContext* context, int widthHeight) { 385 static sk_sp<SkSpecialImage> create_empty_special_image(GrContext* context, int widthHeight) {
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 { SkColorFilterImageFilter::Make(cf, blif), false }, 1731 { SkColorFilterImageFilter::Make(cf, blif), false },
1735 { SkMergeImageFilter::Make(cfif, blif), false }, 1732 { SkMergeImageFilter::Make(cfif, blif), false },
1736 { SkComposeImageFilter::Make(blif, cfif), false }, 1733 { SkComposeImageFilter::Make(blif, cfif), false },
1737 }; 1734 };
1738 1735
1739 for (const auto& rec : recs) { 1736 for (const auto& rec : recs) {
1740 const bool canHandle = rec.fFilter->canHandleComplexCTM(); 1737 const bool canHandle = rec.fFilter->canHandleComplexCTM();
1741 REPORTER_ASSERT(reporter, canHandle == rec.fExpectCanHandle); 1738 REPORTER_ASSERT(reporter, canHandle == rec.fExpectCanHandle);
1742 } 1739 }
1743 } 1740 }
OLDNEW
« no previous file with comments | « src/core/SkSpecialSurface.cpp ('k') | tests/SpecialSurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698