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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 typedef SkFixed3232 SkFractionalInt; | 22 typedef SkFixed3232 SkFractionalInt; |
23 #define SkScalarToFractionalInt(x) SkScalarToFixed3232(x) | 23 #define SkScalarToFractionalInt(x) SkScalarToFixed3232(x) |
24 #define SkFractionalIntToFixed(x) SkFixed3232ToFixed(x) | 24 #define SkFractionalIntToFixed(x) SkFixed3232ToFixed(x) |
25 #define SkFixedToFractionalInt(x) SkFixedToFixed3232(x) | 25 #define SkFixedToFractionalInt(x) SkFixedToFixed3232(x) |
26 #define SkFractionalIntToInt(x) SkFixed3232ToInt(x) | 26 #define SkFractionalIntToInt(x) SkFixed3232ToInt(x) |
27 | 27 |
28 class SkPaint; | 28 class SkPaint; |
29 | 29 |
30 struct SkBitmapProcInfo { | 30 struct SkBitmapProcInfo { |
31 SkBitmapProcInfo(const SkBitmapProvider&, SkShader::TileMode tmx, SkShader::
TileMode tmy); | 31 SkBitmapProcInfo(const SkBitmapProvider&, SkShader::TileMode tmx, SkShader::
TileMode tmy, |
32 SkBitmapProcInfo(const SkBitmap&, SkShader::TileMode tmx, SkShader::TileMode
tmy); | 32 SkSourceGammaTreatment); |
| 33 SkBitmapProcInfo(const SkBitmap&, SkShader::TileMode tmx, SkShader::TileMode
tmy, |
| 34 SkSourceGammaTreatment); |
33 ~SkBitmapProcInfo(); | 35 ~SkBitmapProcInfo(); |
34 | 36 |
35 const SkBitmapProvider fProvider; | 37 const SkBitmapProvider fProvider; |
36 | 38 |
37 SkPixmap fPixmap; | 39 SkPixmap fPixmap; |
38 SkMatrix fInvMatrix; // This changes based on tile mode. | 40 SkMatrix fInvMatrix; // This changes based on tile mode. |
39 // TODO: combine fInvMatrix and fRealInvMatrix. | 41 // TODO: combine fInvMatrix and fRealInvMatrix. |
40 SkMatrix fRealInvMatrix; // The actual inverse matrix. | 42 SkMatrix fRealInvMatrix; // The actual inverse matrix. |
41 SkColor fPaintColor; | 43 SkColor fPaintColor; |
42 SkShader::TileMode fTileModeX; | 44 SkShader::TileMode fTileModeX; |
43 SkShader::TileMode fTileModeY; | 45 SkShader::TileMode fTileModeY; |
44 SkFilterQuality fFilterQuality; | 46 SkFilterQuality fFilterQuality; |
45 SkMatrix::TypeMask fInvType; | 47 SkMatrix::TypeMask fInvType; |
| 48 SkSourceGammaTreatment fSrcGammaTreatment; |
46 | 49 |
47 bool init(const SkMatrix& inverse, const SkPaint&); | 50 bool init(const SkMatrix& inverse, const SkPaint&); |
48 | 51 |
49 private: | 52 private: |
50 enum { | 53 enum { |
51 kBMStateSize = 136 // found by inspection. if too small, we will call n
ew/delete | 54 kBMStateSize = 136 // found by inspection. if too small, we will call n
ew/delete |
52 }; | 55 }; |
53 SkAlignedSStorage<kBMStateSize> fBMStateStorage; | 56 SkAlignedSStorage<kBMStateSize> fBMStateStorage; |
54 SkBitmapController::State* fBMState; | 57 SkBitmapController::State* fBMState; |
55 }; | 58 }; |
56 | 59 |
57 struct SkBitmapProcState : public SkBitmapProcInfo { | 60 struct SkBitmapProcState : public SkBitmapProcInfo { |
58 SkBitmapProcState(const SkBitmapProvider& prov, SkShader::TileMode tmx, SkSh
ader::TileMode tmy) | 61 SkBitmapProcState(const SkBitmapProvider& prov, SkShader::TileMode tmx, SkSh
ader::TileMode tmy, |
59 : SkBitmapProcInfo(prov, tmx, tmy) {} | 62 SkSourceGammaTreatment treatment) |
60 SkBitmapProcState(const SkBitmap& bitmap, SkShader::TileMode tmx, SkShader::
TileMode tmy) | 63 : SkBitmapProcInfo(prov, tmx, tmy, treatment) {} |
61 : SkBitmapProcInfo(bitmap, tmx, tmy) {} | 64 SkBitmapProcState(const SkBitmap& bitmap, SkShader::TileMode tmx, SkShader::
TileMode tmy, |
| 65 SkSourceGammaTreatment treatment) |
| 66 : SkBitmapProcInfo(bitmap, tmx, tmy, treatment) {} |
62 | 67 |
63 bool setup(const SkMatrix& inv, const SkPaint& paint) { | 68 bool setup(const SkMatrix& inv, const SkPaint& paint) { |
64 return this->init(inv, paint) && this->chooseProcs(); | 69 return this->init(inv, paint) && this->chooseProcs(); |
65 } | 70 } |
66 | 71 |
67 typedef void (*ShaderProc32)(const void* ctx, int x, int y, SkPMColor[], int
count); | 72 typedef void (*ShaderProc32)(const void* ctx, int x, int y, SkPMColor[], int
count); |
68 | 73 |
69 typedef void (*ShaderProc16)(const void* ctx, int x, int y, uint16_t[], int
count); | 74 typedef void (*ShaderProc16)(const void* ctx, int x, int y, uint16_t[], int
count); |
70 | 75 |
71 typedef void (*MatrixProc)(const SkBitmapProcState&, | 76 typedef void (*MatrixProc)(const SkBitmapProcState&, |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 SkFixed fixedY() const { return SkFractionalIntToFixed(fY); } | 260 SkFixed fixedY() const { return SkFractionalIntToFixed(fY); } |
256 | 261 |
257 int intX() const { return SkFractionalIntToInt(fX); } | 262 int intX() const { return SkFractionalIntToInt(fX); } |
258 int intY() const { return SkFractionalIntToInt(fY); } | 263 int intY() const { return SkFractionalIntToInt(fY); } |
259 | 264 |
260 private: | 265 private: |
261 SkFractionalInt fX, fY; | 266 SkFractionalInt fX, fY; |
262 }; | 267 }; |
263 | 268 |
264 #endif | 269 #endif |
OLD | NEW |