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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 273 } |
274 | 274 |
275 SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const { | 275 SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const { |
276 return SkImageInfo(fWidth, fHeight, fColorType, newAlphaType, fProfileTy
pe, fColorSpace); | 276 return SkImageInfo(fWidth, fHeight, fColorType, newAlphaType, fProfileTy
pe, fColorSpace); |
277 } | 277 } |
278 | 278 |
279 SkImageInfo makeColorType(SkColorType newColorType) const { | 279 SkImageInfo makeColorType(SkColorType newColorType) const { |
280 return SkImageInfo(fWidth, fHeight, newColorType, fAlphaType, fProfileTy
pe, fColorSpace); | 280 return SkImageInfo(fWidth, fHeight, newColorType, fAlphaType, fProfileTy
pe, fColorSpace); |
281 } | 281 } |
282 | 282 |
| 283 SkImageInfo makeColorSpace(sk_sp<SkColorSpace> cs) const { |
| 284 return SkImageInfo::Make(fWidth, fHeight, fColorType, fAlphaType, std::m
ove(cs)); |
| 285 } |
| 286 |
283 int bytesPerPixel() const { return SkColorTypeBytesPerPixel(fColorType); } | 287 int bytesPerPixel() const { return SkColorTypeBytesPerPixel(fColorType); } |
284 | 288 |
285 int shiftPerPixel() const { return SkColorTypeShiftPerPixel(fColorType); } | 289 int shiftPerPixel() const { return SkColorTypeShiftPerPixel(fColorType); } |
286 | 290 |
287 uint64_t minRowBytes64() const { | 291 uint64_t minRowBytes64() const { |
288 return sk_64_mul(fWidth, this->bytesPerPixel()); | 292 return sk_64_mul(fWidth, this->bytesPerPixel()); |
289 } | 293 } |
290 | 294 |
291 size_t minRowBytes() const { | 295 size_t minRowBytes() const { |
292 return (size_t)this->minRowBytes64(); | 296 return (size_t)this->minRowBytes64(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 370 |
367 static inline bool SkColorAndProfileAreGammaCorrect(SkColorType ct, SkColorProfi
leType pt) { | 371 static inline bool SkColorAndProfileAreGammaCorrect(SkColorType ct, SkColorProfi
leType pt) { |
368 return kSRGB_SkColorProfileType == pt || kRGBA_F16_SkColorType == ct; | 372 return kSRGB_SkColorProfileType == pt || kRGBA_F16_SkColorType == ct; |
369 } | 373 } |
370 | 374 |
371 static inline bool SkImageInfoIsGammaCorrect(const SkImageInfo& info) { | 375 static inline bool SkImageInfoIsGammaCorrect(const SkImageInfo& info) { |
372 return SkColorAndProfileAreGammaCorrect(info.colorType(), info.profileType()
); | 376 return SkColorAndProfileAreGammaCorrect(info.colorType(), info.profileType()
); |
373 } | 377 } |
374 | 378 |
375 #endif | 379 #endif |
OLD | NEW |