Index: tools/SkBitmapRegionDecoderInterface.cpp |
diff --git a/tools/SkBitmapRegionDecoderInterface.cpp b/tools/SkBitmapRegionDecoderInterface.cpp |
index 47de31f4ec01c045ab8dad11059b0f292de037e7..151788000f8ceadb244a705de742965992d0cb09 100644 |
--- a/tools/SkBitmapRegionDecoderInterface.cpp |
+++ b/tools/SkBitmapRegionDecoderInterface.cpp |
@@ -6,10 +6,13 @@ |
*/ |
#include "SkBitmapRegionCanvas.h" |
+#include "SkBitmapRegionCodec.h" |
#include "SkBitmapRegionDecoderInterface.h" |
#include "SkBitmapRegionSampler.h" |
#include "SkCodec.h" |
+#include "SkCodecPriv.h" |
#include "SkImageDecoder.h" |
+#include "SkScaledCodec.h" |
SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder( |
SkStreamRewindable* stream, Strategy strategy) { |
@@ -18,11 +21,11 @@ SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegi |
SkImageDecoder* decoder = SkImageDecoder::Factory(stream); |
int width, height; |
if (nullptr == decoder) { |
- SkDebugf("Error: Could not create image decoder.\n"); |
+ SkCodecPrintf("Error: Could not create image decoder.\n"); |
return nullptr; |
} |
if (!decoder->buildTileIndex(stream, &width, &height)) { |
- SkDebugf("Error: Could not build tile index.\n"); |
+ SkCodecPrintf("Error: Could not build tile index.\n"); |
delete decoder; |
return nullptr; |
} |
@@ -31,7 +34,7 @@ SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegi |
case kCanvas_Strategy: { |
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream)); |
if (nullptr == codec) { |
- SkDebugf("Error: Failed to create decoder.\n"); |
+ SkCodecPrintf("Error: Failed to create decoder.\n"); |
return nullptr; |
} |
switch (codec->getScanlineOrder()) { |
@@ -39,11 +42,19 @@ SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegi |
case SkCodec::kNone_SkScanlineOrder: |
break; |
default: |
- SkDebugf("Error: Scanline ordering not supported.\n"); |
+ SkCodecPrintf("Error: Scanline ordering not supported.\n"); |
return nullptr; |
} |
return new SkBitmapRegionCanvas(codec.detach()); |
} |
+ case kCodec_Strategy: { |
+ SkCodec* codec = SkScaledCodec::NewFromStream(stream); |
+ if (NULL == codec) { |
+ SkCodecPrintf("Error: Failed to create codec.\n"); |
+ return NULL; |
+ } |
+ return new SkBitmapRegionCodec(codec); |
+ } |
default: |
SkASSERT(false); |
return nullptr; |