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 "SkTypes.h" | 11 #include "SkTypes.h" |
12 #include "SkSize.h" | 12 #include "SkSize.h" |
13 | 13 |
14 class SkFlattenableWriteBuffer; | 14 class SkWriteBuffer; |
15 class SkFlattenableReadBuffer; | 15 class SkReadBuffer; |
16 | 16 |
17 /** | 17 /** |
18 * Describes how to interpret the alpha compoent of a pixel. | 18 * Describes how to interpret the alpha compoent of a pixel. |
19 */ | 19 */ |
20 enum SkAlphaType { | 20 enum SkAlphaType { |
21 /** | 21 /** |
22 * All pixels should be treated as opaque, regardless of the value stored | 22 * 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 | 23 * 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. | 24 * in their alpha field, but intended the RGB to be treated as opaque. |
25 */ | 25 */ |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 return fWidth * this->bytesPerPixel(); | 171 return fWidth * this->bytesPerPixel(); |
172 } | 172 } |
173 | 173 |
174 bool operator==(const SkImageInfo& other) const { | 174 bool operator==(const SkImageInfo& other) const { |
175 return 0 == memcmp(this, &other, sizeof(other)); | 175 return 0 == memcmp(this, &other, sizeof(other)); |
176 } | 176 } |
177 bool operator!=(const SkImageInfo& other) const { | 177 bool operator!=(const SkImageInfo& other) const { |
178 return 0 != memcmp(this, &other, sizeof(other)); | 178 return 0 != memcmp(this, &other, sizeof(other)); |
179 } | 179 } |
180 | 180 |
181 void unflatten(SkFlattenableReadBuffer&); | 181 void unflatten(SkReadBuffer&); |
182 void flatten(SkFlattenableWriteBuffer&) const; | 182 void flatten(SkWriteBuffer&) const; |
183 | 183 |
184 size_t getSafeSize(size_t rowBytes) const { | 184 size_t getSafeSize(size_t rowBytes) const { |
185 if (0 == fHeight) { | 185 if (0 == fHeight) { |
186 return 0; | 186 return 0; |
187 } | 187 } |
188 return (fHeight - 1) * rowBytes + fWidth * this->bytesPerPixel(); | 188 return (fHeight - 1) * rowBytes + fWidth * this->bytesPerPixel(); |
189 } | 189 } |
190 }; | 190 }; |
191 | 191 |
192 #endif | 192 #endif |
OLD | NEW |