Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 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 | 34 |
| 35 struct SkBitmapProcState { | 35 struct SkBitmapProcState { |
| 36 | 36 |
| 37 SkBitmapProcState(): fBitmapFilter(NULL) {} | 37 SkBitmapProcState(): fBitmapFilter(NULL) {} |
|
robertphillips
2013/07/12 19:42:31
We don't need:
~SkBitmapProcState() {
this->e
humper
2013/07/12 21:12:03
Cleaned up. It's not right to call endcontext, bu
| |
| 38 ~SkBitmapProcState() { | |
| 39 SkDELETE(fBitmapFilter); | |
| 40 } | |
| 41 | 38 |
| 42 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, | 39 typedef void (*ShaderProc32)(const SkBitmapProcState&, int x, int y, |
| 43 SkPMColor[], int count); | 40 SkPMColor[], int count); |
| 44 | 41 |
| 45 typedef void (*ShaderProc16)(const SkBitmapProcState&, int x, int y, | 42 typedef void (*ShaderProc16)(const SkBitmapProcState&, int x, int y, |
| 46 uint16_t[], int count); | 43 uint16_t[], int count); |
| 47 | 44 |
| 48 typedef void (*MatrixProc)(const SkBitmapProcState&, | 45 typedef void (*MatrixProc)(const SkBitmapProcState&, |
| 49 uint32_t bitmapXY[], | 46 uint32_t bitmapXY[], |
| 50 int count, | 47 int count, |
| 51 int x, int y); | 48 int x, int y); |
| 52 | 49 |
| 53 typedef void (*SampleProc32)(const SkBitmapProcState&, | 50 typedef void (*SampleProc32)(const SkBitmapProcState&, |
| 54 const uint32_t[], | 51 const uint32_t[], |
| 55 int count, | 52 int count, |
| 56 SkPMColor colors[]); | 53 SkPMColor colors[]); |
| 57 | 54 |
| 58 typedef void (*SampleProc16)(const SkBitmapProcState&, | 55 typedef void (*SampleProc16)(const SkBitmapProcState&, |
| 59 const uint32_t[], | 56 const uint32_t[], |
| 60 int count, | 57 int count, |
| 61 uint16_t colors[]); | 58 uint16_t colors[]); |
| 62 | 59 |
| 63 typedef U16CPU (*FixedTileProc)(SkFixed); // returns 0..0xFFFF | 60 typedef U16CPU (*FixedTileProc)(SkFixed); // returns 0..0xFFFF |
| 64 typedef U16CPU (*FixedTileLowBitsProc)(SkFixed, int); // returns 0..0xF | 61 typedef U16CPU (*FixedTileLowBitsProc)(SkFixed, int); // returns 0..0xF |
| 65 typedef U16CPU (*IntTileProc)(int value, int count); // returns 0..count-1 | 62 typedef U16CPU (*IntTileProc)(int value, int count); // returns 0..count-1 |
| 66 | 63 |
| 67 const SkBitmap* fBitmap; // chooseProcs - orig or mip | 64 const SkBitmap* fBitmap; // chooseProcs - orig or mip |
|
reed1
2013/07/12 18:33:24
orig or scaled
humper
2013/07/12 21:12:03
Done.
| |
| 68 const SkMatrix* fInvMatrix; // chooseProcs | 65 SkMatrix fInvMatrix; // chooseProcs |
| 69 SkMatrix::MapXYProc fInvProc; // chooseProcs | 66 SkMatrix::MapXYProc fInvProc; // chooseProcs |
| 70 | 67 |
| 71 SkFractionalInt fInvSxFractionalInt; | 68 SkFractionalInt fInvSxFractionalInt; |
| 72 SkFractionalInt fInvKyFractionalInt; | 69 SkFractionalInt fInvKyFractionalInt; |
| 73 | 70 |
| 74 FixedTileProc fTileProcX; // chooseProcs | 71 FixedTileProc fTileProcX; // chooseProcs |
| 75 FixedTileProc fTileProcY; // chooseProcs | 72 FixedTileProc fTileProcY; // chooseProcs |
| 76 FixedTileLowBitsProc fTileLowBitsProcX; // chooseProcs | 73 FixedTileLowBitsProc fTileLowBitsProcX; // chooseProcs |
| 77 FixedTileLowBitsProc fTileLowBitsProcY; // chooseProcs | 74 FixedTileLowBitsProc fTileLowBitsProcY; // chooseProcs |
| 78 IntTileProc fIntTileProcY; // chooseProcs | 75 IntTileProc fIntTileProcY; // chooseProcs |
| 79 SkFixed fFilterOneX; | 76 SkFixed fFilterOneX; |
| 80 SkFixed fFilterOneY; | 77 SkFixed fFilterOneY; |
| 81 | 78 |
| 82 SkPMColor fPaintPMColor; // chooseProcs - A8 config | 79 SkPMColor fPaintPMColor; // chooseProcs - A8 config |
| 83 SkFixed fInvSx; // chooseProcs | 80 SkFixed fInvSx; // chooseProcs |
| 84 SkFixed fInvKy; // chooseProcs | 81 SkFixed fInvKy; // chooseProcs |
| 85 uint16_t fAlphaScale; // chooseProcs | 82 uint16_t fAlphaScale; // chooseProcs |
| 86 uint8_t fInvType; // chooseProcs | 83 uint8_t fInvType; // chooseProcs |
| 87 uint8_t fTileModeX; // CONSTRUCTOR | 84 uint8_t fTileModeX; // CONSTRUCTOR |
| 88 uint8_t fTileModeY; // CONSTRUCTOR | 85 uint8_t fTileModeY; // CONSTRUCTOR |
| 89 SkBool8 fDoFilter; // chooseProcs | 86 |
| 87 enum { | |
| 88 kNone_BitmapFilter, | |
| 89 kBilerp_BitmapFilter, | |
| 90 kHQ_BitmapFilter | |
| 91 } fFilterQuality; // chooseProcs | |
| 92 | |
| 93 /** The shader will let us know when we can release some of our resources | |
| 94 * like scaled bitmaps. | |
| 95 */ | |
| 96 | |
| 97 void endContext(); | |
| 90 | 98 |
| 91 /** Platforms implement this, and can optionally overwrite only the | 99 /** Platforms implement this, and can optionally overwrite only the |
| 92 following fields: | 100 following fields: |
| 93 | 101 |
| 94 fShaderProc32 | 102 fShaderProc32 |
| 95 fShaderProc16 | 103 fShaderProc16 |
| 96 fMatrixProc | 104 fMatrixProc |
| 97 fSampleProc32 | 105 fSampleProc32 |
| 98 fSampleProc32 | 106 fSampleProc32 |
| 99 | 107 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 private: | 141 private: |
| 134 friend class SkBitmapProcShader; | 142 friend class SkBitmapProcShader; |
| 135 | 143 |
| 136 ShaderProc32 fShaderProc32; // chooseProcs | 144 ShaderProc32 fShaderProc32; // chooseProcs |
| 137 ShaderProc16 fShaderProc16; // chooseProcs | 145 ShaderProc16 fShaderProc16; // chooseProcs |
| 138 // These are used if the shaderproc is NULL | 146 // These are used if the shaderproc is NULL |
| 139 MatrixProc fMatrixProc; // chooseProcs | 147 MatrixProc fMatrixProc; // chooseProcs |
| 140 SampleProc32 fSampleProc32; // chooseProcs | 148 SampleProc32 fSampleProc32; // chooseProcs |
| 141 SampleProc16 fSampleProc16; // chooseProcs | 149 SampleProc16 fSampleProc16; // chooseProcs |
| 142 | 150 |
| 143 SkMatrix fUnitInvMatrix; // chooseProcs | |
| 144 SkBitmap fOrigBitmap; // CONSTRUCTOR | 151 SkBitmap fOrigBitmap; // CONSTRUCTOR |
| 145 SkBitmap fMipBitmap; | 152 SkBitmap fScaledBitmap; // chooseProcs |
| 146 | 153 |
| 147 MatrixProc chooseMatrixProc(bool trivial_matrix); | 154 MatrixProc chooseMatrixProc(bool trivial_matrix); |
| 148 bool chooseProcs(const SkMatrix& inv, const SkPaint&); | 155 bool chooseProcs(const SkMatrix& inv, const SkPaint&); |
| 149 ShaderProc32 chooseShaderProc32(); | 156 ShaderProc32 chooseShaderProc32(); |
| 157 | |
| 158 void possiblyScaleImage(); | |
| 150 | 159 |
| 151 void buildFilterCoefficients(SkFixed dst[4], float t) const; | |
| 152 SkBitmapFilter *fBitmapFilter; | 160 SkBitmapFilter *fBitmapFilter; |
| 153 | 161 |
| 154 ShaderProc32 chooseBitmapFilterProc(const SkPaint &paint); | 162 ShaderProc32 chooseBitmapFilterProc(); |
| 155 | 163 |
| 156 // Return false if we failed to setup for fast translate (e.g. overflow) | 164 // Return false if we failed to setup for fast translate (e.g. overflow) |
| 157 bool setupForTranslate(); | 165 bool setupForTranslate(); |
| 158 | 166 |
| 159 #ifdef SK_DEBUG | 167 #ifdef SK_DEBUG |
| 160 static void DebugMatrixProc(const SkBitmapProcState&, | 168 static void DebugMatrixProc(const SkBitmapProcState&, |
| 161 uint32_t[], int count, int x, int y); | 169 uint32_t[], int count, int x, int y); |
| 162 #endif | 170 #endif |
| 163 }; | 171 }; |
| 164 | 172 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 void S32_D16_filter_DX(const SkBitmapProcState& s, | 215 void S32_D16_filter_DX(const SkBitmapProcState& s, |
| 208 const uint32_t* xy, int count, uint16_t* colo rs); | 216 const uint32_t* xy, int count, uint16_t* colo rs); |
| 209 | 217 |
| 210 void highQualityFilter_ScaleOnly(const SkBitmapProcState &s, int x, int y, | 218 void highQualityFilter_ScaleOnly(const SkBitmapProcState &s, int x, int y, |
| 211 SkPMColor *SK_RESTRICT colors, int count); | 219 SkPMColor *SK_RESTRICT colors, int count); |
| 212 void highQualityFilter(const SkBitmapProcState &s, int x, int y, | 220 void highQualityFilter(const SkBitmapProcState &s, int x, int y, |
| 213 SkPMColor *SK_RESTRICT colors, int count); | 221 SkPMColor *SK_RESTRICT colors, int count); |
| 214 | 222 |
| 215 | 223 |
| 216 #endif | 224 #endif |
| OLD | NEW |