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, SkBi
tmap* result, |
| 506 SkIPoint* offset) { |
506 SkBitmap inputBM; | 507 SkBitmap inputBM; |
507 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, &inputBM
)) { | 508 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, &inputBM
, offset)) { |
508 return false; | 509 return false; |
509 } | 510 } |
510 GrTexture* input = inputBM.getTexture(); | 511 GrTexture* input = inputBM.getTexture(); |
511 SkIRect bounds; | 512 SkIRect bounds; |
512 src.getBounds(&bounds); | 513 src.getBounds(&bounds); |
513 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, | 514 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, |
514 GrMorphologyEffect::kDilate_MorphologyType, radius())); | 515 GrMorphologyEffect::kDilate_MorphologyType, radius())); |
515 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); | 516 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); |
516 } | 517 } |
517 | 518 |
518 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkBit
map* result) { | 519 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkBit
map* result, |
| 520 SkIPoint* offset) { |
519 SkBitmap inputBM; | 521 SkBitmap inputBM; |
520 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, &inputBM
)) { | 522 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, &inputBM
, offset)) { |
521 return false; | 523 return false; |
522 } | 524 } |
523 GrTexture* input = inputBM.getTexture(); | 525 GrTexture* input = inputBM.getTexture(); |
524 SkIRect bounds; | 526 SkIRect bounds; |
525 src.getBounds(&bounds); | 527 src.getBounds(&bounds); |
526 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, | 528 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, |
527 GrMorphologyEffect::kErode_MorphologyType, radius())); | 529 GrMorphologyEffect::kErode_MorphologyType, radius())); |
528 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); | 530 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); |
529 } | 531 } |
530 | 532 |
531 #endif | 533 #endif |
OLD | NEW |