| 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 desc.fConfig = kSkia8888_GrPixelConfig; | 500 desc.fConfig = kSkia8888_GrPixelConfig; |
| 501 SkIRect srcRect = rect; | 501 SkIRect srcRect = rect; |
| 502 | 502 |
| 503 if (radius.fWidth > 0) { | 503 if (radius.fWidth > 0) { |
| 504 GrAutoScratchTexture ast(context, desc); | 504 GrAutoScratchTexture ast(context, desc); |
| 505 GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget()
); | 505 GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget()
); |
| 506 apply_morphology_pass(context, src, srcRect, dstRect, radius.fWidth, | 506 apply_morphology_pass(context, src, srcRect, dstRect, radius.fWidth, |
| 507 morphType, Gr1DKernelEffect::kX_Direction); | 507 morphType, Gr1DKernelEffect::kX_Direction); |
| 508 SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom, | 508 SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom, |
| 509 dstRect.width(), radius.fHeight); | 509 dstRect.width(), radius.fHeight); |
| 510 context->clear(&clearRect, 0x0); | 510 context->clear(&clearRect, GrMorphologyEffect::kErode_MorphologyType ==
morphType ? |
| 511 SK_ColorWHITE : |
| 512 SK_ColorTRANSPARENT); |
| 511 src.reset(ast.detach()); | 513 src.reset(ast.detach()); |
| 512 srcRect = dstRect; | 514 srcRect = dstRect; |
| 513 } | 515 } |
| 514 if (radius.fHeight > 0) { | 516 if (radius.fHeight > 0) { |
| 515 GrAutoScratchTexture ast(context, desc); | 517 GrAutoScratchTexture ast(context, desc); |
| 516 GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget()
); | 518 GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget()
); |
| 517 apply_morphology_pass(context, src, srcRect, dstRect, radius.fHeight, | 519 apply_morphology_pass(context, src, srcRect, dstRect, radius.fHeight, |
| 518 morphType, Gr1DKernelEffect::kY_Direction); | 520 morphType, Gr1DKernelEffect::kY_Direction); |
| 519 src.reset(ast.detach()); | 521 src.reset(ast.detach()); |
| 520 } | 522 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 | 585 |
| 584 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { | 586 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { |
| 585 return false; | 587 return false; |
| 586 } | 588 } |
| 587 offset->fX += bounds.left(); | 589 offset->fX += bounds.left(); |
| 588 offset->fY += bounds.top(); | 590 offset->fY += bounds.top(); |
| 589 return true; | 591 return true; |
| 590 } | 592 } |
| 591 | 593 |
| 592 #endif | 594 #endif |
| OLD | NEW |