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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 147 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
148 if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctx, &src, &srcO
ffset)) { | 148 if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctx, &src, &srcO
ffset)) { |
149 return false; | 149 return false; |
150 } | 150 } |
151 | 151 |
152 if (src.colorType() != kPMColor_SkColorType) { | 152 if (src.colorType() != kPMColor_SkColorType) { |
153 return false; | 153 return false; |
154 } | 154 } |
155 | 155 |
156 SkIRect bounds; | 156 SkIRect bounds; |
157 src.getBounds(&bounds); | 157 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &bounds, &src)) { |
158 bounds.offset(srcOffset); | |
159 if (!this->applyCropRect(&bounds, ctx.ctm())) { | |
160 return false; | 158 return false; |
161 } | 159 } |
162 | 160 |
163 SkAutoLockPixels alp(src); | 161 SkAutoLockPixels alp(src); |
164 if (!src.getPixels()) { | 162 if (!src.getPixels()) { |
165 return false; | 163 return false; |
166 } | 164 } |
167 | 165 |
168 dst->setConfig(src.config(), bounds.width(), bounds.height()); | 166 dst->setConfig(src.config(), bounds.width(), bounds.height()); |
169 dst->allocPixels(); | 167 dst->allocPixels(); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 const SkBitmap& src, | 538 const SkBitmap& src, |
541 const Context& ctx, | 539 const Context& ctx, |
542 SkBitmap* result, | 540 SkBitmap* result, |
543 SkIPoint* offset) const { | 541 SkIPoint* offset) const { |
544 SkBitmap input = src; | 542 SkBitmap input = src; |
545 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 543 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
546 if (getInput(0) && !getInput(0)->getInputResultGPU(proxy, src, ctx, &input,
&srcOffset)) { | 544 if (getInput(0) && !getInput(0)->getInputResultGPU(proxy, src, ctx, &input,
&srcOffset)) { |
547 return false; | 545 return false; |
548 } | 546 } |
549 SkIRect bounds; | 547 SkIRect bounds; |
550 input.getBounds(&bounds); | 548 if (!this->applyCropRect(ctx, proxy, input, &srcOffset, &bounds, &input)) { |
551 bounds.offset(srcOffset); | |
552 if (!this->applyCropRect(&bounds, ctx.ctm())) { | |
553 return false; | 549 return false; |
554 } | 550 } |
555 SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()), | 551 SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()), |
556 SkIntToScalar(this->radius().height())); | 552 SkIntToScalar(this->radius().height())); |
557 ctx.ctm().mapVectors(&radius, 1); | 553 ctx.ctm().mapVectors(&radius, 1); |
558 int width = SkScalarFloorToInt(radius.fX); | 554 int width = SkScalarFloorToInt(radius.fX); |
559 int height = SkScalarFloorToInt(radius.fY); | 555 int height = SkScalarFloorToInt(radius.fY); |
560 | 556 |
561 if (width < 0 || height < 0) { | 557 if (width < 0 || height < 0) { |
562 return false; | 558 return false; |
(...skipping 22 matching lines...) Expand all Loading... |
585 SkBitmap* result, SkIPoint* offset) con
st { | 581 SkBitmap* result, SkIPoint* offset) con
st { |
586 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 582 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
587 } | 583 } |
588 | 584 |
589 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 585 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
590 SkBitmap* result, SkIPoint* offset) cons
t { | 586 SkBitmap* result, SkIPoint* offset) cons
t { |
591 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 587 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
592 } | 588 } |
593 | 589 |
594 #endif | 590 #endif |
OLD | NEW |