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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 const SkIRect& srcRect, | 465 const SkIRect& srcRect, |
466 const SkIRect& dstRect, | 466 const SkIRect& dstRect, |
467 int radius, | 467 int radius, |
468 GrMorphologyEffect::MorphologyType morphType, | 468 GrMorphologyEffect::MorphologyType morphType, |
469 Gr1DKernelEffect::Direction direction) { | 469 Gr1DKernelEffect::Direction direction) { |
470 GrPaint paint; | 470 GrPaint paint; |
471 paint.addColorEffect(GrMorphologyEffect::Create(texture, | 471 paint.addColorEffect(GrMorphologyEffect::Create(texture, |
472 direction, | 472 direction, |
473 radius, | 473 radius, |
474 morphType))->unref(); | 474 morphType))->unref(); |
475 context->drawRectToRect(paint, SkRect::MakeFromIRect(dstRect), SkRect::MakeF
romIRect(srcRect)); | 475 context->drawRectToRect(paint, SkRect::Make(dstRect), SkRect::Make(srcRect))
; |
476 } | 476 } |
477 | 477 |
478 bool apply_morphology(const SkBitmap& input, | 478 bool apply_morphology(const SkBitmap& input, |
479 const SkIRect& rect, | 479 const SkIRect& rect, |
480 GrMorphologyEffect::MorphologyType morphType, | 480 GrMorphologyEffect::MorphologyType morphType, |
481 SkISize radius, | 481 SkISize radius, |
482 SkBitmap* dst) { | 482 SkBitmap* dst) { |
483 GrTexture* srcTexture = input.getTexture(); | 483 GrTexture* srcTexture = input.getTexture(); |
484 SkASSERT(NULL != srcTexture); | 484 SkASSERT(NULL != srcTexture); |
485 GrContext* context = srcTexture->getContext(); | 485 GrContext* context = srcTexture->getContext(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 | 585 |
586 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { | 586 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { |
587 return false; | 587 return false; |
588 } | 588 } |
589 offset->fX += bounds.left(); | 589 offset->fX += bounds.left(); |
590 offset->fY += bounds.top(); | 590 offset->fY += bounds.top(); |
591 return true; | 591 return true; |
592 } | 592 } |
593 | 593 |
594 #endif | 594 #endif |
OLD | NEW |