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

Side by Side Diff: src/core/SkBitmapProcState.h

Issue 1568893002: Remove SK_SUPPORT_LEGACY_BITMAP_SAMPLER_BIAS (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | no next file » | 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 2007 The Android Open Source Project 2 * Copyright 2007 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 #ifndef SkBitmapProcState_DEFINED 8 #ifndef SkBitmapProcState_DEFINED
9 #define SkBitmapProcState_DEFINED 9 #define SkBitmapProcState_DEFINED
10 10
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // Helper class for mapping the middle of pixel (x, y) into SkFractionalInt bitm ap space. 191 // Helper class for mapping the middle of pixel (x, y) into SkFractionalInt bitm ap space.
192 // TODO: filtered version which applies a fFilterOne{X,Y}/2 bias instead of epsi lon? 192 // TODO: filtered version which applies a fFilterOne{X,Y}/2 bias instead of epsi lon?
193 class SkBitmapProcStateAutoMapper { 193 class SkBitmapProcStateAutoMapper {
194 public: 194 public:
195 SkBitmapProcStateAutoMapper(const SkBitmapProcState& s, int x, int y) { 195 SkBitmapProcStateAutoMapper(const SkBitmapProcState& s, int x, int y) {
196 SkPoint pt; 196 SkPoint pt;
197 s.fInvProc(s.fInvMatrix, 197 s.fInvProc(s.fInvMatrix,
198 SkIntToScalar(x) + SK_ScalarHalf, 198 SkIntToScalar(x) + SK_ScalarHalf,
199 SkIntToScalar(y) + SK_ScalarHalf, &pt); 199 SkIntToScalar(y) + SK_ScalarHalf, &pt);
200 200
201 #ifndef SK_SUPPORT_LEGACY_BITMAP_SAMPLER_BIAS
202 // SkFixed epsilon bias to ensure inverse-mapped bitmap coordinates are rounded 201 // SkFixed epsilon bias to ensure inverse-mapped bitmap coordinates are rounded
203 // consistently WRT geometry. Note that we only need the bias for posit ive scales: 202 // consistently WRT geometry. Note that we only need the bias for posit ive scales:
204 // for negative scales, the rounding is intrinsically correct. 203 // for negative scales, the rounding is intrinsically correct.
205 // We scale it to persist SkFractionalInt -> SkFixed conversions. 204 // We scale it to persist SkFractionalInt -> SkFixed conversions.
206 fX = SkScalarToFractionalInt(pt.x()) - SkFixedToFractionalInt(s.fInvMatr ix.getScaleX() > 0); 205 const SkFixed biasX = (s.fInvMatrix.getScaleX() > 0);
207 fY = SkScalarToFractionalInt(pt.y()) - SkFixedToFractionalInt(s.fInvMatr ix.getScaleY() > 0); 206 const SkFixed biasY = (s.fInvMatrix.getScaleY() > 0);
208 #else 207 fX = SkScalarToFractionalInt(pt.x()) - SkFixedToFractionalInt(biasX);
209 fX = SkScalarToFractionalInt(pt.x()); 208 fY = SkScalarToFractionalInt(pt.y()) - SkFixedToFractionalInt(biasY);
210 fY = SkScalarToFractionalInt(pt.y());
211 #endif
212 } 209 }
213 210
214 SkFractionalInt x() const { return fX; } 211 SkFractionalInt x() const { return fX; }
215 SkFractionalInt y() const { return fY; } 212 SkFractionalInt y() const { return fY; }
216 213
217 private: 214 private:
218 SkFractionalInt fX, fY; 215 SkFractionalInt fX, fY;
219 }; 216 };
220 217
221 #endif 218 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698