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

Unified Diff: dm/DMSrcSink.cpp

Issue 1267583002: Create a scanline decoder without creating a codec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix interlaced Created 5 years, 4 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 | « bench/subset/SubsetZoomBench.cpp ('k') | gyp/codec.gyp » ('j') | no next file with comments »
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 d1d9be030ffffb584bc537d23184965332bd92dc..f555b9fcbdba78f485e47b9baf4be67d2fa1d83c 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -159,11 +159,13 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
break;
}
case kScanline_Mode: {
- SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(codec->getScanlineDecoder(
- decodeInfo, NULL, colorPtr, colorCountPtr));
- if (NULL == scanlineDecoder) {
+ SkAutoTDelete<SkScanlineDecoder> scanlineDecoder(
+ SkScanlineDecoder::NewFromData(encoded));
+ if (NULL == scanlineDecoder || SkCodec::kSuccess !=
+ scanlineDecoder->start(decodeInfo, NULL, colorPtr, colorCountPtr)) {
return Error::Nonfatal("Cannot use scanline decoder for all images");
}
+
const SkCodec::Result result = scanlineDecoder->getScanlines(
bitmap.getAddr(0, 0), decodeInfo.height(), bitmap.rowBytes());
switch (result) {
@@ -222,8 +224,11 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
const int y = row * subsetHeight;
//create scanline decoder for each subset
SkAutoTDelete<SkScanlineDecoder> subsetScanlineDecoder(
- codec->getScanlineDecoder(decodeInfo, NULL, colorPtr, colorCountPtr));
- if (NULL == subsetScanlineDecoder) {
+ SkScanlineDecoder::NewFromData(encoded));
+ if (NULL == subsetScanlineDecoder || SkCodec::kSuccess !=
+ subsetScanlineDecoder->start(
+ decodeInfo, NULL, colorPtr, colorCountPtr))
+ {
if (x == 0 && y == 0) {
//first try, image may not be compatible
return Error::Nonfatal("Cannot use scanline decoder for all images");
@@ -289,9 +294,9 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
const int numStripes = (height + stripeHeight - 1) / stripeHeight;
// Decode odd stripes
- SkAutoTDelete<SkScanlineDecoder> decoder(
- codec->getScanlineDecoder(decodeInfo, NULL, colorPtr, colorCountPtr));
- if (NULL == decoder) {
+ SkAutoTDelete<SkScanlineDecoder> decoder(SkScanlineDecoder::NewFromData(encoded));
+ if (NULL == decoder || SkCodec::kSuccess !=
+ decoder->start(decodeInfo, NULL, colorPtr, colorCountPtr)) {
return Error::Nonfatal("Cannot use scanline decoder for all images");
}
for (int i = 0; i < numStripes; i += 2) {
@@ -323,9 +328,10 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
}
// Decode even stripes
- decoder.reset(codec->getScanlineDecoder(decodeInfo, NULL, colorPtr, colorCountPtr));
- if (NULL == decoder) {
- return "Failed to create second scanline decoder.";
+ const SkCodec::Result startResult = decoder->start(decodeInfo, NULL, colorPtr,
+ colorCountPtr);
+ if (SkCodec::kSuccess != startResult) {
+ return "Failed to restart scanline decoder with same parameters.";
}
for (int i = 0; i < numStripes; i += 2) {
// Read a stripe
« no previous file with comments | « bench/subset/SubsetZoomBench.cpp ('k') | gyp/codec.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698