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 "SkMorphologyImageFilter.h" | 8 #include "SkMorphologyImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 int radius, | 472 int radius, |
473 GrMorphologyEffect::MorphologyType morphType, | 473 GrMorphologyEffect::MorphologyType morphType, |
474 float bounds[2], | 474 float bounds[2], |
475 Gr1DKernelEffect::Direction direction) { | 475 Gr1DKernelEffect::Direction direction) { |
476 GrPaint paint; | 476 GrPaint paint; |
477 paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture, | 477 paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture, |
478 direction, | 478 direction, |
479 radius, | 479 radius, |
480 morphType, | 480 morphType, |
481 bounds))->unref()
; | 481 bounds))->unref()
; |
| 482 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
482 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect
), | 483 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect
), |
483 SkRect::Make(srcRect)); | 484 SkRect::Make(srcRect)); |
484 } | 485 } |
485 | 486 |
486 void apply_morphology_rect_no_bounds(GrDrawContext* drawContext, | 487 void apply_morphology_rect_no_bounds(GrDrawContext* drawContext, |
487 const GrClip& clip, | 488 const GrClip& clip, |
488 GrTexture* texture, | 489 GrTexture* texture, |
489 const SkIRect& srcRect, | 490 const SkIRect& srcRect, |
490 const SkIRect& dstRect, | 491 const SkIRect& dstRect, |
491 int radius, | 492 int radius, |
492 GrMorphologyEffect::MorphologyType morphTyp
e, | 493 GrMorphologyEffect::MorphologyType morphTyp
e, |
493 Gr1DKernelEffect::Direction direction) { | 494 Gr1DKernelEffect::Direction direction) { |
494 GrPaint paint; | 495 GrPaint paint; |
495 paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture, | 496 paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture, |
496 direction, | 497 direction, |
497 radius, | 498 radius, |
498 morphType))->unre
f(); | 499 morphType))->unre
f(); |
| 500 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
499 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect
), | 501 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect
), |
500 SkRect::Make(srcRect)); | 502 SkRect::Make(srcRect)); |
501 } | 503 } |
502 | 504 |
503 void apply_morphology_pass(GrDrawContext* drawContext, | 505 void apply_morphology_pass(GrDrawContext* drawContext, |
504 const GrClip& clip, | 506 const GrClip& clip, |
505 GrTexture* texture, | 507 GrTexture* texture, |
506 const SkIRect& srcRect, | 508 const SkIRect& srcRect, |
507 const SkIRect& dstRect, | 509 const SkIRect& dstRect, |
508 int radius, | 510 int radius, |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 SkBitmap* result, SkIPoint* offset) con
st { | 673 SkBitmap* result, SkIPoint* offset) con
st { |
672 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 674 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
673 } | 675 } |
674 | 676 |
675 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 677 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
676 SkBitmap* result, SkIPoint* offset) cons
t { | 678 SkBitmap* result, SkIPoint* offset) cons
t { |
677 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 679 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
678 } | 680 } |
679 | 681 |
680 #endif | 682 #endif |
OLD | NEW |