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

Side by Side Diff: src/core/SkBitmapFilter.cpp

Issue 85463005: remove SkFloatToScalar macro (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add flag to expose SkFloatToScalar to chromium Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkBitmapFilter.h ('k') | src/core/SkBitmapProcState.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 Google Inc. 2 * Copyright 2013 Google Inc.
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 "SkErrorInternals.h" 8 #include "SkErrorInternals.h"
9 #include "SkConvolver.h" 9 #include "SkConvolver.h"
10 #include "SkBitmapProcState.h" 10 #include "SkBitmapProcState.h"
(...skipping 13 matching lines...) Expand all
24 24
25 namespace { 25 namespace {
26 26
27 template <typename Color, typename ColorPacker> 27 template <typename Color, typename ColorPacker>
28 void highQualityFilter(ColorPacker pack, const SkBitmapProcState& s, int x, int y, Color* SK_RESTRICT colors, int count) { 28 void highQualityFilter(ColorPacker pack, const SkBitmapProcState& s, int x, int y, Color* SK_RESTRICT colors, int count) {
29 const int maxX = s.fBitmap->width() - 1; 29 const int maxX = s.fBitmap->width() - 1;
30 const int maxY = s.fBitmap->height() - 1; 30 const int maxY = s.fBitmap->height() - 1;
31 31
32 while (count-- > 0) { 32 while (count-- > 0) {
33 SkPoint srcPt; 33 SkPoint srcPt;
34 s.fInvProc(s.fInvMatrix, SkFloatToScalar(x + 0.5f), 34 s.fInvProc(s.fInvMatrix, x + 0.5f,
35 SkFloatToScalar(y + 0.5f), &srcPt); 35 y + 0.5f, &srcPt);
36 srcPt.fX -= SK_ScalarHalf; 36 srcPt.fX -= SK_ScalarHalf;
37 srcPt.fY -= SK_ScalarHalf; 37 srcPt.fY -= SK_ScalarHalf;
38 38
39 SkScalar weight = 0; 39 SkScalar weight = 0;
40 SkScalar fr = 0, fg = 0, fb = 0, fa = 0; 40 SkScalar fr = 0, fg = 0, fb = 0, fa = 0;
41 41
42 int y0 = SkClampMax(SkScalarCeilToInt(srcPt.fY-s.getBitmapFilter()->widt h()), maxY); 42 int y0 = SkClampMax(SkScalarCeilToInt(srcPt.fY-s.getBitmapFilter()->widt h()), maxY);
43 int y1 = SkClampMax(SkScalarFloorToInt(srcPt.fY+s.getBitmapFilter()->wid th()), maxY); 43 int y1 = SkClampMax(SkScalarFloorToInt(srcPt.fY+s.getBitmapFilter()->wid th()), maxY);
44 int x0 = SkClampMax(SkScalarCeilToInt(srcPt.fX-s.getBitmapFilter()->widt h()), maxX); 44 int x0 = SkClampMax(SkScalarCeilToInt(srcPt.fX-s.getBitmapFilter()->widt h()), maxX);
45 int x1 = SkClampMax(SkScalarFloorToInt(srcPt.fX+s.getBitmapFilter()->wid th()), maxX); 45 int x1 = SkClampMax(SkScalarFloorToInt(srcPt.fX+s.getBitmapFilter()->wid th()), maxX);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 if (fInvType & SkMatrix::kScale_Mask) { 141 if (fInvType & SkMatrix::kScale_Mask) {
142 fShaderProc32 = highQualityFilter32; 142 fShaderProc32 = highQualityFilter32;
143 fShaderProc16 = highQualityFilter16; 143 fShaderProc16 = highQualityFilter16;
144 return true; 144 return true;
145 } else { 145 } else {
146 return false; 146 return false;
147 } 147 }
148 } 148 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapFilter.h ('k') | src/core/SkBitmapProcState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698