| 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 const SkIRect& srcRect, | 475 const SkIRect& srcRect, |
| 476 const SkIRect& dstRect, | 476 const SkIRect& dstRect, |
| 477 int radius, | 477 int radius, |
| 478 GrMorphologyEffect::MorphologyType morphType, | 478 GrMorphologyEffect::MorphologyType morphType, |
| 479 Gr1DKernelEffect::Direction direction) { | 479 Gr1DKernelEffect::Direction direction) { |
| 480 GrPaint paint; | 480 GrPaint paint; |
| 481 paint.addColorProcessor(GrMorphologyEffect::Create(texture, | 481 paint.addColorProcessor(GrMorphologyEffect::Create(texture, |
| 482 direction, | 482 direction, |
| 483 radius, | 483 radius, |
| 484 morphType))->unref(); | 484 morphType))->unref(); |
| 485 context->drawRectToRect(paint, SkRect::Make(dstRect), SkRect::Make(srcRect))
; | 485 context->drawRectToRect(paint, SkMatrix::I(), SkRect::Make(dstRect), |
| 486 SkRect::Make(srcRect)); |
| 486 } | 487 } |
| 487 | 488 |
| 488 bool apply_morphology(const SkBitmap& input, | 489 bool apply_morphology(const SkBitmap& input, |
| 489 const SkIRect& rect, | 490 const SkIRect& rect, |
| 490 GrMorphologyEffect::MorphologyType morphType, | 491 GrMorphologyEffect::MorphologyType morphType, |
| 491 SkISize radius, | 492 SkISize radius, |
| 492 SkBitmap* dst) { | 493 SkBitmap* dst) { |
| 493 SkAutoTUnref<GrTexture> srcTexture(SkRef(input.getTexture())); | 494 SkAutoTUnref<GrTexture> srcTexture(SkRef(input.getTexture())); |
| 494 SkASSERT(srcTexture); | 495 SkASSERT(srcTexture); |
| 495 GrContext* context = srcTexture->getContext(); | 496 GrContext* context = srcTexture->getContext(); |
| 496 | 497 |
| 497 GrContext::AutoMatrix am; | |
| 498 am.setIdentity(context); | |
| 499 | |
| 500 GrContext::AutoClip acs(context, SkRect::MakeWH(SkIntToScalar(srcTexture->wi
dth()), | 498 GrContext::AutoClip acs(context, SkRect::MakeWH(SkIntToScalar(srcTexture->wi
dth()), |
| 501 SkIntToScalar(srcTexture->he
ight()))); | 499 SkIntToScalar(srcTexture->he
ight()))); |
| 502 | 500 |
| 503 SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height()); | 501 SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height()); |
| 504 GrSurfaceDesc desc; | 502 GrSurfaceDesc desc; |
| 505 desc.fFlags = kRenderTarget_GrSurfaceFlag | kNoStencil_GrSurfaceFlag; | 503 desc.fFlags = kRenderTarget_GrSurfaceFlag | kNoStencil_GrSurfaceFlag; |
| 506 desc.fWidth = rect.width(); | 504 desc.fWidth = rect.width(); |
| 507 desc.fHeight = rect.height(); | 505 desc.fHeight = rect.height(); |
| 508 desc.fConfig = kSkia8888_GrPixelConfig; | 506 desc.fConfig = kSkia8888_GrPixelConfig; |
| 509 SkIRect srcRect = rect; | 507 SkIRect srcRect = rect; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 SkBitmap* result, SkIPoint* offset) con
st { | 587 SkBitmap* result, SkIPoint* offset) con
st { |
| 590 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 588 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
| 591 } | 589 } |
| 592 | 590 |
| 593 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 591 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
| 594 SkBitmap* result, SkIPoint* offset) cons
t { | 592 SkBitmap* result, SkIPoint* offset) cons
t { |
| 595 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 593 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
| 596 } | 594 } |
| 597 | 595 |
| 598 #endif | 596 #endif |
| OLD | NEW |