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

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

Issue 768183002: Revert of 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
250 SkMagnifierImageFilter::SkMagnifierImageFilter(const SkRect& srcRect, SkScalar i nset, 266 SkMagnifierImageFilter::SkMagnifierImageFilter(const SkRect& srcRect, SkScalar i nset,
251 SkImageFilter* input) 267 SkImageFilter* input)
252 : INHERITED(1, &input), fSrcRect(srcRect), fInset(inset) { 268 : INHERITED(1, &input), fSrcRect(srcRect), fInset(inset) {
253 SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0); 269 SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0);
254 } 270 }
255 271
256 #if SK_SUPPORT_GPU 272 #if SK_SUPPORT_GPU
257 bool SkMagnifierImageFilter::asFragmentProcessor(GrFragmentProcessor** fp, GrTex ture* texture, 273 bool SkMagnifierImageFilter::asFragmentProcessor(GrFragmentProcessor** fp, GrTex ture* texture,
258 const SkMatrix&, const SkIRect& ) const { 274 const SkMatrix&, const SkIRect& ) const {
259 if (fp) { 275 if (fp) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 363
348 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); 364 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1);
349 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); 365 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1);
350 366
351 *dptr = sptr[y_val * width + x_val]; 367 *dptr = sptr[y_val * width + x_val];
352 dptr++; 368 dptr++;
353 } 369 }
354 } 370 }
355 return true; 371 return true;
356 } 372 }
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