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

Side by Side Diff: src/core/SkImageGenerator.cpp

Issue 1495693003: Index8 GPU and CPU raster support. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "SkImageGenerator.h" 8 #include "SkImageGenerator.h"
9 #include "SkNextID.h" 9 #include "SkNextID.h"
10 10
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 170 }
171 171
172 bitmap->lockPixels(); 172 bitmap->lockPixels();
173 if (!bitmap->getPixels()) { 173 if (!bitmap->getPixels()) {
174 return reset_and_return_false(bitmap); 174 return reset_and_return_false(bitmap);
175 } 175 }
176 176
177 int ctCount = 0; 177 int ctCount = 0;
178 if (!this->getPixels(bitmap->info(), bitmap->getPixels(), bitmap->rowBytes() , 178 if (!this->getPixels(bitmap->info(), bitmap->getPixels(), bitmap->rowBytes() ,
179 ctStorage, &ctCount)) { 179 ctStorage, &ctCount)) {
180 // Generator failing to decode to declared colorType, could decode to N3 2.
181 // This is important for Chromium Index8 decoding - GIF multiframe anima tion frames are
182 // decoded to Index8 format by default but in rare cases some of the fra mes are N32.
183 if (bitmap->colorType() != kN32_SkColorType) {
184 bitmap->reset();
185 info = SkImageInfo::MakeN32(info.width(), info.height(), info.alphaT ype());
186 return tryGenerateBitmap(bitmap, &info, allocator);
187 }
180 return reset_and_return_false(bitmap); 188 return reset_and_return_false(bitmap);
181 } 189 }
182 190
183 if (ctCount > 0) { 191 if (ctCount > 0) {
184 SkASSERT(kIndex_8_SkColorType == bitmap->colorType()); 192 SkASSERT(kIndex_8_SkColorType == bitmap->colorType());
185 // we and bitmap should be owners 193 // we and bitmap should be owners
186 SkASSERT(!ctable->unique()); 194 SkASSERT(!ctable->unique());
187 195
188 // Now we need to overwrite the ctable we built earlier, with the correc t colors. 196 // Now we need to overwrite the ctable we built earlier, with the correc t colors.
189 // This does mean that we may have made the table too big, but that cann ot be avoided 197 // This does mean that we may have made the table too big, but that cann ot be avoided
(...skipping 24 matching lines...) Expand all
214 if (nullptr == data) { 222 if (nullptr == data) {
215 return nullptr; 223 return nullptr;
216 } 224 }
217 if (gFactory) { 225 if (gFactory) {
218 if (SkImageGenerator* generator = gFactory(data)) { 226 if (SkImageGenerator* generator = gFactory(data)) {
219 return generator; 227 return generator;
220 } 228 }
221 } 229 }
222 return SkImageGenerator::NewFromEncodedImpl(data); 230 return SkImageGenerator::NewFromEncodedImpl(data);
223 } 231 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/gpu/SkGr.cpp » ('j') | src/gpu/SkGr.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698