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

Side by Side Diff: src/android/SkBitmapRegionCodec.cpp

Issue 2302953002: Request legacy mode behavior from SkCodec in BitmapRegionDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | no next file » | 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 "SkAndroidCodec.h" 8 #include "SkAndroidCodec.h"
9 #include "SkBitmapRegionCodec.h" 9 #include "SkBitmapRegionCodec.h"
10 #include "SkBitmapRegionDecoderPriv.h" 10 #include "SkBitmapRegionDecoderPriv.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // Ask the codec for a scaled subset 45 // Ask the codec for a scaled subset
46 if (!fCodec->getSupportedSubset(&subset)) { 46 if (!fCodec->getSupportedSubset(&subset)) {
47 SkCodecPrintf("Error: Could not get subset.\n"); 47 SkCodecPrintf("Error: Could not get subset.\n");
48 return false; 48 return false;
49 } 49 }
50 SkISize scaledSize = fCodec->getSampledSubsetDimensions(sampleSize, subset); 50 SkISize scaledSize = fCodec->getSampledSubsetDimensions(sampleSize, subset);
51 51
52 // Create the image info for the decode 52 // Create the image info for the decode
53 SkColorType dstColorType = fCodec->computeOutputColorType(prefColorType); 53 SkColorType dstColorType = fCodec->computeOutputColorType(prefColorType);
54 SkAlphaType dstAlphaType = fCodec->computeOutputAlphaType(requireUnpremul); 54 SkAlphaType dstAlphaType = fCodec->computeOutputAlphaType(requireUnpremul);
55 SkImageInfo decodeInfo = fCodec->getInfo().makeWH(scaledSize.width(), scaled Size.height()) 55
56 .makeColorType(dstColorType) 56 // Enable legacy behavior to avoid any gamma correction. Android's assets a re
57 .makeAlphaType(dstAlphaType); 57 // adjusted to expect a non-gamma correct premultiply.
58 sk_sp<SkColorSpace> colorSpace = nullptr;
59 SkImageInfo decodeInfo = SkImageInfo::Make(scaledSize.width(), scaledSize.he ight(),
60 dstColorType, dstAlphaType, color Space);
58 61
59 // Construct a color table for the decode if necessary 62 // Construct a color table for the decode if necessary
60 SkAutoTUnref<SkColorTable> colorTable(nullptr); 63 SkAutoTUnref<SkColorTable> colorTable(nullptr);
61 int maxColors = 256; 64 int maxColors = 256;
62 SkPMColor colors[256]; 65 SkPMColor colors[256];
63 if (kIndex_8_SkColorType == dstColorType) { 66 if (kIndex_8_SkColorType == dstColorType) {
64 colorTable.reset(new SkColorTable(colors, maxColors)); 67 colorTable.reset(new SkColorTable(colors, maxColors));
65 } 68 }
66 69
67 // Initialize the destination bitmap 70 // Initialize the destination bitmap
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 if (kIndex_8_SkColorType == dstColorType) { 130 if (kIndex_8_SkColorType == dstColorType) {
128 colorTable->dangerous_overwriteColors(colors, maxColors); 131 colorTable->dangerous_overwriteColors(colors, maxColors);
129 } 132 }
130 133
131 return true; 134 return true;
132 } 135 }
133 136
134 bool SkBitmapRegionCodec::conversionSupported(SkColorType colorType) { 137 bool SkBitmapRegionCodec::conversionSupported(SkColorType colorType) {
135 return conversion_possible(fCodec->getInfo().makeColorType(colorType), fCode c->getInfo()); 138 return conversion_possible(fCodec->getInfo().makeColorType(colorType), fCode c->getInfo());
136 } 139 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698