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 #include "SkMipMap.h" | 8 #include "SkMipMap.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 } | 299 } |
300 int64_t size = sk_64_mul(levelCount + 1, sizeof(Level)) + pixelSize; | 300 int64_t size = sk_64_mul(levelCount + 1, sizeof(Level)) + pixelSize; |
301 if (!sk_64_isS32(size)) { | 301 if (!sk_64_isS32(size)) { |
302 return 0; | 302 return 0; |
303 } | 303 } |
304 return sk_64_asS32(size); | 304 return sk_64_asS32(size); |
305 } | 305 } |
306 | 306 |
307 static bool treat_like_srgb(const SkImageInfo& info) { | 307 static bool treat_like_srgb(const SkImageInfo& info) { |
308 if (info.colorSpace()) { | 308 if (info.colorSpace()) { |
309 return SkColorSpace::k2Dot2Curve_GammaNamed == info.colorSpace()->gammaN
amed(); | 309 return info.colorSpace()->gammaCloseToSRGB(); |
310 } else { | 310 } else { |
311 return kSRGB_SkColorProfileType == info.profileType(); | 311 return kSRGB_SkColorProfileType == info.profileType(); |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 SkMipMap* SkMipMap::Build(const SkPixmap& src, SkSourceGammaTreatment treatment, | 315 SkMipMap* SkMipMap::Build(const SkPixmap& src, SkSourceGammaTreatment treatment, |
316 SkDiscardableFactoryProc fact) { | 316 SkDiscardableFactoryProc fact) { |
317 typedef void FilterProc(void*, const void* srcPtr, size_t srcRB, int count); | 317 typedef void FilterProc(void*, const void* srcPtr, size_t srcRB, int count); |
318 | 318 |
319 FilterProc* proc_1_2 = nullptr; | 319 FilterProc* proc_1_2 = nullptr; |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 return false; | 633 return false; |
634 } | 634 } |
635 if (index > fCount - 1) { | 635 if (index > fCount - 1) { |
636 return false; | 636 return false; |
637 } | 637 } |
638 if (levelPtr) { | 638 if (levelPtr) { |
639 *levelPtr = fLevels[index]; | 639 *levelPtr = fLevels[index]; |
640 } | 640 } |
641 return true; | 641 return true; |
642 } | 642 } |
OLD | NEW |