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

Side by Side Diff: src/codec/SkCodec.cpp

Issue 1029423005: SkCodec: conditionally remove fInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « include/codec/SkCodec.h ('k') | no next file » | 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 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 "SkCodec.h" 8 #include "SkCodec.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkCodec_libbmp.h" 10 #include "SkCodec_libbmp.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 SkCodec* SkCodec::NewFromData(SkData* data) { 43 SkCodec* SkCodec::NewFromData(SkData* data) {
44 if (!data) { 44 if (!data) {
45 return NULL; 45 return NULL;
46 } 46 }
47 return NewFromStream(SkNEW_ARGS(SkMemoryStream, (data))); 47 return NewFromStream(SkNEW_ARGS(SkMemoryStream, (data)));
48 } 48 }
49 49
50 SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream) 50 SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream)
51 : INHERITED(info) 51 : INHERITED(info)
52 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO
52 , fInfo(info) 53 , fInfo(info)
54 #endif
53 , fStream(stream) 55 , fStream(stream)
54 , fNeedsRewind(false) 56 , fNeedsRewind(false)
55 {} 57 {}
56 58
57 bool SkCodec::rewindIfNeeded() { 59 bool SkCodec::rewindIfNeeded() {
58 // Store the value of fNeedsRewind so we can update it. Next read will 60 // Store the value of fNeedsRewind so we can update it. Next read will
59 // require a rewind. 61 // require a rewind.
60 const bool neededRewind = fNeedsRewind; 62 const bool neededRewind = fNeedsRewind;
61 fNeedsRewind = true; 63 fNeedsRewind = true;
62 return !neededRewind || fStream->rewind(); 64 return !neededRewind || fStream->rewind();
63 } 65 }
64 66
65 SkScanlineDecoder* SkCodec::getScanlineDecoder(const SkImageInfo& dstInfo) { 67 SkScanlineDecoder* SkCodec::getScanlineDecoder(const SkImageInfo& dstInfo) {
66 fScanlineDecoder.reset(NULL); 68 fScanlineDecoder.reset(NULL);
67 if (!rewindIfNeeded()) { 69 if (!rewindIfNeeded()) {
68 return NULL; 70 return NULL;
69 } 71 }
70 fScanlineDecoder.reset(this->onGetScanlineDecoder(dstInfo)); 72 fScanlineDecoder.reset(this->onGetScanlineDecoder(dstInfo));
71 return fScanlineDecoder.get(); 73 return fScanlineDecoder.get();
72 } 74 }
OLDNEW
« no previous file with comments | « include/codec/SkCodec.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698