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

Side by Side Diff: tools/SkBitmapRegionDecoderInterface.cpp

Issue 1402863002: Implementation of SkBitmapRegionDecoder using SkAndroidCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@split1
Patch Set: Created 5 years, 2 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
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 "SkBitmapRegionCanvas.h" 8 #include "SkBitmapRegionCanvas.h"
9 #include "SkBitmapRegionCodec.h"
9 #include "SkBitmapRegionDecoderInterface.h" 10 #include "SkBitmapRegionDecoderInterface.h"
10 #include "SkBitmapRegionSampler.h" 11 #include "SkBitmapRegionSampler.h"
11 #include "SkCodec.h" 12 #include "SkCodec.h"
12 #include "SkCodecPriv.h" 13 #include "SkCodecPriv.h"
13 #include "SkImageDecoder.h" 14 #include "SkImageDecoder.h"
15 #include "SkScaledCodec.h"
14 16
15 SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegi onDecoder( 17 SkBitmapRegionDecoderInterface* SkBitmapRegionDecoderInterface::CreateBitmapRegi onDecoder(
16 SkStreamRewindable* stream, Strategy strategy) { 18 SkStreamRewindable* stream, Strategy strategy) {
17 SkAutoTDelete<SkStreamRewindable> streamDeleter(stream); 19 SkAutoTDelete<SkStreamRewindable> streamDeleter(stream);
18 switch (strategy) { 20 switch (strategy) {
19 case kOriginal_Strategy: { 21 case kOriginal_Strategy: {
20 SkImageDecoder* decoder = SkImageDecoder::Factory(stream); 22 SkImageDecoder* decoder = SkImageDecoder::Factory(stream);
21 int width, height; 23 int width, height;
22 if (nullptr == decoder) { 24 if (nullptr == decoder) {
23 SkCodecPrintf("Error: Could not create image decoder.\n"); 25 SkCodecPrintf("Error: Could not create image decoder.\n");
(...skipping 15 matching lines...) Expand all
39 switch (codec->getScanlineOrder()) { 41 switch (codec->getScanlineOrder()) {
40 case SkCodec::kTopDown_SkScanlineOrder: 42 case SkCodec::kTopDown_SkScanlineOrder:
41 case SkCodec::kNone_SkScanlineOrder: 43 case SkCodec::kNone_SkScanlineOrder:
42 break; 44 break;
43 default: 45 default:
44 SkCodecPrintf("Error: Scanline ordering not supported.\n"); 46 SkCodecPrintf("Error: Scanline ordering not supported.\n");
45 return nullptr; 47 return nullptr;
46 } 48 }
47 return new SkBitmapRegionCanvas(codec.detach()); 49 return new SkBitmapRegionCanvas(codec.detach());
48 } 50 }
51 case kCodec_Strategy: {
52 SkAutoTDelete<SkCodec> codec = SkScaledCodec::NewFromStream(streamDe leter.detach());
53 if (NULL == codec) {
54 SkCodecPrintf("Error: Failed to create codec.\n");
55 return NULL;
56 }
57 return new SkBitmapRegionCodec(codec.detach());
58 }
49 default: 59 default:
50 SkASSERT(false); 60 SkASSERT(false);
51 return nullptr; 61 return nullptr;
52 } 62 }
53 } 63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698