Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: src/effects/SkMorphologyImageFilter.cpp

Issue 196353021: Revert "Implement support for expanding crop rects in image filters" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/effects/SkMergeImageFilter.cpp ('k') | src/effects/SkOffsetImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &bounds, &src)) { 157 src.getBounds(&bounds);
158 bounds.offset(srcOffset);
159 if (!this->applyCropRect(&bounds, ctx.ctm())) {
158 return false; 160 return false;
159 } 161 }
160 162
161 SkAutoLockPixels alp(src); 163 SkAutoLockPixels alp(src);
162 if (!src.getPixels()) { 164 if (!src.getPixels()) {
163 return false; 165 return false;
164 } 166 }
165 167
166 dst->setConfig(src.config(), bounds.width(), bounds.height()); 168 dst->setConfig(src.config(), bounds.width(), bounds.height());
167 dst->allocPixels(); 169 dst->allocPixels();
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 const SkBitmap& src, 540 const SkBitmap& src,
539 const Context& ctx, 541 const Context& ctx,
540 SkBitmap* result, 542 SkBitmap* result,
541 SkIPoint* offset) const { 543 SkIPoint* offset) const {
542 SkBitmap input = src; 544 SkBitmap input = src;
543 SkIPoint srcOffset = SkIPoint::Make(0, 0); 545 SkIPoint srcOffset = SkIPoint::Make(0, 0);
544 if (getInput(0) && !getInput(0)->getInputResultGPU(proxy, src, ctx, &input, &srcOffset)) { 546 if (getInput(0) && !getInput(0)->getInputResultGPU(proxy, src, ctx, &input, &srcOffset)) {
545 return false; 547 return false;
546 } 548 }
547 SkIRect bounds; 549 SkIRect bounds;
548 if (!this->applyCropRect(ctx, proxy, input, &srcOffset, &bounds, &input)) { 550 input.getBounds(&bounds);
551 bounds.offset(srcOffset);
552 if (!this->applyCropRect(&bounds, ctx.ctm())) {
549 return false; 553 return false;
550 } 554 }
551 SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()), 555 SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()),
552 SkIntToScalar(this->radius().height())); 556 SkIntToScalar(this->radius().height()));
553 ctx.ctm().mapVectors(&radius, 1); 557 ctx.ctm().mapVectors(&radius, 1);
554 int width = SkScalarFloorToInt(radius.fX); 558 int width = SkScalarFloorToInt(radius.fX);
555 int height = SkScalarFloorToInt(radius.fY); 559 int height = SkScalarFloorToInt(radius.fY);
556 560
557 if (width < 0 || height < 0) { 561 if (width < 0 || height < 0) {
558 return false; 562 return false;
(...skipping 22 matching lines...) Expand all
581 SkBitmap* result, SkIPoint* offset) con st { 585 SkBitmap* result, SkIPoint* offset) con st {
582 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); 586 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset);
583 } 587 }
584 588
585 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 589 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
586 SkBitmap* result, SkIPoint* offset) cons t { 590 SkBitmap* result, SkIPoint* offset) cons t {
587 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); 591 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset);
588 } 592 }
589 593
590 #endif 594 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMergeImageFilter.cpp ('k') | src/effects/SkOffsetImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698