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

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

Issue 2086583002: update callers to not use SkColorProfileType (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rm flag instead of commenting it out 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
« no previous file with comments | « src/core/SkLinearBitmapPipeline_sample.h ('k') | src/core/SkSpanProcs.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 if (levelCount < 0) { 297 if (levelCount < 0) {
298 return 0; 298 return 0;
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) {
308 if (info.colorSpace()) {
309 return info.colorSpace()->gammaCloseToSRGB();
310 } else {
311 return kSRGB_SkColorProfileType == info.profileType();
312 }
313 }
314
315 SkMipMap* SkMipMap::Build(const SkPixmap& src, SkSourceGammaTreatment treatment, 307 SkMipMap* SkMipMap::Build(const SkPixmap& src, SkSourceGammaTreatment treatment,
316 SkDiscardableFactoryProc fact) { 308 SkDiscardableFactoryProc fact) {
317 typedef void FilterProc(void*, const void* srcPtr, size_t srcRB, int count); 309 typedef void FilterProc(void*, const void* srcPtr, size_t srcRB, int count);
318 310
319 FilterProc* proc_1_2 = nullptr; 311 FilterProc* proc_1_2 = nullptr;
320 FilterProc* proc_1_3 = nullptr; 312 FilterProc* proc_1_3 = nullptr;
321 FilterProc* proc_2_1 = nullptr; 313 FilterProc* proc_2_1 = nullptr;
322 FilterProc* proc_2_2 = nullptr; 314 FilterProc* proc_2_2 = nullptr;
323 FilterProc* proc_2_3 = nullptr; 315 FilterProc* proc_2_3 = nullptr;
324 FilterProc* proc_3_1 = nullptr; 316 FilterProc* proc_3_1 = nullptr;
325 FilterProc* proc_3_2 = nullptr; 317 FilterProc* proc_3_2 = nullptr;
326 FilterProc* proc_3_3 = nullptr; 318 FilterProc* proc_3_3 = nullptr;
327 319
328 const SkColorType ct = src.colorType(); 320 const SkColorType ct = src.colorType();
329 const SkAlphaType at = src.alphaType(); 321 const SkAlphaType at = src.alphaType();
330 const bool srgbGamma = (SkSourceGammaTreatment::kRespect == treatment) 322 const bool srgbGamma = (SkSourceGammaTreatment::kRespect == treatment)
331 && treat_like_srgb(src.info()); 323 && src.info().gammaCloseToSRGB();
332 324
333 switch (ct) { 325 switch (ct) {
334 case kRGBA_8888_SkColorType: 326 case kRGBA_8888_SkColorType:
335 case kBGRA_8888_SkColorType: 327 case kBGRA_8888_SkColorType:
336 if (srgbGamma) { 328 if (srgbGamma) {
337 proc_1_2 = downsample_1_2<ColorTypeFilter_S32>; 329 proc_1_2 = downsample_1_2<ColorTypeFilter_S32>;
338 proc_1_3 = downsample_1_3<ColorTypeFilter_S32>; 330 proc_1_3 = downsample_1_3<ColorTypeFilter_S32>;
339 proc_2_1 = downsample_2_1<ColorTypeFilter_S32>; 331 proc_2_1 = downsample_2_1<ColorTypeFilter_S32>;
340 proc_2_2 = downsample_2_2<ColorTypeFilter_S32>; 332 proc_2_2 = downsample_2_2<ColorTypeFilter_S32>;
341 proc_2_3 = downsample_2_3<ColorTypeFilter_S32>; 333 proc_2_3 = downsample_2_3<ColorTypeFilter_S32>;
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 return false; 625 return false;
634 } 626 }
635 if (index > fCount - 1) { 627 if (index > fCount - 1) {
636 return false; 628 return false;
637 } 629 }
638 if (levelPtr) { 630 if (levelPtr) {
639 *levelPtr = fLevels[index]; 631 *levelPtr = fLevels[index];
640 } 632 }
641 return true; 633 return true;
642 } 634 }
OLDNEW
« no previous file with comments | « src/core/SkLinearBitmapPipeline_sample.h ('k') | src/core/SkSpanProcs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698