| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 | 162 |
| 163 SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) { | 163 SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) { |
| 164 SkAutoTDelete<SkStream> streamDeleter(stream); | 164 SkAutoTDelete<SkStream> streamDeleter(stream); |
| 165 SkISize size; | 165 SkISize size; |
| 166 if (!read_header(stream, &size)) { | 166 if (!read_header(stream, &size)) { |
| 167 return nullptr; | 167 return nullptr; |
| 168 } | 168 } |
| 169 SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), | 169 SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), |
| 170 kGray_8_SkColorType, kOpaque_SkAlphaType); | 170 kGray_8_SkColorType, kOpaque_SkAlphaType); |
| 171 return new SkWbmpCodec(info, streamDeleter.detach()); | 171 return new SkWbmpCodec(info, streamDeleter.release()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 int SkWbmpCodec::onGetScanlines(void* dst, int count, size_t dstRowBytes) { | 174 int SkWbmpCodec::onGetScanlines(void* dst, int count, size_t dstRowBytes) { |
| 175 void* dstRow = dst; | 175 void* dstRow = dst; |
| 176 for (int y = 0; y < count; ++y) { | 176 for (int y = 0; y < count; ++y) { |
| 177 if (!this->readRow(fSrcBuffer.get())) { | 177 if (!this->readRow(fSrcBuffer.get())) { |
| 178 return y; | 178 return y; |
| 179 } | 179 } |
| 180 fSwizzler->swizzle(dstRow, fSrcBuffer.get()); | 180 fSwizzler->swizzle(dstRow, fSrcBuffer.get()); |
| 181 dstRow = SkTAddOffset<void>(dstRow, dstRowBytes); | 181 dstRow = SkTAddOffset<void>(dstRow, dstRowBytes); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Initialize the swizzler | 211 // Initialize the swizzler |
| 212 fSwizzler.reset(this->initializeSwizzler(dstInfo, get_color_ptr(fColorTable.
get()), options)); | 212 fSwizzler.reset(this->initializeSwizzler(dstInfo, get_color_ptr(fColorTable.
get()), options)); |
| 213 SkASSERT(fSwizzler); | 213 SkASSERT(fSwizzler); |
| 214 | 214 |
| 215 fSrcBuffer.reset(fSrcRowBytes); | 215 fSrcBuffer.reset(fSrcRowBytes); |
| 216 | 216 |
| 217 return kSuccess; | 217 return kSuccess; |
| 218 } | 218 } |
| OLD | NEW |