| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
| 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 "SkImageFilter.h" | 8 #include "SkImageFilter.h" |
| 9 | 9 |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 274 |
| 275 #if SK_SUPPORT_GPU | 275 #if SK_SUPPORT_GPU |
| 276 sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context, | 276 sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context, |
| 277 sk_sp<GrFragmentProcessor> fp, | 277 sk_sp<GrFragmentProcessor> fp, |
| 278 const SkIRect& bounds, | 278 const SkIRect& bounds, |
| 279 sk_sp<SkColorSpace> colorSpace)
{ | 279 sk_sp<SkColorSpace> colorSpace)
{ |
| 280 GrPaint paint; | 280 GrPaint paint; |
| 281 paint.addColorFragmentProcessor(std::move(fp)); | 281 paint.addColorFragmentProcessor(std::move(fp)); |
| 282 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 282 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
| 283 | 283 |
| 284 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr
ox, | 284 sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kApp
rox, |
| 285 bounds.width(), bou
nds.height(), | 285 bounds.width(), bo
unds.height(), |
| 286 kRGBA_8888_GrPixelC
onfig, | 286 kRGBA_8888_GrPixel
Config, |
| 287 std::move(colorSpac
e))); | 287 std::move(colorSpa
ce))); |
| 288 if (!drawContext) { | 288 if (!drawContext) { |
| 289 return nullptr; | 289 return nullptr; |
| 290 } | 290 } |
| 291 | 291 |
| 292 SkIRect dstIRect = SkIRect::MakeWH(bounds.width(), bounds.height()); | 292 SkIRect dstIRect = SkIRect::MakeWH(bounds.width(), bounds.height()); |
| 293 SkRect srcRect = SkRect::Make(bounds); | 293 SkRect srcRect = SkRect::Make(bounds); |
| 294 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); | 294 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); |
| 295 GrFixedClip clip(dstIRect); | 295 GrFixedClip clip(dstIRect); |
| 296 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); | 296 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); |
| 297 | 297 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 sk_sp<SkSpecialImage> result(input->filterImage(src, this->mapContext(ctx),
offset)); | 442 sk_sp<SkSpecialImage> result(input->filterImage(src, this->mapContext(ctx),
offset)); |
| 443 | 443 |
| 444 SkASSERT(!result || src->isTextureBacked() == result->isTextureBacked()); | 444 SkASSERT(!result || src->isTextureBacked() == result->isTextureBacked()); |
| 445 | 445 |
| 446 return result; | 446 return result; |
| 447 } | 447 } |
| 448 | 448 |
| 449 void SkImageFilter::PurgeCache() { | 449 void SkImageFilter::PurgeCache() { |
| 450 SkImageFilterCache::Get()->purge(); | 450 SkImageFilterCache::Get()->purge(); |
| 451 } | 451 } |
| OLD | NEW |