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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 | 531 |
532 if (radius.fWidth > 0) { | 532 if (radius.fWidth > 0) { |
533 GrAutoScratchTexture ast(context, desc); | 533 GrAutoScratchTexture ast(context, desc); |
534 GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget()
); | 534 GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget()
); |
535 apply_morphology_pass(context, src, srcRect, dstRect, radius.fWidth, | 535 apply_morphology_pass(context, src, srcRect, dstRect, radius.fWidth, |
536 morphType, Gr1DKernelEffect::kX_Direction); | 536 morphType, Gr1DKernelEffect::kX_Direction); |
537 SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom, | 537 SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom, |
538 dstRect.width(), radius.fHeight); | 538 dstRect.width(), radius.fHeight); |
539 context->clear(&clearRect, GrMorphologyEffect::kErode_MorphologyType ==
morphType ? | 539 context->clear(&clearRect, GrMorphologyEffect::kErode_MorphologyType ==
morphType ? |
540 SK_ColorWHITE : | 540 SK_ColorWHITE : |
541 SK_ColorTRANSPARENT); | 541 SK_ColorTRANSPARENT, false); |
542 src.reset(ast.detach()); | 542 src.reset(ast.detach()); |
543 srcRect = dstRect; | 543 srcRect = dstRect; |
544 } | 544 } |
545 if (radius.fHeight > 0) { | 545 if (radius.fHeight > 0) { |
546 GrAutoScratchTexture ast(context, desc); | 546 GrAutoScratchTexture ast(context, desc); |
547 GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget()
); | 547 GrContext::AutoRenderTarget art(context, ast.texture()->asRenderTarget()
); |
548 apply_morphology_pass(context, src, srcRect, dstRect, radius.fHeight, | 548 apply_morphology_pass(context, src, srcRect, dstRect, radius.fHeight, |
549 morphType, Gr1DKernelEffect::kY_Direction); | 549 morphType, Gr1DKernelEffect::kY_Direction); |
550 src.reset(ast.detach()); | 550 src.reset(ast.detach()); |
551 } | 551 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 | 614 |
615 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { | 615 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { |
616 return false; | 616 return false; |
617 } | 617 } |
618 offset->fX += bounds.left(); | 618 offset->fX += bounds.left(); |
619 offset->fY += bounds.top(); | 619 offset->fY += bounds.top(); |
620 return true; | 620 return true; |
621 } | 621 } |
622 | 622 |
623 #endif | 623 #endif |
OLD | NEW |