OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2007 The Android Open Source Project | 3 * Copyright 2007 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkBitmapProcState_DEFINED | 10 #ifndef SkBitmapProcState_DEFINED |
(...skipping 13 matching lines...) Expand all Loading... |
24 #define SkFractionalIntToInt(x) SkFixed48ToInt(x) | 24 #define SkFractionalIntToInt(x) SkFixed48ToInt(x) |
25 #else | 25 #else |
26 typedef SkFixed SkFractionalInt; | 26 typedef SkFixed SkFractionalInt; |
27 #define SkScalarToFractionalInt(x) SkScalarToFixed(x) | 27 #define SkScalarToFractionalInt(x) SkScalarToFixed(x) |
28 #define SkFractionalIntToFixed(x) (x) | 28 #define SkFractionalIntToFixed(x) (x) |
29 #define SkFixedToFractionalInt(x) (x) | 29 #define SkFixedToFractionalInt(x) (x) |
30 #define SkFractionalIntToInt(x) ((x) >> 16) | 30 #define SkFractionalIntToInt(x) ((x) >> 16) |
31 #endif | 31 #endif |
32 | 32 |
33 class SkPaint; | 33 class SkPaint; |
| 34 class SkConvolutionProcs; |
34 | 35 |
35 struct SkBitmapProcState { | 36 struct SkBitmapProcState { |
36 | 37 |
37 SkBitmapProcState(): fBitmapFilter(NULL) {} | 38 SkBitmapProcState(): fBitmapFilter(NULL) {} |
38 ~SkBitmapProcState() { | 39 ~SkBitmapProcState() { |
39 SkDELETE(fBitmapFilter); | 40 SkDELETE(fBitmapFilter); |
40 } | 41 } |
41 | 42 |
42 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, | 43 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, |
43 SkPMColor[], int count); | 44 SkPMColor[], int count); |
44 | 45 |
45 typedef void (*ShaderProc16)(const SkBitmapProcState&, int x, int y, | 46 typedef void (*ShaderProc16)(const SkBitmapProcState&, int x, int y, |
46 uint16_t[], int count); | 47 uint16_t[], int count); |
47 | 48 |
48 typedef void (*MatrixProc)(const SkBitmapProcState&, | 49 typedef void (*MatrixProc)(const SkBitmapProcState&, |
49 uint32_t bitmapXY[], | 50 uint32_t bitmapXY[], |
50 int count, | 51 int count, |
51 int x, int y); | 52 int x, int y); |
52 | 53 |
53 typedef void (*SampleProc32)(const SkBitmapProcState&, | 54 typedef void (*SampleProc32)(const SkBitmapProcState&, |
54 const uint32_t[], | 55 const uint32_t[], |
55 int count, | 56 int count, |
56 SkPMColor colors[]); | 57 SkPMColor colors[]); |
57 | 58 |
58 typedef void (*SampleProc16)(const SkBitmapProcState&, | 59 typedef void (*SampleProc16)(const SkBitmapProcState&, |
59 const uint32_t[], | 60 const uint32_t[], |
60 int count, | 61 int count, |
61 uint16_t colors[]); | 62 uint16_t colors[]); |
62 | 63 |
63 typedef U16CPU (*FixedTileProc)(SkFixed); // returns 0..0xFFFF | 64 typedef U16CPU (*FixedTileProc)(SkFixed); // returns 0..0xFFFF |
64 typedef U16CPU (*FixedTileLowBitsProc)(SkFixed, int); // returns 0..0xF | 65 typedef U16CPU (*FixedTileLowBitsProc)(SkFixed, int); // returns 0..0xF |
65 typedef U16CPU (*IntTileProc)(int value, int count); // returns 0..count-1 | 66 typedef U16CPU (*IntTileProc)(int value, int count); // returns 0..count-1 |
66 | 67 |
67 const SkBitmap* fBitmap; // chooseProcs - orig or scaled | 68 const SkBitmap* fBitmap; // chooseProcs - orig or scaled |
68 SkMatrix fInvMatrix; // chooseProcs | 69 SkMatrix fInvMatrix; // chooseProcs |
69 SkMatrix::MapXYProc fInvProc; // chooseProcs | 70 SkMatrix::MapXYProc fInvProc; // chooseProcs |
70 | 71 |
71 SkFractionalInt fInvSxFractionalInt; | 72 SkFractionalInt fInvSxFractionalInt; |
72 SkFractionalInt fInvKyFractionalInt; | 73 SkFractionalInt fInvKyFractionalInt; |
73 | 74 |
74 FixedTileProc fTileProcX; // chooseProcs | 75 FixedTileProc fTileProcX; // chooseProcs |
75 FixedTileProc fTileProcY; // chooseProcs | 76 FixedTileProc fTileProcY; // chooseProcs |
76 FixedTileLowBitsProc fTileLowBitsProcX; // chooseProcs | 77 FixedTileLowBitsProc fTileLowBitsProcX; // chooseProcs |
77 FixedTileLowBitsProc fTileLowBitsProcY; // chooseProcs | 78 FixedTileLowBitsProc fTileLowBitsProcY; // chooseProcs |
78 IntTileProc fIntTileProcY; // chooseProcs | 79 IntTileProc fIntTileProcY; // chooseProcs |
79 SkFixed fFilterOneX; | 80 SkFixed fFilterOneX; |
80 SkFixed fFilterOneY; | 81 SkFixed fFilterOneY; |
| 82 |
| 83 SkConvolutionProcs* fConvolutionProcs; // possiblyScaleImage |
81 | 84 |
82 SkPMColor fPaintPMColor; // chooseProcs - A8 config | 85 SkPMColor fPaintPMColor; // chooseProcs - A8 config |
83 SkFixed fInvSx; // chooseProcs | 86 SkFixed fInvSx; // chooseProcs |
84 SkFixed fInvKy; // chooseProcs | 87 SkFixed fInvKy; // chooseProcs |
85 uint16_t fAlphaScale; // chooseProcs | 88 uint16_t fAlphaScale; // chooseProcs |
86 uint8_t fInvType; // chooseProcs | 89 uint8_t fInvType; // chooseProcs |
87 uint8_t fTileModeX; // CONSTRUCTOR | 90 uint8_t fTileModeX; // CONSTRUCTOR |
88 uint8_t fTileModeY; // CONSTRUCTOR | 91 uint8_t fTileModeY; // CONSTRUCTOR |
89 | 92 |
90 enum { | 93 enum { |
(...skipping 15 matching lines...) Expand all Loading... |
106 fShaderProc16 | 109 fShaderProc16 |
107 fMatrixProc | 110 fMatrixProc |
108 fSampleProc32 | 111 fSampleProc32 |
109 fSampleProc32 | 112 fSampleProc32 |
110 | 113 |
111 They will already have valid function pointers, so a platform that does | 114 They will already have valid function pointers, so a platform that does |
112 not have an accelerated version can just leave that field as is. A valid | 115 not have an accelerated version can just leave that field as is. A valid |
113 implementation can do nothing (see SkBitmapProcState_opts_none.cpp) | 116 implementation can do nothing (see SkBitmapProcState_opts_none.cpp) |
114 */ | 117 */ |
115 void platformProcs(); | 118 void platformProcs(); |
116 | 119 |
| 120 /** Platforms can also optionally overwrite the convolution functions |
| 121 if we have SIMD versions of them. |
| 122 */ |
| 123 |
| 124 void platformConvolutionProcs(); |
117 | 125 |
118 /** Given the byte size of the index buffer to be passed to the matrix proc, | 126 /** Given the byte size of the index buffer to be passed to the matrix proc, |
119 return the maximum number of resulting pixels that can be computed | 127 return the maximum number of resulting pixels that can be computed |
120 (i.e. the number of SkPMColor values to be written by the sample proc). | 128 (i.e. the number of SkPMColor values to be written by the sample proc). |
121 This routine takes into account that filtering and scale-vs-affine | 129 This routine takes into account that filtering and scale-vs-affine |
122 affect the amount of buffer space needed. | 130 affect the amount of buffer space needed. |
123 | 131 |
124 Only valid to call after chooseProcs (setContext) has been called. It is | 132 Only valid to call after chooseProcs (setContext) has been called. It is |
125 safe to call this inside the shader's shadeSpan() method. | 133 safe to call this inside the shader's shadeSpan() method. |
126 */ | 134 */ |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 int count, int x, int y); | 219 int count, int x, int y); |
212 void ClampX_ClampY_nofilter_scale(const SkBitmapProcState& s, uint32_t xy[], | 220 void ClampX_ClampY_nofilter_scale(const SkBitmapProcState& s, uint32_t xy[], |
213 int count, int x, int y); | 221 int count, int x, int y); |
214 void ClampX_ClampY_filter_affine(const SkBitmapProcState& s, | 222 void ClampX_ClampY_filter_affine(const SkBitmapProcState& s, |
215 uint32_t xy[], int count, int x, int y); | 223 uint32_t xy[], int count, int x, int y); |
216 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, | 224 void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s, |
217 uint32_t xy[], int count, int x, int y); | 225 uint32_t xy[], int count, int x, int y); |
218 void S32_D16_filter_DX(const SkBitmapProcState& s, | 226 void S32_D16_filter_DX(const SkBitmapProcState& s, |
219 const uint32_t* xy, int count, uint16_t* colo
rs); | 227 const uint32_t* xy, int count, uint16_t* colo
rs); |
220 | 228 |
221 void highQualityFilter_ScaleOnly(const SkBitmapProcState &s, int x, int y, | |
222 SkPMColor *SK_RESTRICT colors, int count); | |
223 void highQualityFilter(const SkBitmapProcState &s, int x, int y, | 229 void highQualityFilter(const SkBitmapProcState &s, int x, int y, |
224 SkPMColor *SK_RESTRICT colors, int count); | 230 SkPMColor *SK_RESTRICT colors, int count); |
225 | 231 |
226 | 232 |
227 #endif | 233 #endif |
OLD | NEW |