| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 SkAlphaType alphaType() const { return fAlphaType; } | 182 SkAlphaType alphaType() const { return fAlphaType; } |
| 183 | 183 |
| 184 bool isEmpty() const { return fWidth <= 0 || fHeight <= 0; } | 184 bool isEmpty() const { return fWidth <= 0 || fHeight <= 0; } |
| 185 | 185 |
| 186 bool isOpaque() const { | 186 bool isOpaque() const { |
| 187 return SkAlphaTypeIsOpaque(fAlphaType); | 187 return SkAlphaTypeIsOpaque(fAlphaType); |
| 188 } | 188 } |
| 189 | 189 |
| 190 SkISize dimensions() const { return SkISize::Make(fWidth, fHeight); } | 190 SkISize dimensions() const { return SkISize::Make(fWidth, fHeight); } |
| 191 | 191 |
| 192 /** |
| 193 * Return a new ImageInfo with the same colortype and alphatype as this inf
o, |
| 194 * but with the specified width and height. |
| 195 */ |
| 196 SkImageInfo makeWH(int newWidth, int newHeight) const { |
| 197 return SkImageInfo::Make(newWidth, newHeight, fColorType, fAlphaType); |
| 198 } |
| 199 |
| 192 int bytesPerPixel() const { | 200 int bytesPerPixel() const { |
| 193 return SkColorTypeBytesPerPixel(fColorType); | 201 return SkColorTypeBytesPerPixel(fColorType); |
| 194 } | 202 } |
| 195 | 203 |
| 196 uint64_t minRowBytes64() const { | 204 uint64_t minRowBytes64() const { |
| 197 return sk_64_mul(fWidth, this->bytesPerPixel()); | 205 return sk_64_mul(fWidth, this->bytesPerPixel()); |
| 198 } | 206 } |
| 199 | 207 |
| 200 size_t minRowBytes() const { | 208 size_t minRowBytes() const { |
| 201 return (size_t)this->minRowBytes64(); | 209 return (size_t)this->minRowBytes64(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 224 | 232 |
| 225 bool validRowBytes(size_t rowBytes) const { | 233 bool validRowBytes(size_t rowBytes) const { |
| 226 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); | 234 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); |
| 227 return rowBytes >= rb; | 235 return rowBytes >= rb; |
| 228 } | 236 } |
| 229 | 237 |
| 230 SkDEBUGCODE(void validate() const;) | 238 SkDEBUGCODE(void validate() const;) |
| 231 }; | 239 }; |
| 232 | 240 |
| 233 #endif | 241 #endif |
| OLD | NEW |