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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 2319293003: Checking for valid colorType, alphaType, colorSpace in SkCodec (Closed)
Patch Set: Fix nanobench Created 4 years, 3 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 | « bench/ColorCodecBench.cpp ('k') | src/android/SkBitmapRegionCodec.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 2015 Google Inc. 2 * Copyright 2015 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 "DMSrcSink.h" 8 #include "DMSrcSink.h"
9 #include "Resources.h" 9 #include "Resources.h"
10 #include "SkAndroidCodec.h" 10 #include "SkAndroidCodec.h"
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 if (kDst_sRGB_Mode == fMode) { 889 if (kDst_sRGB_Mode == fMode) {
890 dstSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); 890 dstSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
891 } else if (kDst_HPZR30w_Mode == fMode) { 891 } else if (kDst_HPZR30w_Mode == fMode) {
892 dstSpace = SkColorSpace::NewICC(dstData->data(), dstData->size()); 892 dstSpace = SkColorSpace::NewICC(dstData->data(), dstData->size());
893 } 893 }
894 894
895 SkImageInfo decodeInfo = codec->getInfo().makeColorType(fColorType).makeColo rSpace(dstSpace); 895 SkImageInfo decodeInfo = codec->getInfo().makeColorType(fColorType).makeColo rSpace(dstSpace);
896 if (kUnpremul_SkAlphaType == decodeInfo.alphaType()) { 896 if (kUnpremul_SkAlphaType == decodeInfo.alphaType()) {
897 decodeInfo = decodeInfo.makeAlphaType(kPremul_SkAlphaType); 897 decodeInfo = decodeInfo.makeAlphaType(kPremul_SkAlphaType);
898 } 898 }
899 if (kRGBA_F16_SkColorType == fColorType) {
900 decodeInfo = decodeInfo.makeColorSpace(decodeInfo.colorSpace()->makeLine arGamma());
901 }
899 902
900 SkImageInfo bitmapInfo = decodeInfo; 903 SkImageInfo bitmapInfo = decodeInfo;
901 if (kRGBA_8888_SkColorType == decodeInfo.colorType() || 904 if (kRGBA_8888_SkColorType == decodeInfo.colorType() ||
902 kBGRA_8888_SkColorType == decodeInfo.colorType()) 905 kBGRA_8888_SkColorType == decodeInfo.colorType())
903 { 906 {
904 bitmapInfo = bitmapInfo.makeColorType(kN32_SkColorType); 907 bitmapInfo = bitmapInfo.makeColorType(kN32_SkColorType);
905 } 908 }
906 909
907 SkBitmap bitmap; 910 SkBitmap bitmap;
908 if (!bitmap.tryAllocPixels(bitmapInfo)) { 911 if (!bitmap.tryAllocPixels(bitmapInfo)) {
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 Error err = src.draw(&rec); 1636 Error err = src.draw(&rec);
1634 if (!err.isEmpty()) { 1637 if (!err.isEmpty()) {
1635 return err; 1638 return err;
1636 } 1639 }
1637 dl->draw(canvas); 1640 dl->draw(canvas);
1638 return check_against_reference(bitmap, src, fSink); 1641 return check_against_reference(bitmap, src, fSink);
1639 }); 1642 });
1640 } 1643 }
1641 1644
1642 } // namespace DM 1645 } // namespace DM
OLDNEW
« no previous file with comments | « bench/ColorCodecBench.cpp ('k') | src/android/SkBitmapRegionCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698