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

Side by Side Diff: src/images/SkImageDecoder.cpp

Issue 816273002: remove dead SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « include/core/SkImageDecoder.h ('k') | src/images/SkImageDecoder_astc.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 8
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
11 #include "SkImagePriv.h" 11 #include "SkImagePriv.h"
12 #include "SkPixelRef.h" 12 #include "SkPixelRef.h"
13 #include "SkStream.h" 13 #include "SkStream.h"
14 #include "SkTemplates.h" 14 #include "SkTemplates.h"
15 #include "SkCanvas.h" 15 #include "SkCanvas.h"
16 16
17 SkImageDecoder::SkImageDecoder() 17 SkImageDecoder::SkImageDecoder()
18 : fPeeker(NULL) 18 : fPeeker(NULL)
19 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
20 , fChooser(NULL)
21 #endif
22 , fAllocator(NULL) 19 , fAllocator(NULL)
23 , fSampleSize(1) 20 , fSampleSize(1)
24 , fDefaultPref(kUnknown_SkColorType) 21 , fDefaultPref(kUnknown_SkColorType)
25 , fPreserveSrcDepth(false) 22 , fPreserveSrcDepth(false)
26 , fDitherImage(true) 23 , fDitherImage(true)
27 , fSkipWritingZeroes(false) 24 , fSkipWritingZeroes(false)
28 , fPreferQualityOverSpeed(false) 25 , fPreferQualityOverSpeed(false)
29 , fRequireUnpremultipliedColors(false) { 26 , fRequireUnpremultipliedColors(false) {
30 } 27 }
31 28
32 SkImageDecoder::~SkImageDecoder() { 29 SkImageDecoder::~SkImageDecoder() {
33 SkSafeUnref(fPeeker); 30 SkSafeUnref(fPeeker);
34 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
35 SkSafeUnref(fChooser);
36 #endif
37 SkSafeUnref(fAllocator); 31 SkSafeUnref(fAllocator);
38 } 32 }
39 33
40 void SkImageDecoder::copyFieldsToOther(SkImageDecoder* other) { 34 void SkImageDecoder::copyFieldsToOther(SkImageDecoder* other) {
41 if (NULL == other) { 35 if (NULL == other) {
42 return; 36 return;
43 } 37 }
44 other->setPeeker(fPeeker); 38 other->setPeeker(fPeeker);
45 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
46 other->setChooser(fChooser);
47 #endif
48 other->setAllocator(fAllocator); 39 other->setAllocator(fAllocator);
49 other->setSampleSize(fSampleSize); 40 other->setSampleSize(fSampleSize);
50 other->setPreserveSrcDepth(fPreserveSrcDepth); 41 other->setPreserveSrcDepth(fPreserveSrcDepth);
51 other->setDitherImage(fDitherImage); 42 other->setDitherImage(fDitherImage);
52 other->setSkipWritingZeroes(fSkipWritingZeroes); 43 other->setSkipWritingZeroes(fSkipWritingZeroes);
53 other->setPreferQualityOverSpeed(fPreferQualityOverSpeed); 44 other->setPreferQualityOverSpeed(fPreferQualityOverSpeed);
54 other->setRequireUnpremultipliedColors(fRequireUnpremultipliedColors); 45 other->setRequireUnpremultipliedColors(fRequireUnpremultipliedColors);
55 } 46 }
56 47
57 SkImageDecoder::Format SkImageDecoder::getFormat() const { 48 SkImageDecoder::Format SkImageDecoder::getFormat() const {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 SkDEBUGFAIL("Invalid format type!"); 81 SkDEBUGFAIL("Invalid format type!");
91 } 82 }
92 return "Unknown Format"; 83 return "Unknown Format";
93 } 84 }
94 85
95 SkImageDecoder::Peeker* SkImageDecoder::setPeeker(Peeker* peeker) { 86 SkImageDecoder::Peeker* SkImageDecoder::setPeeker(Peeker* peeker) {
96 SkRefCnt_SafeAssign(fPeeker, peeker); 87 SkRefCnt_SafeAssign(fPeeker, peeker);
97 return peeker; 88 return peeker;
98 } 89 }
99 90
100 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
101 SkImageDecoder::Chooser* SkImageDecoder::setChooser(Chooser* chooser) {
102 SkRefCnt_SafeAssign(fChooser, chooser);
103 return chooser;
104 }
105 #endif
106
107 SkBitmap::Allocator* SkImageDecoder::setAllocator(SkBitmap::Allocator* alloc) { 91 SkBitmap::Allocator* SkImageDecoder::setAllocator(SkBitmap::Allocator* alloc) {
108 SkRefCnt_SafeAssign(fAllocator, alloc); 92 SkRefCnt_SafeAssign(fAllocator, alloc);
109 return alloc; 93 return alloc;
110 } 94 }
111 95
112 void SkImageDecoder::setSampleSize(int size) { 96 void SkImageDecoder::setSampleSize(int size) {
113 if (size < 1) { 97 if (size < 1) {
114 size = 1; 98 size = 1;
115 } 99 }
116 fSampleSize = size; 100 fSampleSize = size;
117 } 101 }
118 102
119 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
120 // TODO: change Chooser virtual to take colorType, so we can stop calling SkColo rTypeToBitmapConfig
121 //
122 bool SkImageDecoder::chooseFromOneChoice(SkColorType colorType, int width, int h eight) const {
123 Chooser* chooser = fChooser;
124
125 if (NULL == chooser) { // no chooser, we just say YES to decoding :)
126 return true;
127 }
128 chooser->begin(1);
129 chooser->inspect(0, SkColorTypeToBitmapConfig(colorType), width, height);
130 return chooser->choose() == 0;
131 }
132 #endif
133
134 bool SkImageDecoder::allocPixelRef(SkBitmap* bitmap, 103 bool SkImageDecoder::allocPixelRef(SkBitmap* bitmap,
135 SkColorTable* ctable) const { 104 SkColorTable* ctable) const {
136 return bitmap->tryAllocPixels(fAllocator, ctable); 105 return bitmap->tryAllocPixels(fAllocator, ctable);
137 } 106 }
138 107
139 /////////////////////////////////////////////////////////////////////////////// 108 ///////////////////////////////////////////////////////////////////////////////
140 109
141 SkColorType SkImageDecoder::getPrefColorType(SrcDepth srcDepth, bool srcHasAlpha ) const { 110 SkColorType SkImageDecoder::getPrefColorType(SrcDepth srcDepth, bool srcHasAlpha ) const {
142 SkColorType ct = fDefaultPref; 111 SkColorType ct = fDefaultPref;
143 if (fPreserveSrcDepth) { 112 if (fPreserveSrcDepth) {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 return success; 256 return success;
288 } 257 }
289 258
290 bool SkImageDecoder::decodeYUV8Planes(SkStream* stream, SkISize componentSizes[3 ], void* planes[3], 259 bool SkImageDecoder::decodeYUV8Planes(SkStream* stream, SkISize componentSizes[3 ], void* planes[3],
291 size_t rowBytes[3], SkYUVColorSpace* color Space) { 260 size_t rowBytes[3], SkYUVColorSpace* color Space) {
292 // we reset this to false before calling onDecodeYUV8Planes 261 // we reset this to false before calling onDecodeYUV8Planes
293 fShouldCancelDecode = false; 262 fShouldCancelDecode = false;
294 263
295 return this->onDecodeYUV8Planes(stream, componentSizes, planes, rowBytes, co lorSpace); 264 return this->onDecodeYUV8Planes(stream, componentSizes, planes, rowBytes, co lorSpace);
296 } 265 }
OLDNEW
« no previous file with comments | « include/core/SkImageDecoder.h ('k') | src/images/SkImageDecoder_astc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698