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

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

Issue 12604006: Upstream Android modifications to the image encoders/decoders. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: addressing robert's comments Created 7 years, 9 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 | Annotate | Revision Log
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 9
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 Mode mode) 100 Mode mode)
101 { 101 {
102 wbmp_head head; 102 wbmp_head head;
103 103
104 if (!head.init(stream)) { 104 if (!head.init(stream)) {
105 return false; 105 return false;
106 } 106 }
107 107
108 int width = head.fWidth; 108 int width = head.fWidth;
109 int height = head.fHeight; 109 int height = head.fHeight;
110
111 if (SkImageDecoder::kDecodeBounds_Mode == mode) {
112 decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height);
113 decodedBitmap->setIsOpaque(true);
114 return true;
115 }
110 116
111 // assign these directly, in case we return kDimensions_Result 117 // No Bitmap reuse supported for this format
118 if (!decodedBitmap->isNull()) {
119 return false;
120 }
121
112 decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height); 122 decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height);
113 decodedBitmap->setIsOpaque(true); 123 decodedBitmap->setIsOpaque(true);
114 124
115 if (SkImageDecoder::kDecodeBounds_Mode == mode)
116 return true;
117
118 const SkPMColor colors[] = { SK_ColorBLACK, SK_ColorWHITE }; 125 const SkPMColor colors[] = { SK_ColorBLACK, SK_ColorWHITE };
119 SkColorTable* ct = SkNEW_ARGS(SkColorTable, (colors, 2)); 126 SkColorTable* ct = SkNEW_ARGS(SkColorTable, (colors, 2));
120 SkAutoUnref aur(ct); 127 SkAutoUnref aur(ct);
121 128
122 if (!this->allocPixelRef(decodedBitmap, ct)) { 129 if (!this->allocPixelRef(decodedBitmap, ct)) {
123 return false; 130 return false;
124 } 131 }
125 132
126 SkAutoLockPixels alp(*decodedBitmap); 133 SkAutoLockPixels alp(*decodedBitmap);
127 134
(...skipping 26 matching lines...) Expand all
154 static SkImageDecoder* sk_wbmp_dfactory(SkStream* stream) { 161 static SkImageDecoder* sk_wbmp_dfactory(SkStream* stream) {
155 wbmp_head head; 162 wbmp_head head;
156 163
157 if (head.init(stream)) { 164 if (head.init(stream)) {
158 return SkNEW(SkWBMPImageDecoder); 165 return SkNEW(SkWBMPImageDecoder);
159 } 166 }
160 return NULL; 167 return NULL;
161 } 168 }
162 169
163 static SkTRegistry<SkImageDecoder*, SkStream*> gReg(sk_wbmp_dfactory); 170 static SkTRegistry<SkImageDecoder*, SkStream*> gReg(sk_wbmp_dfactory);
OLDNEW
« src/images/SkImageDecoder_libwebp.cpp ('K') | « src/images/SkImageDecoder_libwebp.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698