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

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

Issue 148883011: Make SkImageFilter methods const. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More fixes to gm/ Created 6 years, 10 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
« no previous file with comments | « src/effects/SkAlphaThresholdFilter.cpp ('k') | src/effects/SkBitmapSource.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 2013 The Android Open Source Project 2 * Copyright 2013 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 "SkBicubicImageFilter.h" 8 #include "SkBicubicImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return SkPackARGB32(SkScalarRoundToInt(a), 78 return SkPackARGB32(SkScalarRoundToInt(a),
79 SkScalarRoundToInt(SkScalarClampMax(r, a)), 79 SkScalarRoundToInt(SkScalarClampMax(r, a)),
80 SkScalarRoundToInt(SkScalarClampMax(g, a)), 80 SkScalarRoundToInt(SkScalarClampMax(g, a)),
81 SkScalarRoundToInt(SkScalarClampMax(b, a))); 81 SkScalarRoundToInt(SkScalarClampMax(b, a)));
82 } 82 }
83 83
84 bool SkBicubicImageFilter::onFilterImage(Proxy* proxy, 84 bool SkBicubicImageFilter::onFilterImage(Proxy* proxy,
85 const SkBitmap& source, 85 const SkBitmap& source,
86 const SkMatrix& matrix, 86 const SkMatrix& matrix,
87 SkBitmap* result, 87 SkBitmap* result,
88 SkIPoint* offset) { 88 SkIPoint* offset) const {
89 SkBitmap src = source; 89 SkBitmap src = source;
90 SkIPoint srcOffset = SkIPoint::Make(0, 0); 90 SkIPoint srcOffset = SkIPoint::Make(0, 0);
91 if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, &s rcOffset)) { 91 if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, &s rcOffset)) {
92 return false; 92 return false;
93 } 93 }
94 94
95 if (src.config() != SkBitmap::kARGB_8888_Config) { 95 if (src.config() != SkBitmap::kARGB_8888_Config) {
96 return false; 96 return false;
97 } 97 }
98 98
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 offset->fX = dstIRect.fLeft; 163 offset->fX = dstIRect.fLeft;
164 offset->fY = dstIRect.fTop; 164 offset->fY = dstIRect.fTop;
165 return true; 165 return true;
166 } 166 }
167 167
168 /////////////////////////////////////////////////////////////////////////////// 168 ///////////////////////////////////////////////////////////////////////////////
169 169
170 #if SK_SUPPORT_GPU 170 #if SK_SUPPORT_GPU
171 171
172 bool SkBicubicImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, con st SkMatrix& ctm, 172 bool SkBicubicImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, con st SkMatrix& ctm,
173 SkBitmap* result, SkIPoint* offset) { 173 SkBitmap* result, SkIPoint* offset) co nst {
174 SkBitmap srcBM; 174 SkBitmap srcBM;
175 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &sr cBM, offset)) { 175 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &sr cBM, offset)) {
176 return false; 176 return false;
177 } 177 }
178 GrTexture* srcTexture = srcBM.getTexture(); 178 GrTexture* srcTexture = srcBM.getTexture();
179 GrContext* context = srcTexture->getContext(); 179 GrContext* context = srcTexture->getContext();
180 180
181 SkRect dstRect = SkRect::MakeWH(srcBM.width() * fScale.fWidth, 181 SkRect dstRect = SkRect::MakeWH(srcBM.width() * fScale.fWidth,
182 srcBM.height() * fScale.fHeight); 182 srcBM.height() * fScale.fHeight);
183 183
(...skipping 12 matching lines...) Expand all
196 GrPaint paint; 196 GrPaint paint;
197 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref(); 197 paint.addColorEffect(GrBicubicEffect::Create(srcTexture, fCoefficients))->un ref();
198 SkRect srcRect; 198 SkRect srcRect;
199 srcBM.getBounds(&srcRect); 199 srcBM.getBounds(&srcRect);
200 context->drawRectToRect(paint, dstRect, srcRect); 200 context->drawRectToRect(paint, dstRect, srcRect);
201 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul t); 201 return SkImageFilterUtils::WrapTexture(dst, desc.fWidth, desc.fHeight, resul t);
202 } 202 }
203 #endif 203 #endif
204 204
205 /////////////////////////////////////////////////////////////////////////////// 205 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/effects/SkAlphaThresholdFilter.cpp ('k') | src/effects/SkBitmapSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698