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

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

Issue 769953002: Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/SkLumaColorFilter.cpp ('k') | src/effects/SkMatrixConvolutionImageFilter.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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkMagnifierImageFilter.h" 9 #include "SkMagnifierImageFilter.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 void GrMagnifierEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { 228 void GrMagnifierEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
229 this->updateInvariantOutputForModulation(inout); 229 this->updateInvariantOutputForModulation(inout);
230 } 230 }
231 231
232 #endif 232 #endif
233 233
234 //////////////////////////////////////////////////////////////////////////////// 234 ////////////////////////////////////////////////////////////////////////////////
235 235
236 SkImageFilter* SkMagnifierImageFilter::Create(const SkRect& srcRect, SkScalar in set, 236 SkImageFilter* SkMagnifierImageFilter::Create(const SkRect& srcRect, SkScalar in set,
237 SkImageFilter* input) { 237 SkImageFilter* input) {
238 238
239 if (!SkScalarIsFinite(inset) || !SkIsValidRect(srcRect)) { 239 if (!SkScalarIsFinite(inset) || !SkIsValidRect(srcRect)) {
240 return NULL; 240 return NULL;
241 } 241 }
242 // Negative numbers in src rect are not supported 242 // Negative numbers in src rect are not supported
243 if (srcRect.fLeft < 0 || srcRect.fTop < 0) { 243 if (srcRect.fLeft < 0 || srcRect.fTop < 0) {
244 return NULL; 244 return NULL;
245 } 245 }
246 return SkNEW_ARGS(SkMagnifierImageFilter, (srcRect, inset, input)); 246 return SkNEW_ARGS(SkMagnifierImageFilter, (srcRect, inset, input));
247 } 247 }
248 248
249 249
250 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
251 SkMagnifierImageFilter::SkMagnifierImageFilter(SkReadBuffer& buffer)
252 : INHERITED(1, buffer) {
253 float x = buffer.readScalar();
254 float y = buffer.readScalar();
255 float width = buffer.readScalar();
256 float height = buffer.readScalar();
257 fSrcRect = SkRect::MakeXYWH(x, y, width, height);
258 fInset = buffer.readScalar();
259
260 buffer.validate(SkScalarIsFinite(fInset) && SkIsValidRect(fSrcRect) &&
261 // Negative numbers in src rect are not supported
262 (fSrcRect.fLeft >= 0) && (fSrcRect.fTop >= 0));
263 }
264 #endif
265
266 SkMagnifierImageFilter::SkMagnifierImageFilter(const SkRect& srcRect, SkScalar i nset, 250 SkMagnifierImageFilter::SkMagnifierImageFilter(const SkRect& srcRect, SkScalar i nset,
267 SkImageFilter* input) 251 SkImageFilter* input)
268 : INHERITED(1, &input), fSrcRect(srcRect), fInset(inset) { 252 : INHERITED(1, &input), fSrcRect(srcRect), fInset(inset) {
269 SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0); 253 SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0);
270 } 254 }
271 255
272 #if SK_SUPPORT_GPU 256 #if SK_SUPPORT_GPU
273 bool SkMagnifierImageFilter::asFragmentProcessor(GrFragmentProcessor** fp, GrTex ture* texture, 257 bool SkMagnifierImageFilter::asFragmentProcessor(GrFragmentProcessor** fp, GrTex ture* texture,
274 const SkMatrix&, const SkIRect& ) const { 258 const SkMatrix&, const SkIRect& ) const {
275 if (fp) { 259 if (fp) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 347
364 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); 348 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1);
365 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); 349 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1);
366 350
367 *dptr = sptr[y_val * width + x_val]; 351 *dptr = sptr[y_val * width + x_val];
368 dptr++; 352 dptr++;
369 } 353 }
370 } 354 }
371 return true; 355 return true;
372 } 356 }
OLDNEW
« no previous file with comments | « src/effects/SkLumaColorFilter.cpp ('k') | src/effects/SkMatrixConvolutionImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698