| 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 | 9 |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 | 471 |
| 472 static sk_sp<SkSpecialImage> apply_morphology(GrContext* context, | 472 static sk_sp<SkSpecialImage> apply_morphology(GrContext* context, |
| 473 SkSpecialImage* input, | 473 SkSpecialImage* input, |
| 474 const SkIRect& rect, | 474 const SkIRect& rect, |
| 475 GrMorphologyEffect::MorphologyType
morphType, | 475 GrMorphologyEffect::MorphologyType
morphType, |
| 476 SkISize radius) { | 476 SkISize radius) { |
| 477 sk_sp<GrTexture> srcTexture(input->asTextureRef(context)); | 477 sk_sp<GrTexture> srcTexture(input->asTextureRef(context)); |
| 478 SkASSERT(srcTexture); | 478 SkASSERT(srcTexture); |
| 479 | 479 |
| 480 // setup new clip | 480 // setup new clip |
| 481 const GrClip clip(SkRect::MakeWH(SkIntToScalar(srcTexture->width()), | 481 const GrFixedClip clip(SkIRect::MakeWH(srcTexture->width(), srcTexture->heig
ht())); |
| 482 SkIntToScalar(srcTexture->height()))); | |
| 483 | 482 |
| 484 const SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height()); | 483 const SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height()); |
| 485 SkIRect srcRect = rect; | 484 SkIRect srcRect = rect; |
| 486 | 485 |
| 487 SkASSERT(radius.width() > 0 || radius.height() > 0); | 486 SkASSERT(radius.width() > 0 || radius.height() > 0); |
| 488 | 487 |
| 489 if (radius.fWidth > 0) { | 488 if (radius.fWidth > 0) { |
| 490 sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(SkBackingFit
::kApprox, | 489 sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(SkBackingFit
::kApprox, |
| 491 rect.width()
, rect.height(), | 490 rect.width()
, rect.height(), |
| 492 kSkia8888_Gr
PixelConfig)); | 491 kSkia8888_Gr
PixelConfig)); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 inputBM.getAddr32(srcBounds.left(), srcBounds.top()), | 627 inputBM.getAddr32(srcBounds.left(), srcBounds.top()), |
| 629 inputBM.rowBytesAsPixels(), | 628 inputBM.rowBytesAsPixels(), |
| 630 &dst, height, srcBounds); | 629 &dst, height, srcBounds); |
| 631 } | 630 } |
| 632 offset->fX = bounds.left(); | 631 offset->fX = bounds.left(); |
| 633 offset->fY = bounds.top(); | 632 offset->fY = bounds.top(); |
| 634 | 633 |
| 635 return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds
.height()), | 634 return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds
.height()), |
| 636 dst, &source->props()); | 635 dst, &source->props()); |
| 637 } | 636 } |
| OLD | NEW |