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

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: Let's call this AndroidCodec_Strategy 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"
12 #include "SkAndroidCodec.h"
11 #include "SkCodec.h" 13 #include "SkCodec.h"
12 #include "SkCodecPriv.h" 14 #include "SkCodecPriv.h"
13 #include "SkImageDecoder.h" 15 #include "SkImageDecoder.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);
(...skipping 18 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 kAndroidCodec_Strategy: {
52 SkAutoTDelete<SkAndroidCodec> codec =
53 SkAndroidCodec::NewFromStream(streamDeleter.detach());
scroggo 2015/10/21 20:56:20 Since this targets BRD, which always uses an SkMem
msarett 2015/10/21 22:00:00 Yeah I think so. SkDatas are more flexible than S
54 if (NULL == codec) {
55 SkCodecPrintf("Error: Failed to create codec.\n");
56 return NULL;
57 }
58 return new SkBitmapRegionCodec(codec.detach());
59 }
49 default: 60 default:
50 SkASSERT(false); 61 SkASSERT(false);
51 return nullptr; 62 return nullptr;
52 } 63 }
53 } 64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698