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

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

Issue 1823573003: Change signatures of filter bounds methods to return a rect. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Hide legacy API behind #ifdef; switch callers to new API Created 4 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
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 proxy, source, ctx, dst, offset); 135 proxy, source, ctx, dst, offset);
136 } 136 }
137 137
138 bool SkDilateImageFilter::onFilterImageDeprecated(Proxy* proxy, 138 bool SkDilateImageFilter::onFilterImageDeprecated(Proxy* proxy,
139 const SkBitmap& source, const Context& ctx, 139 const SkBitmap& source, const Context& ctx,
140 SkBitmap* dst, SkIPoint* offse t) const { 140 SkBitmap* dst, SkIPoint* offse t) const {
141 return this->filterImageGeneric(SkOpts::dilate_x, SkOpts::dilate_y, 141 return this->filterImageGeneric(SkOpts::dilate_x, SkOpts::dilate_y,
142 proxy, source, ctx, dst, offset); 142 proxy, source, ctx, dst, offset);
143 } 143 }
144 144
145 void SkMorphologyImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const { 145 SkRect SkMorphologyImageFilter::computeFastBounds(const SkRect& src) const {
146 if (this->getInput(0)) { 146 SkRect bounds = this->getInput(0) ? this->getInput(0)->computeFastBounds(src ) : src;
147 this->getInput(0)->computeFastBounds(src, dst); 147 bounds.outset(SkIntToScalar(fRadius.width()), SkIntToScalar(fRadius.height() ));
148 } else { 148 return bounds;
149 *dst = src;
150 }
151 dst->outset(SkIntToScalar(fRadius.width()), SkIntToScalar(fRadius.height())) ;
152 } 149 }
153 150
154 void SkMorphologyImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMat rix& ctm, 151 SkIRect SkMorphologyImageFilter::onFilterNodeBounds(const SkIRect& src, const Sk Matrix& ctm,
155 SkIRect* dst, MapDirection) con st { 152 MapDirection) const {
156 *dst = src;
157 SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()), 153 SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()),
158 SkIntToScalar(this->radius().height())); 154 SkIntToScalar(this->radius().height()));
159 ctm.mapVectors(&radius, 1); 155 ctm.mapVectors(&radius, 1);
160 dst->outset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radius.y())); 156 return src.makeOutset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radiu s.y()));
161 } 157 }
162 158
163 SkFlattenable* SkErodeImageFilter::CreateProc(SkReadBuffer& buffer) { 159 SkFlattenable* SkErodeImageFilter::CreateProc(SkReadBuffer& buffer) {
164 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); 160 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
165 const int width = buffer.readInt(); 161 const int width = buffer.readInt();
166 const int height = buffer.readInt(); 162 const int height = buffer.readInt();
167 return Create(width, height, common.getInput(0), &common.cropRect()); 163 return Create(width, height, common.getInput(0), &common.cropRect());
168 } 164 }
169 165
170 SkFlattenable* SkDilateImageFilter::CreateProc(SkReadBuffer& buffer) { 166 SkFlattenable* SkDilateImageFilter::CreateProc(SkReadBuffer& buffer) {
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); 647 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset);
652 } 648 }
653 649
654 bool SkErodeImageFilter::filterImageGPUDeprecated(Proxy* proxy, const SkBitmap& src, 650 bool SkErodeImageFilter::filterImageGPUDeprecated(Proxy* proxy, const SkBitmap& src,
655 const Context& ctx, 651 const Context& ctx,
656 SkBitmap* result, SkIPoint* of fset) const { 652 SkBitmap* result, SkIPoint* of fset) const {
657 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); 653 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset);
658 } 654 }
659 655
660 #endif 656 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698