blob: 1366d3bccc7986cc0aefd57036c97653a46994b3 [file] [log] [blame]
reed@android.com8a1c16f2008-12-17 15:59:43 +00001/*
2** Copyright 2007, The Android Open Source Project
3**
4** Licensed under the Apache License, Version 2.0 (the "License");
5** you may not use this file except in compliance with the License.
6** You may obtain a copy of the License at
7**
8** http://www.apache.org/licenses/LICENSE-2.0
9**
10** Unless required by applicable law or agreed to in writing, software
11** distributed under the License is distributed on an "AS IS" BASIS,
12** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13** See the License for the specific language governing permissions and
14** limitations under the License.
15*/
16
17#ifndef SkBitmapProcState_DEFINED
18#define SkBitmapProcState_DEFINED
19
20#include "SkBitmap.h"
21#include "SkMatrix.h"
22
23class SkPaint;
24
25struct SkBitmapProcState {
26
27 typedef void (*MatrixProc)(const SkBitmapProcState&,
28 uint32_t bitmapXY[],
29 int count,
30 int x, int y);
31
32 typedef void (*SampleProc32)(const SkBitmapProcState&,
33 const uint32_t[],
34 int count,
35 SkPMColor colors[]);
36
37 typedef void (*SampleProc16)(const SkBitmapProcState&,
38 const uint32_t[],
39 int count,
40 uint16_t colors[]);
41
42 typedef U16CPU (*FixedTileProc)(SkFixed); // returns 0..0xFFFF
43
44 MatrixProc fMatrixProc; // chooseProcs
45 SampleProc32 fSampleProc32; // chooseProcs
46 SampleProc16 fSampleProc16; // chooseProcs
47
48 SkMatrix fUnitInvMatrix; // chooseProcs
49 FixedTileProc fTileProcX; // chooseProcs
50 FixedTileProc fTileProcY; // chooseProcs
51 SkFixed fFilterOneX;
52 SkFixed fFilterOneY;
53
54 const SkBitmap* fBitmap; // chooseProcs - orig or mip
55 SkBitmap fOrigBitmap; // CONSTRUCTOR
56#ifdef SK_SUPPORT_MIPMAP
57 SkBitmap fMipBitmap;
58#endif
59 SkPMColor fPaintPMColor; // chooseProcs - A8 config
60 const SkMatrix* fInvMatrix; // chooseProcs
61 SkMatrix::MapXYProc fInvProc; // chooseProcs
62 SkFixed fInvSx, fInvSy; // chooseProcs
63 SkFixed fInvKy; // chooseProcs
64 SkFixed fInvTxPlusHalf; // chooseProcs
65 SkFixed fInvTyPlusHalf; // chooseProcs
66 uint16_t fAlphaScale; // chooseProcs
67 uint8_t fInvType; // chooseProcs
68 uint8_t fTileModeX; // CONSTRUCTOR
69 uint8_t fTileModeY; // CONSTRUCTOR
70 SkBool8 fDoFilter; // chooseProcs
71
72 bool chooseProcs(const SkMatrix& inv, const SkPaint&);
73
74private:
75 MatrixProc chooseMatrixProc();
76};
77
78#endif