| 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 if (radius.fWidth > 0) { | 523 if (radius.fWidth > 0) { |
| 524 GrTexture* texture = context->refScratchTexture(desc, GrContext::kApprox
_ScratchTexMatch); | 524 GrTexture* texture = context->refScratchTexture(desc, GrContext::kApprox
_ScratchTexMatch); |
| 525 if (NULL == texture) { | 525 if (NULL == texture) { |
| 526 return false; | 526 return false; |
| 527 } | 527 } |
| 528 GrContext::AutoRenderTarget art(context, texture->asRenderTarget()); | 528 GrContext::AutoRenderTarget art(context, texture->asRenderTarget()); |
| 529 apply_morphology_pass(context, srcTexture, srcRect, dstRect, radius.fWid
th, | 529 apply_morphology_pass(context, srcTexture, srcRect, dstRect, radius.fWid
th, |
| 530 morphType, Gr1DKernelEffect::kX_Direction); | 530 morphType, Gr1DKernelEffect::kX_Direction); |
| 531 SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom, | 531 SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom, |
| 532 dstRect.width(), radius.fHeight); | 532 dstRect.width(), radius.fHeight); |
| 533 context->clear(&clearRect, GrMorphologyEffect::kErode_MorphologyType ==
morphType ? | 533 GrColor clearColor = GrMorphologyEffect::kErode_MorphologyType == morphT
ype ? |
| 534 SK_ColorWHITE : | 534 SK_ColorWHITE : |
| 535 SK_ColorTRANSPARENT, false); | 535 SK_ColorTRANSPARENT; |
| 536 context->clear(&clearRect, clearColor, false, texture->asRenderTarget())
; |
| 536 srcTexture.reset(texture); | 537 srcTexture.reset(texture); |
| 537 srcRect = dstRect; | 538 srcRect = dstRect; |
| 538 } | 539 } |
| 539 if (radius.fHeight > 0) { | 540 if (radius.fHeight > 0) { |
| 540 GrTexture* texture = context->refScratchTexture(desc, GrContext::kApprox
_ScratchTexMatch); | 541 GrTexture* texture = context->refScratchTexture(desc, GrContext::kApprox
_ScratchTexMatch); |
| 541 if (NULL == texture) { | 542 if (NULL == texture) { |
| 542 return false; | 543 return false; |
| 543 } | 544 } |
| 544 GrContext::AutoRenderTarget art(context, texture->asRenderTarget()); | 545 GrContext::AutoRenderTarget art(context, texture->asRenderTarget()); |
| 545 apply_morphology_pass(context, srcTexture, srcRect, dstRect, radius.fHei
ght, | 546 apply_morphology_pass(context, srcTexture, srcRect, dstRect, radius.fHei
ght, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 SkBitmap* result, SkIPoint* offset) con
st { | 601 SkBitmap* result, SkIPoint* offset) con
st { |
| 601 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 602 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
| 602 } | 603 } |
| 603 | 604 |
| 604 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 605 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
| 605 SkBitmap* result, SkIPoint* offset) cons
t { | 606 SkBitmap* result, SkIPoint* offset) cons
t { |
| 606 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 607 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
| 607 } | 608 } |
| 608 | 609 |
| 609 #endif | 610 #endif |
| OLD | NEW |