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

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

Issue 24882002: Do not convert non gray PNG to A8. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: respond to comments Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 //SkASSERT(!*hasAlphap); 528 //SkASSERT(!*hasAlphap);
529 } 529 }
530 530
531 *configp = this->getPrefConfig(srcDepth, *hasAlphap); 531 *configp = this->getPrefConfig(srcDepth, *hasAlphap);
532 // now match the request against our capabilities 532 // now match the request against our capabilities
533 if (*hasAlphap) { 533 if (*hasAlphap) {
534 if (*configp != SkBitmap::kARGB_4444_Config) { 534 if (*configp != SkBitmap::kARGB_4444_Config) {
535 *configp = SkBitmap::kARGB_8888_Config; 535 *configp = SkBitmap::kARGB_8888_Config;
536 } 536 }
537 } else { 537 } else {
538 if (*configp != SkBitmap::kRGB_565_Config && 538 if (SkBitmap::kA8_Config == *configp) {
539 *configp != SkBitmap::kARGB_4444_Config && 539 if (k8BitGray_SrcDepth != srcDepth) {
540 *configp != SkBitmap::kA8_Config) { 540 // Converting a non grayscale image to A8 is not currently s upported.
541 *configp = SkBitmap::kARGB_8888_Config;
542 }
543 } else if (*configp != SkBitmap::kRGB_565_Config &&
544 *configp != SkBitmap::kARGB_4444_Config) {
541 *configp = SkBitmap::kARGB_8888_Config; 545 *configp = SkBitmap::kARGB_8888_Config;
542 } 546 }
543 } 547 }
544 } 548 }
545 549
546 // sanity check for size 550 // sanity check for size
547 { 551 {
548 Sk64 size; 552 Sk64 size;
549 size.setMul(origWidth, origHeight); 553 size.setMul(origWidth, origHeight);
550 if (size.isNeg() || !size.is32()) { 554 if (size.isNeg() || !size.is32()) {
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 return SkImageDecoder::kUnknown_Format; 1201 return SkImageDecoder::kUnknown_Format;
1198 } 1202 }
1199 1203
1200 SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) { 1204 SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) {
1201 return (SkImageEncoder::kPNG_Type == t) ? SkNEW(SkPNGImageEncoder) : NULL; 1205 return (SkImageEncoder::kPNG_Type == t) ? SkNEW(SkPNGImageEncoder) : NULL;
1202 } 1206 }
1203 1207
1204 static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory); 1208 static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory);
1205 static SkImageDecoder_FormatReg gFormatReg(get_format_png); 1209 static SkImageDecoder_FormatReg gFormatReg(get_format_png);
1206 static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory); 1210 static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698