| 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 |
| 11 #include "SkMath.h" | 11 #include "SkMath.h" |
| 12 #include "SkRect.h" |
| 12 #include "SkSize.h" | 13 #include "SkSize.h" |
| 13 | 14 |
| 15 class SkReadBuffer; |
| 14 class SkWriteBuffer; | 16 class SkWriteBuffer; |
| 15 class SkReadBuffer; | |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * Describes how to interpret the alpha compoent of a pixel. | 19 * Describes how to interpret the alpha compoent of a pixel. |
| 19 */ | 20 */ |
| 20 enum SkAlphaType { | 21 enum SkAlphaType { |
| 21 /** | 22 /** |
| 22 * All pixels should be treated as opaque, regardless of the value stored | 23 * All pixels should be treated as opaque, regardless of the value stored |
| 23 * in their alpha field. Used for legacy images that wrote 0 or garbarge | 24 * in their alpha field. Used for legacy images that wrote 0 or garbarge |
| 24 * in their alpha field, but intended the RGB to be treated as opaque. | 25 * in their alpha field, but intended the RGB to be treated as opaque. |
| 25 */ | 26 */ |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 int height() const { return fHeight; } | 201 int height() const { return fHeight; } |
| 201 SkColorType colorType() const { return fColorType; } | 202 SkColorType colorType() const { return fColorType; } |
| 202 SkAlphaType alphaType() const { return fAlphaType; } | 203 SkAlphaType alphaType() const { return fAlphaType; } |
| 203 | 204 |
| 204 bool isEmpty() const { return fWidth <= 0 || fHeight <= 0; } | 205 bool isEmpty() const { return fWidth <= 0 || fHeight <= 0; } |
| 205 | 206 |
| 206 bool isOpaque() const { | 207 bool isOpaque() const { |
| 207 return SkAlphaTypeIsOpaque(fAlphaType); | 208 return SkAlphaTypeIsOpaque(fAlphaType); |
| 208 } | 209 } |
| 209 | 210 |
| 211 SkIRect bounds() const { return SkIRect::MakeWH(fWidth, fHeight); } |
| 210 SkISize dimensions() const { return SkISize::Make(fWidth, fHeight); } | 212 SkISize dimensions() const { return SkISize::Make(fWidth, fHeight); } |
| 211 | 213 |
| 212 /** | 214 /** |
| 213 * Return a new ImageInfo with the same colortype and alphatype as this inf
o, | 215 * Return a new ImageInfo with the same colortype and alphatype as this inf
o, |
| 214 * but with the specified width and height. | 216 * but with the specified width and height. |
| 215 */ | 217 */ |
| 216 SkImageInfo makeWH(int newWidth, int newHeight) const { | 218 SkImageInfo makeWH(int newWidth, int newHeight) const { |
| 217 return SkImageInfo::Make(newWidth, newHeight, fColorType, fAlphaType); | 219 return SkImageInfo::Make(newWidth, newHeight, fColorType, fAlphaType); |
| 218 } | 220 } |
| 219 | 221 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 private: | 280 private: |
| 279 SkImageInfo(int width, int height, SkColorType ct, SkAlphaType at) | 281 SkImageInfo(int width, int height, SkColorType ct, SkAlphaType at) |
| 280 : fWidth(width) | 282 : fWidth(width) |
| 281 , fHeight(height) | 283 , fHeight(height) |
| 282 , fColorType(ct) | 284 , fColorType(ct) |
| 283 , fAlphaType(at) | 285 , fAlphaType(at) |
| 284 {} | 286 {} |
| 285 }; | 287 }; |
| 286 | 288 |
| 287 #endif | 289 #endif |
| OLD | NEW |