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

Unified Diff: dm/DMSrcSink.cpp

Issue 1055743003: Swizzler changes Index8 and 565 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/codec/SkCodecPriv.h » ('j') | src/codec/SkCodec_libbmp.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 929ff0556b453de2a5786595fb107e69fdc4febe..e614a1eef767956eb1e320af139bf4666b83089e 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -72,21 +72,36 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
return SkStringPrintf("Couldn't decode %s.", fPath.c_str());
}
- SkImageInfo decodeInfo = codec->getInfo().makeColorType(canvasInfo.colorType());
scroggo 2015/04/02 19:20:30 By removing this, we no longer have a way to test
msarett 2015/04/03 18:01:31 Oh ok, I think I misunderstood this line. So if w
scroggo 2015/04/06 14:55:11 Essentially. This means to decode to the config of
+ // Process the decode info to prepare for the decode
+ SkImageInfo decodeInfo = codec->getInfo();
+
+ // Construct a color table for the decode if necessary
+ SkAutoTUnref<SkColorTable> colorTable(NULL);
msarett 2015/04/02 17:26:29 I saw what you did for nanobench, but I decided to
scroggo 2015/04/02 19:20:30 This may be as good as anything. If you took my ap
+ SkPMColor* colorPtr = NULL;
+ int* colorCountPtr = NULL;
+ int maxColors = 256;
+ if (kIndex_8_SkColorType == decodeInfo.colorType()) {
+ SkPMColor colors[maxColors];
+ colorTable.reset(SkNEW_ARGS(SkColorTable, (colors, maxColors)));
+ colorPtr = const_cast<SkPMColor*>(colorTable->readColors());
+ colorCountPtr = &maxColors;
+ }
+
+ // FIXME: Currently we cannot draw unpremultiplied sources.
if (decodeInfo.alphaType() == kUnpremul_SkAlphaType) {
- // FIXME: Currently we cannot draw unpremultiplied sources.
decodeInfo = decodeInfo.makeAlphaType(kPremul_SkAlphaType);
}
SkBitmap bitmap;
- if (!bitmap.tryAllocPixels(decodeInfo)) {
+ if (!bitmap.tryAllocPixels(decodeInfo, NULL, colorTable.get())) {
return SkStringPrintf("Image(%s) is too large (%d x %d)\n", fPath.c_str(),
decodeInfo.width(), decodeInfo.height());
}
switch (fMode) {
case kNormal_Mode:
- switch (codec->getPixels(decodeInfo, bitmap.getPixels(), bitmap.rowBytes())) {
+ switch (codec->getPixels(decodeInfo, bitmap.getPixels(), bitmap.rowBytes(), NULL,
+ colorPtr, colorCountPtr)) {
case SkImageGenerator::kSuccess:
// We consider incomplete to be valid, since we should still decode what is
// available.
« no previous file with comments | « no previous file | src/codec/SkCodecPriv.h » ('j') | src/codec/SkCodec_libbmp.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698