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

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

Issue 1314583003: Replace SkPin32 with SkTPin and remove. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comment. Created 5 years, 3 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/core/SkString.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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 SkScalar sqDist = SkMinScalar(SkScalarSquare(x_dist), 354 SkScalar sqDist = SkMinScalar(SkScalarSquare(x_dist),
355 SkScalarSquare(y_dist)); 355 SkScalarSquare(y_dist));
356 weight = SkMinScalar(sqDist, SK_Scalar1); 356 weight = SkMinScalar(sqDist, SK_Scalar1);
357 } 357 }
358 358
359 SkScalar x_interp = SkScalarMul(weight, (fSrcRect.x() + x * inv_x_zo om)) + 359 SkScalar x_interp = SkScalarMul(weight, (fSrcRect.x() + x * inv_x_zo om)) +
360 (SK_Scalar1 - weight) * x; 360 (SK_Scalar1 - weight) * x;
361 SkScalar y_interp = SkScalarMul(weight, (fSrcRect.y() + y * inv_y_zo om)) + 361 SkScalar y_interp = SkScalarMul(weight, (fSrcRect.y() + y * inv_y_zo om)) +
362 (SK_Scalar1 - weight) * y; 362 (SK_Scalar1 - weight) * y;
363 363
364 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); 364 int x_val = SkTPin(SkScalarFloorToInt(x_interp), 0, width - 1);
365 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); 365 int y_val = SkTPin(SkScalarFloorToInt(y_interp), 0, height - 1);
366 366
367 *dptr = sptr[y_val * width + x_val]; 367 *dptr = sptr[y_val * width + x_val];
368 dptr++; 368 dptr++;
369 } 369 }
370 } 370 }
371 return true; 371 return true;
372 } 372 }
373 373
374 #ifndef SK_IGNORE_TO_STRING 374 #ifndef SK_IGNORE_TO_STRING
375 void SkMagnifierImageFilter::toString(SkString* str) const { 375 void SkMagnifierImageFilter::toString(SkString* str) const {
376 str->appendf("SkMagnifierImageFilter: ("); 376 str->appendf("SkMagnifierImageFilter: (");
377 str->appendf("src: (%f,%f,%f,%f) ", 377 str->appendf("src: (%f,%f,%f,%f) ",
378 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m); 378 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m);
379 str->appendf("inset: %f", fInset); 379 str->appendf("inset: %f", fInset);
380 str->append(")"); 380 str->append(")");
381 } 381 }
382 #endif 382 #endif
OLDNEW
« no previous file with comments | « src/core/SkString.cpp ('k') | src/effects/SkMatrixConvolutionImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698