OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
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 SkImage_DEFINED | 8 #ifndef SkImage_DEFINED |
9 #define SkImage_DEFINED | 9 #define SkImage_DEFINED |
10 | 10 |
| 11 #include "SkAlpha.h" |
11 #include "SkImageEncoder.h" | 12 #include "SkImageEncoder.h" |
12 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
13 #include "SkScalar.h" | 14 #include "SkScalar.h" |
14 | 15 |
15 class SkData; | 16 class SkData; |
16 class SkCanvas; | 17 class SkCanvas; |
17 class SkPaint; | 18 class SkPaint; |
18 class SkShader; | 19 class SkShader; |
19 class GrContext; | 20 class GrContext; |
20 class GrTexture; | 21 class GrTexture; |
(...skipping 13 matching lines...) Expand all Loading... |
34 */ | 35 */ |
35 class SK_API SkImage : public SkRefCnt { | 36 class SK_API SkImage : public SkRefCnt { |
36 public: | 37 public: |
37 SK_DECLARE_INST_COUNT(SkImage) | 38 SK_DECLARE_INST_COUNT(SkImage) |
38 | 39 |
39 enum ColorType { | 40 enum ColorType { |
40 kAlpha_8_ColorType, | 41 kAlpha_8_ColorType, |
41 kRGB_565_ColorType, | 42 kRGB_565_ColorType, |
42 kRGBA_8888_ColorType, | 43 kRGBA_8888_ColorType, |
43 kBGRA_8888_ColorType, | 44 kBGRA_8888_ColorType, |
44 kPMColor_ColorType, | 45 |
| 46 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) |
| 47 kPMColor_ColorType = kBGRA_8888_ColorType, |
| 48 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) |
| 49 kPMColor_ColorType = kRGBA_8888_ColorType, |
| 50 #else |
| 51 #error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order |
| 52 #endif |
45 | 53 |
46 kLastEnum_ColorType = kPMColor_ColorType | 54 kLastEnum_ColorType = kBGRA_8888_ColorType |
47 }; | 55 }; |
48 | 56 |
| 57 #ifdef SK_ENABLE_LEGACY_API_ALIASING |
49 enum AlphaType { | 58 enum AlphaType { |
50 kIgnore_AlphaType, | 59 kIgnore_AlphaType = kIgnore_SkAlphaType, |
51 kOpaque_AlphaType, | 60 kOpaque_AlphaType = kOpaque_SkAlphaType, |
52 kPremul_AlphaType, | 61 kPremul_AlphaType = kPremul_SkAlphaType, |
53 kUnpremul_AlphaType, | 62 kUnpremul_AlphaType = kUnpremul_SkAlphaType, |
54 | |
55 kLastEnum_AlphaType = kUnpremul_AlphaType | |
56 }; | 63 }; |
| 64 #endif |
57 | 65 |
58 struct Info { | 66 struct Info { |
59 int fWidth; | 67 int fWidth; |
60 int fHeight; | 68 int fHeight; |
61 ColorType fColorType; | 69 ColorType fColorType; |
62 AlphaType fAlphaType; | 70 SkAlphaType fAlphaType; |
63 }; | 71 }; |
64 | 72 |
65 static SkImage* NewRasterCopy(const Info&, const void* pixels, size_t rowByt
es); | 73 static SkImage* NewRasterCopy(const Info&, const void* pixels, size_t rowByt
es); |
66 static SkImage* NewRasterData(const Info&, SkData* pixels, size_t rowBytes); | 74 static SkImage* NewRasterData(const Info&, SkData* pixels, size_t rowBytes); |
67 static SkImage* NewEncodedData(SkData*); | 75 static SkImage* NewEncodedData(SkData*); |
68 | 76 |
69 /** | 77 /** |
70 * GrTexture is a more logical parameter for this factory, but its | 78 * GrTexture is a more logical parameter for this factory, but its |
71 * interactions with scratch cache still has issues, so for now we take | 79 * interactions with scratch cache still has issues, so for now we take |
72 * SkBitmap instead. This will be changed in the future. skbug.com/1449 | 80 * SkBitmap instead. This will be changed in the future. skbug.com/1449 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 const int fWidth; | 130 const int fWidth; |
123 const int fHeight; | 131 const int fHeight; |
124 const uint32_t fUniqueID; | 132 const uint32_t fUniqueID; |
125 | 133 |
126 static uint32_t NextUniqueID(); | 134 static uint32_t NextUniqueID(); |
127 | 135 |
128 typedef SkRefCnt INHERITED; | 136 typedef SkRefCnt INHERITED; |
129 }; | 137 }; |
130 | 138 |
131 #endif | 139 #endif |
OLD | NEW |