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

Side by Side Diff: src/images/SkImageDecoder_wbmp.cpp

Issue 670453002: Remove image decoder and encoder autoregistration (Closed) Base URL: https://skia.googlesource.com/skia.git@separate-image-decoder-01-skpicture
Patch Set: Created 6 years, 2 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkImageDecoder_wbmp.h"
9 10
10 #include "SkImageDecoder.h"
11 #include "SkColor.h" 11 #include "SkColor.h"
12 #include "SkColorPriv.h" 12 #include "SkColorPriv.h"
13 #include "SkMath.h" 13 #include "SkMath.h"
14 #include "SkStream.h" 14 #include "SkStream.h"
15 #include "SkTemplates.h" 15 #include "SkTemplates.h"
16 #include "SkUtils.h" 16 #include "SkUtils.h"
17 17
18 class SkWBMPImageDecoder : public SkImageDecoder { 18 class SkWBMPImageDecoder : public SkImageDecoder {
19 public: 19 public:
20 virtual Format getFormat() const SK_OVERRIDE { 20 virtual Format getFormat() const SK_OVERRIDE {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 for (int y = 0; y < height; y++) 141 for (int y = 0; y < height; y++)
142 { 142 {
143 expand_bits_to_bytes(dst, src, width); 143 expand_bits_to_bytes(dst, src, width);
144 dst += decodedBitmap->rowBytes(); 144 dst += decodedBitmap->rowBytes();
145 src += srcRB; 145 src += srcRB;
146 } 146 }
147 147
148 return true; 148 return true;
149 } 149 }
150 150
151 /////////////////////////////////////////////////////////////////////////////// 151 SkImageDecoder::Format SkDetectFormatWBMPImageDecoder(SkStreamRewindable* stream ) {
152 DEFINE_DECODER_CREATOR(WBMPImageDecoder);
153 ///////////////////////////////////////////////////////////////////////////////
154
155 static SkImageDecoder* sk_wbmp_dfactory(SkStreamRewindable* stream) {
156 wbmp_head head;
157
158 if (head.init(stream)) {
159 return SkNEW(SkWBMPImageDecoder);
160 }
161 return NULL;
162 }
163
164 static SkImageDecoder::Format get_format_wbmp(SkStreamRewindable* stream) {
165 wbmp_head head; 152 wbmp_head head;
166 if (head.init(stream)) { 153 if (head.init(stream)) {
167 return SkImageDecoder::kWBMP_Format; 154 return SkImageDecoder::kWBMP_Format;
168 } 155 }
169 return SkImageDecoder::kUnknown_Format; 156 return SkImageDecoder::kUnknown_Format;
170 } 157 }
171 158
172 static SkImageDecoder_DecodeReg gDReg(sk_wbmp_dfactory); 159 SkImageDecoder* SkCreateWBMPImageDecoder(SkStreamRewindable* stream) {
173 static SkImageDecoder_FormatReg gFormatReg(get_format_wbmp); 160 if (SkDetectFormatWBMPImageDecoder(stream) == SkImageDecoder::kWBMP_Format) {
161 return SkNEW(SkWBMPImageDecoder);
162 }
163 return NULL;
164 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698