Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 27 matching lines...) Expand all Loading... | |
| 38 return NULL; | 38 return NULL; |
| 39 } | 39 } |
| 40 | 40 |
| 41 SkCodec* SkCodec::NewFromData(SkData* data) { | 41 SkCodec* SkCodec::NewFromData(SkData* data) { |
| 42 if (!data) { | 42 if (!data) { |
| 43 return NULL; | 43 return NULL; |
| 44 } | 44 } |
| 45 return NewFromStream(SkNEW_ARGS(SkMemoryStream, (data))); | 45 return NewFromStream(SkNEW_ARGS(SkMemoryStream, (data))); |
| 46 } | 46 } |
| 47 | 47 |
| 48 SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream) | 48 SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream) : INHERITED(info) |
|
scroggo
2015/03/19 13:27:47
nit: Shouldn't this go on the next line?
reed1
2015/03/19 15:20:46
Done.
| |
| 49 : fInfo(info) | 49 , fInfo(info) |
|
scroggo
2015/03/19 13:27:47
fInfo is no longer needed by SkCodec. We can inste
reed1
2015/03/19 15:20:46
I thought I would remove the (many) duplicates in
| |
| 50 , fStream(stream) | 50 , fStream(stream) |
| 51 , fNeedsRewind(false) | 51 , fNeedsRewind(false) |
| 52 {} | 52 {} |
| 53 | 53 |
| 54 bool SkCodec::rewindIfNeeded() { | 54 bool SkCodec::rewindIfNeeded() { |
| 55 // Store the value of fNeedsRewind so we can update it. Next read will | 55 // Store the value of fNeedsRewind so we can update it. Next read will |
| 56 // require a rewind. | 56 // require a rewind. |
| 57 const bool neededRewind = fNeedsRewind; | 57 const bool neededRewind = fNeedsRewind; |
| 58 fNeedsRewind = true; | 58 fNeedsRewind = true; |
| 59 return !neededRewind || fStream->rewind(); | 59 return !neededRewind || fStream->rewind(); |
| 60 } | 60 } |
| OLD | NEW |