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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 const SkIRect& srcRect, | 494 const SkIRect& srcRect, |
495 const SkIRect& dstRect, | 495 const SkIRect& dstRect, |
496 int radius, | 496 int radius, |
497 GrMorphologyEffect::MorphologyType morphType, | 497 GrMorphologyEffect::MorphologyType morphType, |
498 Gr1DKernelEffect::Direction direction) { | 498 Gr1DKernelEffect::Direction direction) { |
499 GrPaint paint; | 499 GrPaint paint; |
500 paint.addColorEffect(GrMorphologyEffect::Create(texture, | 500 paint.addColorEffect(GrMorphologyEffect::Create(texture, |
501 direction, | 501 direction, |
502 radius, | 502 radius, |
503 morphType))->unref(); | 503 morphType))->unref(); |
504 context->drawRectToRect(paint, SkRect::MakeFromIRect(dstRect), SkRect::MakeF
romIRect(srcRect)); | 504 context->drawRectToRect(paint, SkRect::Make(dstRect), SkRect::Make(srcRect))
; |
505 } | 505 } |
506 | 506 |
507 bool apply_morphology(const SkBitmap& input, | 507 bool apply_morphology(const SkBitmap& input, |
508 const SkIRect& rect, | 508 const SkIRect& rect, |
509 GrMorphologyEffect::MorphologyType morphType, | 509 GrMorphologyEffect::MorphologyType morphType, |
510 SkISize radius, | 510 SkISize radius, |
511 SkBitmap* dst) { | 511 SkBitmap* dst) { |
512 GrTexture* srcTexture = input.getTexture(); | 512 GrTexture* srcTexture = input.getTexture(); |
513 SkASSERT(NULL != srcTexture); | 513 SkASSERT(NULL != srcTexture); |
514 GrContext* context = srcTexture->getContext(); | 514 GrContext* context = srcTexture->getContext(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 | 614 |
615 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { | 615 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { |
616 return false; | 616 return false; |
617 } | 617 } |
618 offset->fX += bounds.left(); | 618 offset->fX += bounds.left(); |
619 offset->fY += bounds.top(); | 619 offset->fY += bounds.top(); |
620 return true; | 620 return true; |
621 } | 621 } |
622 | 622 |
623 #endif | 623 #endif |
OLD | NEW |