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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 apply_morphology_pass(context, srcTexture, rect, radius.fHeight, | 495 apply_morphology_pass(context, srcTexture, rect, radius.fHeight, |
496 morphType, Gr1DKernelEffect::kY_Direction); | 496 morphType, Gr1DKernelEffect::kY_Direction); |
497 srcTexture->unref(); | 497 srcTexture->unref(); |
498 srcTexture = ast.detach(); | 498 srcTexture = ast.detach(); |
499 } | 499 } |
500 return srcTexture; | 500 return srcTexture; |
501 } | 501 } |
502 | 502 |
503 }; | 503 }; |
504 | 504 |
505 bool SkDilateImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkBi
tmap* result, | 505 bool SkDilateImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, cons
t SkMatrix& ctm, |
506 SkIPoint* offset) { | 506 SkBitmap* result, SkIPoint* offset) { |
507 SkBitmap inputBM; | 507 SkBitmap inputBM; |
508 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, &inputBM
, offset)) { | 508 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &in
putBM, offset)) { |
509 return false; | 509 return false; |
510 } | 510 } |
511 GrTexture* input = inputBM.getTexture(); | 511 GrTexture* input = inputBM.getTexture(); |
512 SkIRect bounds; | 512 SkIRect bounds; |
513 src.getBounds(&bounds); | 513 src.getBounds(&bounds); |
514 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, | 514 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, |
515 GrMorphologyEffect::kDilate_MorphologyType, radius())); | 515 GrMorphologyEffect::kDilate_MorphologyType, radius())); |
516 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); | 516 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); |
517 } | 517 } |
518 | 518 |
519 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkBit
map* result, | 519 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
SkMatrix& ctm, |
520 SkIPoint* offset) { | 520 SkBitmap* result, SkIPoint* offset) { |
521 SkBitmap inputBM; | 521 SkBitmap inputBM; |
522 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, &inputBM
, offset)) { | 522 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &in
putBM, offset)) { |
523 return false; | 523 return false; |
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 |