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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 return info; | 169 return info; |
170 } | 170 } |
171 | 171 |
172 static SkImageInfo MakeUnknown(int width, int height) { | 172 static SkImageInfo MakeUnknown(int width, int height) { |
173 SkImageInfo info = { | 173 SkImageInfo info = { |
174 width, height, kUnknown_SkColorType, kIgnore_SkAlphaType | 174 width, height, kUnknown_SkColorType, kIgnore_SkAlphaType |
175 }; | 175 }; |
176 return info; | 176 return info; |
177 } | 177 } |
178 | 178 |
| 179 static SkImageInfo MakeUnknown() { |
| 180 SkImageInfo info = { |
| 181 0, 0, kUnknown_SkColorType, kIgnore_SkAlphaType |
| 182 }; |
| 183 return info; |
| 184 } |
| 185 |
179 int width() const { return fWidth; } | 186 int width() const { return fWidth; } |
180 int height() const { return fHeight; } | 187 int height() const { return fHeight; } |
181 SkColorType colorType() const { return fColorType; } | 188 SkColorType colorType() const { return fColorType; } |
182 SkAlphaType alphaType() const { return fAlphaType; } | 189 SkAlphaType alphaType() const { return fAlphaType; } |
183 | 190 |
184 bool isEmpty() const { return fWidth <= 0 || fHeight <= 0; } | 191 bool isEmpty() const { return fWidth <= 0 || fHeight <= 0; } |
185 | 192 |
186 bool isOpaque() const { | 193 bool isOpaque() const { |
187 return SkAlphaTypeIsOpaque(fAlphaType); | 194 return SkAlphaTypeIsOpaque(fAlphaType); |
188 } | 195 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 239 |
233 bool validRowBytes(size_t rowBytes) const { | 240 bool validRowBytes(size_t rowBytes) const { |
234 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); | 241 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); |
235 return rowBytes >= rb; | 242 return rowBytes >= rb; |
236 } | 243 } |
237 | 244 |
238 SkDEBUGCODE(void validate() const;) | 245 SkDEBUGCODE(void validate() const;) |
239 }; | 246 }; |
240 | 247 |
241 #endif | 248 #endif |
OLD | NEW |