Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: src/core/SkMipMap.cpp

Issue 2067833003: Differentiate between sRGBGamma and 2Dot2Gamma (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 SkColorSpace::k2Dot2Curve_GammaNamed == info.colorSpace()->gammaN amed() ||
310 SkColorSpace::kSRGB_GammaNamed == info.colorSpace()->gammaNamed() ;
310 } else { 311 } else {
311 return kSRGB_SkColorProfileType == info.profileType(); 312 return kSRGB_SkColorProfileType == info.profileType();
312 } 313 }
313 } 314 }
314 315
315 SkMipMap* SkMipMap::Build(const SkPixmap& src, SkSourceGammaTreatment treatment, 316 SkMipMap* SkMipMap::Build(const SkPixmap& src, SkSourceGammaTreatment treatment,
316 SkDiscardableFactoryProc fact) { 317 SkDiscardableFactoryProc fact) {
317 typedef void FilterProc(void*, const void* srcPtr, size_t srcRB, int count); 318 typedef void FilterProc(void*, const void* srcPtr, size_t srcRB, int count);
318 319
319 FilterProc* proc_1_2 = nullptr; 320 FilterProc* proc_1_2 = nullptr;
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 return false; 634 return false;
634 } 635 }
635 if (index > fCount - 1) { 636 if (index > fCount - 1) {
636 return false; 637 return false;
637 } 638 }
638 if (levelPtr) { 639 if (levelPtr) {
639 *levelPtr = fLevels[index]; 640 *levelPtr = fLevels[index];
640 } 641 }
641 return true; 642 return true;
642 } 643 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698