OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 SkImageInfo_DEFINED | 8 #ifndef SkImageInfo_DEFINED |
9 #define SkImageInfo_DEFINED | 9 #define SkImageInfo_DEFINED |
10 | 10 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 return width * SkColorTypeBytesPerPixel(ct); | 113 return width * SkColorTypeBytesPerPixel(ct); |
114 } | 114 } |
115 | 115 |
116 static inline bool SkColorTypeIsValid(unsigned value) { | 116 static inline bool SkColorTypeIsValid(unsigned value) { |
117 return value <= kLastEnum_SkColorType; | 117 return value <= kLastEnum_SkColorType; |
118 } | 118 } |
119 | 119 |
120 /////////////////////////////////////////////////////////////////////////////// | 120 /////////////////////////////////////////////////////////////////////////////// |
121 | 121 |
122 /** | 122 /** |
123 * Return true if alphaType is supported by colorType. If there is a canonical | |
scroggo
2014/06/18 17:45:43
Let me know if you think there is a better way to
reed1
2014/06/18 17:58:20
Good question. It would be prettier if this guy ju
| |
124 * alphaType for this colorType, return it in canonical. | |
125 */ | |
126 bool SkValidateAlphaType(SkColorType colorType, SkAlphaType alphaType, | |
reed1
2014/06/18 17:58:20
Wonder if the the name should start with colortype
scroggo
2014/06/30 22:03:58
Done.
| |
127 SkAlphaType* canonical = NULL); | |
128 | |
129 /////////////////////////////////////////////////////////////////////////////// | |
130 | |
131 /** | |
123 * Describe an image's dimensions and pixel type. | 132 * Describe an image's dimensions and pixel type. |
124 */ | 133 */ |
125 struct SkImageInfo { | 134 struct SkImageInfo { |
126 int fWidth; | 135 int fWidth; |
127 int fHeight; | 136 int fHeight; |
128 SkColorType fColorType; | 137 SkColorType fColorType; |
129 SkAlphaType fAlphaType; | 138 SkAlphaType fAlphaType; |
130 | 139 |
131 static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType a t) { | 140 static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType a t) { |
132 SkImageInfo info = { | 141 SkImageInfo info = { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 | 248 |
240 bool validRowBytes(size_t rowBytes) const { | 249 bool validRowBytes(size_t rowBytes) const { |
241 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); | 250 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); |
242 return rowBytes >= rb; | 251 return rowBytes >= rb; |
243 } | 252 } |
244 | 253 |
245 SkDEBUGCODE(void validate() const;) | 254 SkDEBUGCODE(void validate() const;) |
246 }; | 255 }; |
247 | 256 |
248 #endif | 257 #endif |
OLD | NEW |