| 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 "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkStream.h" | 10 #include "SkStream.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 dst += rowBytes; | 147 dst += rowBytes; |
| 148 } | 148 } |
| 149 return SkImageGenerator::kSuccess; | 149 return SkImageGenerator::kSuccess; |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool SkWbmpCodec::IsWbmp(SkStream* stream) { | 152 bool SkWbmpCodec::IsWbmp(SkStream* stream) { |
| 153 return read_header(stream, NULL); | 153 return read_header(stream, NULL); |
| 154 } | 154 } |
| 155 | 155 |
| 156 SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) { | 156 SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) { |
| 157 SkAutoTDelete<SkStream> streamDeleter(stream); |
| 157 SkISize size; | 158 SkISize size; |
| 158 if (!read_header(stream, &size)) { | 159 if (!read_header(stream, &size)) { |
| 159 return NULL; | 160 return NULL; |
| 160 } | 161 } |
| 161 SkImageInfo info = | 162 SkImageInfo info = |
| 162 SkImageInfo::Make(size.width(), size.height(), kGray_8_SkColorType, | 163 SkImageInfo::Make(size.width(), size.height(), kGray_8_SkColorType, |
| 163 kOpaque_SkAlphaType); | 164 kOpaque_SkAlphaType); |
| 164 return SkNEW_ARGS(SkWbmpCodec, (info, stream)); | 165 return SkNEW_ARGS(SkWbmpCodec, (info, streamDeleter.detach())); |
| 165 } | 166 } |
| OLD | NEW |