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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 GrTexture* apply_morphology(GrTexture* srcTexture, | 462 GrTexture* apply_morphology(GrTexture* srcTexture, |
463 const SkIRect& rect, | 463 const SkIRect& rect, |
464 GrMorphologyEffect::MorphologyType morphType, | 464 GrMorphologyEffect::MorphologyType morphType, |
465 SkISize radius) { | 465 SkISize radius) { |
466 GrContext* context = srcTexture->getContext(); | 466 GrContext* context = srcTexture->getContext(); |
467 srcTexture->ref(); | 467 srcTexture->ref(); |
468 | 468 |
469 GrContext::AutoMatrix am; | 469 GrContext::AutoMatrix am; |
470 am.setIdentity(context); | 470 am.setIdentity(context); |
471 | 471 |
472 GrContext::AutoClip acs(context, GrRect::MakeWH(SkIntToScalar(srcTexture->wi
dth()), | 472 GrContext::AutoClip acs(context, SkRect::MakeWH(SkIntToScalar(srcTexture->wi
dth()), |
473 SkIntToScalar(srcTexture->he
ight()))); | 473 SkIntToScalar(srcTexture->he
ight()))); |
474 | 474 |
475 GrTextureDesc desc; | 475 GrTextureDesc desc; |
476 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; | 476 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; |
477 desc.fWidth = rect.width(); | 477 desc.fWidth = rect.width(); |
478 desc.fHeight = rect.height(); | 478 desc.fHeight = rect.height(); |
479 desc.fConfig = kSkia8888_GrPixelConfig; | 479 desc.fConfig = kSkia8888_GrPixelConfig; |
480 | 480 |
481 if (radius.fWidth > 0) { | 481 if (radius.fWidth > 0) { |
482 GrAutoScratchTexture ast(context, desc); | 482 GrAutoScratchTexture ast(context, desc); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 } | 524 } |
525 GrTexture* input = inputBM.getTexture(); | 525 GrTexture* input = inputBM.getTexture(); |
526 SkIRect bounds; | 526 SkIRect bounds; |
527 src.getBounds(&bounds); | 527 src.getBounds(&bounds); |
528 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, | 528 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, |
529 GrMorphologyEffect::kErode_MorphologyType, radius())); | 529 GrMorphologyEffect::kErode_MorphologyType, radius())); |
530 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); | 530 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); |
531 } | 531 } |
532 | 532 |
533 #endif | 533 #endif |
OLD | NEW |