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