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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 273 } |
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 GrPaint paint; | 279 GrPaint paint; |
280 paint.addColorFragmentProcessor(fp.get()); | 280 paint.addColorFragmentProcessor(fp.get()); |
281 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 281 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
282 | 282 |
283 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr
ox, | 283 sk_sp<GrDrawContext> drawContext(context->newDrawContext(GrContext::kLoose_B
ackingFit, |
284 bounds.width(), bou
nds.height(), | 284 bounds.width(), bou
nds.height(), |
285 kRGBA_8888_GrPixelC
onfig)); | 285 kRGBA_8888_GrPixelC
onfig)); |
286 if (!drawContext) { | 286 if (!drawContext) { |
287 return nullptr; | 287 return nullptr; |
288 } | 288 } |
289 | 289 |
290 SkRect srcRect = SkRect::Make(bounds); | 290 SkRect srcRect = SkRect::Make(bounds); |
291 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); | 291 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); |
292 GrClip clip(dstRect); | 292 GrClip clip(dstRect); |
293 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); | 293 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 sk_sp<SkSpecialImage> result(input->filterImage(src, this->mapContext(ctx),
offset)); | 439 sk_sp<SkSpecialImage> result(input->filterImage(src, this->mapContext(ctx),
offset)); |
440 | 440 |
441 SkASSERT(!result || src->isTextureBacked() == result->isTextureBacked()); | 441 SkASSERT(!result || src->isTextureBacked() == result->isTextureBacked()); |
442 | 442 |
443 return result; | 443 return result; |
444 } | 444 } |
445 | 445 |
446 void SkImageFilter::PurgeCache() { | 446 void SkImageFilter::PurgeCache() { |
447 SkImageFilterCache::Get()->purge(); | 447 SkImageFilterCache::Get()->purge(); |
448 } | 448 } |
OLD | NEW |