| OLD | NEW |
| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 } | 361 } |
| 362 | 362 |
| 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 (context) { | 372 if (context) { |
| 372 GrSurfaceDesc desc; | 373 GrSurfaceDesc desc; |
| 373 desc.fConfig = kSkia8888_GrPixelConfig; | 374 desc.fConfig = kSkia8888_GrPixelConfig; |
| 374 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 375 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 375 desc.fWidth = widthHeight; | 376 desc.fWidth = widthHeight; |
| 376 desc.fHeight = widthHeight; | 377 desc.fHeight = widthHeight; |
| 377 return SkSpecialSurface::MakeRenderTarget(context, desc); | 378 return SkSpecialSurface::MakeRenderTarget(context, desc); |
| 378 } else { | 379 } else |
| 380 #endif |
| 381 { |
| 379 const SkImageInfo info = SkImageInfo::MakeN32(widthHeight, widthHeight, | 382 const SkImageInfo info = SkImageInfo::MakeN32(widthHeight, widthHeight, |
| 380 kOpaque_SkAlphaType); | 383 kOpaque_SkAlphaType); |
| 381 return SkSpecialSurface::MakeRaster(info); | 384 return SkSpecialSurface::MakeRaster(info); |
| 382 } | 385 } |
| 383 } | 386 } |
| 384 | 387 |
| 385 static sk_sp<SkSpecialImage> create_empty_special_image(GrContext* context, int
widthHeight) { | 388 static sk_sp<SkSpecialImage> create_empty_special_image(GrContext* context, int
widthHeight) { |
| 386 sk_sp<SkSpecialSurface> surf(create_empty_special_surface(context, widthHeig
ht)); | 389 sk_sp<SkSpecialSurface> surf(create_empty_special_surface(context, widthHeig
ht)); |
| 387 | 390 |
| 388 SkASSERT(surf); | 391 SkASSERT(surf); |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 { blif, false }, | 1730 { blif, false }, |
| 1728 { SkMergeImageFilter::Make(cfif, blif), false }, | 1731 { SkMergeImageFilter::Make(cfif, blif), false }, |
| 1729 { SkColorFilterImageFilter::Make(cf, blif), false }, | 1732 { SkColorFilterImageFilter::Make(cf, blif), false }, |
| 1730 }; | 1733 }; |
| 1731 | 1734 |
| 1732 for (const auto& rec : recs) { | 1735 for (const auto& rec : recs) { |
| 1733 const bool canHandle = rec.fFilter->canHandleAffine(); | 1736 const bool canHandle = rec.fFilter->canHandleAffine(); |
| 1734 REPORTER_ASSERT(reporter, canHandle == rec.fExpectCanHandle); | 1737 REPORTER_ASSERT(reporter, canHandle == rec.fExpectCanHandle); |
| 1735 } | 1738 } |
| 1736 } | 1739 } |
| OLD | NEW |