| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 return MakeN32Premul(size.width(), size.height()); | 158 return MakeN32Premul(size.width(), size.height()); |
| 159 } | 159 } |
| 160 | 160 |
| 161 static SkImageInfo MakeA8(int width, int height) { | 161 static SkImageInfo MakeA8(int width, int height) { |
| 162 SkImageInfo info = { | 162 SkImageInfo info = { |
| 163 width, height, kAlpha_8_SkColorType, kPremul_SkAlphaType | 163 width, height, kAlpha_8_SkColorType, kPremul_SkAlphaType |
| 164 }; | 164 }; |
| 165 return info; | 165 return info; |
| 166 } | 166 } |
| 167 | 167 |
| 168 static SkImageInfo MakeUnknown(int width, int height) { |
| 169 SkImageInfo info = { |
| 170 width, height, kUnknown_SkColorType, kIgnore_SkAlphaType |
| 171 }; |
| 172 return info; |
| 173 } |
| 174 |
| 168 int width() const { return fWidth; } | 175 int width() const { return fWidth; } |
| 169 int height() const { return fHeight; } | 176 int height() const { return fHeight; } |
| 170 SkColorType colorType() const { return fColorType; } | 177 SkColorType colorType() const { return fColorType; } |
| 171 SkAlphaType alphaType() const { return fAlphaType; } | 178 SkAlphaType alphaType() const { return fAlphaType; } |
| 172 | 179 |
| 173 bool isEmpty() const { return fWidth <= 0 || fHeight <= 0; } | 180 bool isEmpty() const { return fWidth <= 0 || fHeight <= 0; } |
| 174 | 181 |
| 175 bool isOpaque() const { | 182 bool isOpaque() const { |
| 176 return SkAlphaTypeIsOpaque(fAlphaType); | 183 return SkAlphaTypeIsOpaque(fAlphaType); |
| 177 } | 184 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 220 |
| 214 bool validRowBytes(size_t rowBytes) const { | 221 bool validRowBytes(size_t rowBytes) const { |
| 215 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); | 222 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); |
| 216 return rowBytes >= rb; | 223 return rowBytes >= rb; |
| 217 } | 224 } |
| 218 | 225 |
| 219 SkDEBUGCODE(void validate() const;) | 226 SkDEBUGCODE(void validate() const;) |
| 220 }; | 227 }; |
| 221 | 228 |
| 222 #endif | 229 #endif |
| OLD | NEW |