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 "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 *rowsDecoded = y; | 148 *rowsDecoded = y; |
149 return kIncompleteInput; | 149 return kIncompleteInput; |
150 } | 150 } |
151 swizzler->swizzle(dstRow, src.get()); | 151 swizzler->swizzle(dstRow, src.get()); |
152 dstRow = SkTAddOffset<void>(dstRow, rowBytes); | 152 dstRow = SkTAddOffset<void>(dstRow, rowBytes); |
153 } | 153 } |
154 return kSuccess; | 154 return kSuccess; |
155 } | 155 } |
156 | 156 |
157 bool SkWbmpCodec::IsWbmp(const void* buffer, size_t bytesRead) { | 157 bool SkWbmpCodec::IsWbmp(const void* buffer, size_t bytesRead) { |
158 SkAutoTUnref<SkData> data(SkData::NewWithoutCopy(buffer, bytesRead)); | 158 SkMemoryStream stream(buffer, bytesRead, false); |
159 SkMemoryStream stream(data); | |
160 return read_header(&stream, nullptr); | 159 return read_header(&stream, nullptr); |
161 } | 160 } |
162 | 161 |
163 SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) { | 162 SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) { |
164 SkAutoTDelete<SkStream> streamDeleter(stream); | 163 SkAutoTDelete<SkStream> streamDeleter(stream); |
165 SkISize size; | 164 SkISize size; |
166 if (!read_header(stream, &size)) { | 165 if (!read_header(stream, &size)) { |
167 return nullptr; | 166 return nullptr; |
168 } | 167 } |
169 SkEncodedInfo info = SkEncodedInfo::Make(SkEncodedInfo::kGray_Color, | 168 SkEncodedInfo info = SkEncodedInfo::Make(SkEncodedInfo::kGray_Color, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 208 } |
210 | 209 |
211 // Initialize the swizzler | 210 // Initialize the swizzler |
212 fSwizzler.reset(this->initializeSwizzler(dstInfo, get_color_ptr(fColorTable.
get()), options)); | 211 fSwizzler.reset(this->initializeSwizzler(dstInfo, get_color_ptr(fColorTable.
get()), options)); |
213 SkASSERT(fSwizzler); | 212 SkASSERT(fSwizzler); |
214 | 213 |
215 fSrcBuffer.reset(fSrcRowBytes); | 214 fSrcBuffer.reset(fSrcRowBytes); |
216 | 215 |
217 return kSuccess; | 216 return kSuccess; |
218 } | 217 } |
OLD | NEW |