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