Chromium Code Reviews| 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 ? -1 : 0; | |
|
reed1
2015/12/14 21:50:07
seems like this >= version might be faster (certai
f(malita)
2015/12/15 14:34:13
Done.
| |
| 34 return (static_cast<uint32_t>(SkFloat2Bits(SkScalarToFloat(scale))) >> 31) - 1; | |
| 35 #else | |
| 36 return 0; | |
| 37 #endif | |
| 38 } | |
| 39 | |
| 27 class SkPaint; | 40 class SkPaint; |
| 28 | 41 |
| 29 struct SkBitmapProcState { | 42 struct SkBitmapProcState { |
| 30 SkBitmapProcState(const SkBitmapProvider&, SkShader::TileMode tmx, SkShader: :TileMode tmy); | 43 SkBitmapProcState(const SkBitmapProvider&, SkShader::TileMode tmx, SkShader: :TileMode tmy); |
| 31 SkBitmapProcState(const SkBitmap&, SkShader::TileMode tmx, SkShader::TileMod e tmy); | 44 SkBitmapProcState(const SkBitmap&, SkShader::TileMode tmx, SkShader::TileMod e tmy); |
| 32 ~SkBitmapProcState(); | 45 ~SkBitmapProcState(); |
| 33 | 46 |
| 34 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, | 47 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, |
| 35 SkPMColor[], int count); | 48 SkPMColor[], int count); |
| 36 | 49 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 void ClampX_ClampY_filter_affine(const SkBitmapProcState& s, | 207 void ClampX_ClampY_filter_affine(const SkBitmapProcState& s, |
| 195 uint32_t xy[], int count, int x, int y); | 208 uint32_t xy[], int count, int x, int y); |
| 196 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, | 209 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, |
| 197 uint32_t xy[], int count, int x, int y); | 210 uint32_t xy[], int count, int x, int y); |
| 198 void S32_D16_filter_DX(const SkBitmapProcState& s, | 211 void S32_D16_filter_DX(const SkBitmapProcState& s, |
| 199 const uint32_t* xy, int count, uint16_t* colors); | 212 const uint32_t* xy, int count, uint16_t* colors); |
| 200 void S32_D16_filter_DXDY(const SkBitmapProcState& s, | 213 void S32_D16_filter_DXDY(const SkBitmapProcState& s, |
| 201 const uint32_t* xy, int count, uint16_t* colors); | 214 const uint32_t* xy, int count, uint16_t* colors); |
| 202 | 215 |
| 203 #endif | 216 #endif |
| OLD | NEW |