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 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 return nullptr; | 512 return nullptr; |
513 } | 513 } |
514 | 514 |
515 apply_morphology_pass(dstDrawContext.get(), clip, srcTexture.get(), | 515 apply_morphology_pass(dstDrawContext.get(), clip, srcTexture.get(), |
516 srcRect, dstRect, radius.fHeight, morphType, | 516 srcRect, dstRect, radius.fHeight, morphType, |
517 Gr1DKernelEffect::kY_Direction); | 517 Gr1DKernelEffect::kY_Direction); |
518 | 518 |
519 srcTexture = dstDrawContext->asTexture(); | 519 srcTexture = dstDrawContext->asTexture(); |
520 } | 520 } |
521 | 521 |
| 522 // TODO: Get the colorSpace from the drawContext (once it has one) |
522 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(rect.width(), rect.height
()), | 523 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(rect.width(), rect.height
()), |
523 kNeedNewImageUniqueID_SpecialImage, | 524 kNeedNewImageUniqueID_SpecialImage, |
524 std::move(srcTexture), &input->props()); | 525 std::move(srcTexture), sk_ref_sp(input->g
etColorSpace()), |
| 526 &input->props()); |
525 } | 527 } |
526 #endif | 528 #endif |
527 | 529 |
528 sk_sp<SkSpecialImage> SkMorphologyImageFilter::onFilterImage(SkSpecialImage* sou
rce, | 530 sk_sp<SkSpecialImage> SkMorphologyImageFilter::onFilterImage(SkSpecialImage* sou
rce, |
529 const Context& ctx, | 531 const Context& ctx, |
530 SkIPoint* offset) c
onst { | 532 SkIPoint* offset) c
onst { |
531 SkIPoint inputOffset = SkIPoint::Make(0, 0); | 533 SkIPoint inputOffset = SkIPoint::Make(0, 0); |
532 sk_sp<SkSpecialImage> input(this->filterInput(0, source, ctx, &inputOffset))
; | 534 sk_sp<SkSpecialImage> input(this->filterInput(0, source, ctx, &inputOffset))
; |
533 if (!input) { | 535 if (!input) { |
534 return nullptr; | 536 return nullptr; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 inputBM.getAddr32(srcBounds.left(), srcBounds.top()), | 627 inputBM.getAddr32(srcBounds.left(), srcBounds.top()), |
626 inputBM.rowBytesAsPixels(), | 628 inputBM.rowBytesAsPixels(), |
627 &dst, height, srcBounds); | 629 &dst, height, srcBounds); |
628 } | 630 } |
629 offset->fX = bounds.left(); | 631 offset->fX = bounds.left(); |
630 offset->fY = bounds.top(); | 632 offset->fY = bounds.top(); |
631 | 633 |
632 return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds
.height()), | 634 return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds
.height()), |
633 dst, &source->props()); | 635 dst, &source->props()); |
634 } | 636 } |
OLD | NEW |