OLD | NEW |
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 |
11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
12 #include "SkBitmapController.h" | 12 #include "SkBitmapController.h" |
13 #include "SkBitmapFilter.h" | 13 #include "SkBitmapFilter.h" |
14 #include "SkBitmapProvider.h" | 14 #include "SkBitmapProvider.h" |
| 15 #include "SkFloatBits.h" |
15 #include "SkMatrix.h" | 16 #include "SkMatrix.h" |
16 #include "SkMipMap.h" | 17 #include "SkMipMap.h" |
17 #include "SkPaint.h" | 18 #include "SkPaint.h" |
18 #include "SkShader.h" | 19 #include "SkShader.h" |
19 #include "SkTemplates.h" | 20 #include "SkTemplates.h" |
20 | 21 |
21 typedef SkFixed3232 SkFractionalInt; | 22 typedef SkFixed3232 SkFractionalInt; |
22 #define SkScalarToFractionalInt(x) SkScalarToFixed3232(x) | 23 #define SkScalarToFractionalInt(x) SkScalarToFixed3232(x) |
23 #define SkFractionalIntToFixed(x) SkFixed3232ToFixed(x) | 24 #define SkFractionalIntToFixed(x) SkFixed3232ToFixed(x) |
24 #define SkFixedToFractionalInt(x) SkFixedToFixed3232(x) | 25 #define SkFixedToFractionalInt(x) SkFixedToFixed3232(x) |
25 #define SkFractionalIntToInt(x) SkFixed3232ToInt(x) | 26 #define SkFractionalIntToInt(x) SkFixed3232ToInt(x) |
26 | 27 |
| 28 // Applying a fixed point (SkFixed, SkFractionalInt) epsilon bias ensures that t
he inverse-mapped |
| 29 // bitmap coordinates are rounded consistently WRT geometry. Note that we only
have to do this |
| 30 // when the scale is positive - for negative scales we're already rounding in th
e right direction. |
| 31 static inline int bitmap_sampler_inv_bias(SkScalar scale) { |
| 32 #ifndef SK_SUPPORT_LEGACY_BITMAP_SAMPLER_BIAS |
| 33 return -(scale > 0); |
| 34 #else |
| 35 return 0; |
| 36 #endif |
| 37 } |
| 38 |
27 class SkPaint; | 39 class SkPaint; |
28 | 40 |
29 struct SkBitmapProcState { | 41 struct SkBitmapProcState { |
30 SkBitmapProcState(const SkBitmapProvider&, SkShader::TileMode tmx, SkShader:
:TileMode tmy); | 42 SkBitmapProcState(const SkBitmapProvider&, SkShader::TileMode tmx, SkShader:
:TileMode tmy); |
31 SkBitmapProcState(const SkBitmap&, SkShader::TileMode tmx, SkShader::TileMod
e tmy); | 43 SkBitmapProcState(const SkBitmap&, SkShader::TileMode tmx, SkShader::TileMod
e tmy); |
32 ~SkBitmapProcState(); | 44 ~SkBitmapProcState(); |
33 | 45 |
34 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, | 46 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, |
35 SkPMColor[], int count); | 47 SkPMColor[], int count); |
36 | 48 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 void ClampX_ClampY_filter_affine(const SkBitmapProcState& s, | 206 void ClampX_ClampY_filter_affine(const SkBitmapProcState& s, |
195 uint32_t xy[], int count, int x, int y); | 207 uint32_t xy[], int count, int x, int y); |
196 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, | 208 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, |
197 uint32_t xy[], int count, int x, int y); | 209 uint32_t xy[], int count, int x, int y); |
198 void S32_D16_filter_DX(const SkBitmapProcState& s, | 210 void S32_D16_filter_DX(const SkBitmapProcState& s, |
199 const uint32_t* xy, int count, uint16_t* colors); | 211 const uint32_t* xy, int count, uint16_t* colors); |
200 void S32_D16_filter_DXDY(const SkBitmapProcState& s, | 212 void S32_D16_filter_DXDY(const SkBitmapProcState& s, |
201 const uint32_t* xy, int count, uint16_t* colors); | 213 const uint32_t* xy, int count, uint16_t* colors); |
202 | 214 |
203 #endif | 215 #endif |
OLD | NEW |