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

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

Issue 17620004: Remove bitmap reuse from SkImageDecoder. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add documentation. Created 7 years, 5 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
« no previous file with comments | « src/images/SkImageDecoder_libwebp.cpp ('k') | src/ports/SkImageDecoder_empty.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 { 104 {
105 wbmp_head head; 105 wbmp_head head;
106 106
107 if (!head.init(stream)) { 107 if (!head.init(stream)) {
108 return false; 108 return false;
109 } 109 }
110 110
111 int width = head.fWidth; 111 int width = head.fWidth;
112 int height = head.fHeight; 112 int height = head.fHeight;
113 113
114 if (SkImageDecoder::kDecodeBounds_Mode == mode) {
115 decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height);
116 decodedBitmap->setIsOpaque(true);
117 return true;
118 }
119
120 // No Bitmap reuse supported for this format
121 if (!decodedBitmap->isNull()) {
122 return false;
123 }
124
125 decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height); 114 decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height);
126 decodedBitmap->setIsOpaque(true); 115 decodedBitmap->setIsOpaque(true);
127 116
117 if (SkImageDecoder::kDecodeBounds_Mode == mode) {
118 return true;
119 }
120
128 const SkPMColor colors[] = { SK_ColorBLACK, SK_ColorWHITE }; 121 const SkPMColor colors[] = { SK_ColorBLACK, SK_ColorWHITE };
129 SkColorTable* ct = SkNEW_ARGS(SkColorTable, (colors, 2)); 122 SkColorTable* ct = SkNEW_ARGS(SkColorTable, (colors, 2));
130 SkAutoUnref aur(ct); 123 SkAutoUnref aur(ct);
131 124
132 if (!this->allocPixelRef(decodedBitmap, ct)) { 125 if (!this->allocPixelRef(decodedBitmap, ct)) {
133 return false; 126 return false;
134 } 127 }
135 128
136 SkAutoLockPixels alp(*decodedBitmap); 129 SkAutoLockPixels alp(*decodedBitmap);
137 130
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 static SkImageDecoder::Format get_format_wbmp(SkStream* stream) { 166 static SkImageDecoder::Format get_format_wbmp(SkStream* stream) {
174 wbmp_head head; 167 wbmp_head head;
175 if (head.init(stream)) { 168 if (head.init(stream)) {
176 return SkImageDecoder::kWBMP_Format; 169 return SkImageDecoder::kWBMP_Format;
177 } 170 }
178 return SkImageDecoder::kUnknown_Format; 171 return SkImageDecoder::kUnknown_Format;
179 } 172 }
180 173
181 static SkTRegistry<SkImageDecoder*, SkStream*> gReg(sk_wbmp_dfactory); 174 static SkTRegistry<SkImageDecoder*, SkStream*> gReg(sk_wbmp_dfactory);
182 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_wbmp ); 175 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_wbmp );
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libwebp.cpp ('k') | src/ports/SkImageDecoder_empty.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698