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

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

Issue 2332743003: Disable png encodes from Alpha8, Float16 (Closed)
Patch Set: Created 4 years, 3 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
« 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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkImageEncoder.h" 8 #include "SkImageEncoder.h"
9 #include "SkColor.h" 9 #include "SkColor.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 SkAlphaType alphaType, int colorType, 177 SkAlphaType alphaType, int colorType,
178 int bitDepth, SkColorType ct, 178 int bitDepth, SkColorType ct,
179 png_color_8& sig_bit); 179 png_color_8& sig_bit);
180 180
181 typedef SkImageEncoder INHERITED; 181 typedef SkImageEncoder INHERITED;
182 }; 182 };
183 183
184 bool SkPNGImageEncoder::onEncode(SkWStream* stream, 184 bool SkPNGImageEncoder::onEncode(SkWStream* stream,
185 const SkBitmap& originalBitmap, 185 const SkBitmap& originalBitmap,
186 int /*quality*/) { 186 int /*quality*/) {
187 SkBitmap copy; 187 SkBitmap copy;
scroggo 2016/09/12 17:23:29 It looks like "copy" is no longer used.
msarett 2016/09/12 18:03:44 Removed.
188 const SkBitmap* bitmap = &originalBitmap; 188 const SkBitmap* bitmap = &originalBitmap;
189 switch (originalBitmap.colorType()) { 189 switch (originalBitmap.colorType()) {
190 case kIndex_8_SkColorType: 190 case kIndex_8_SkColorType:
191 case kGray_8_SkColorType: 191 case kGray_8_SkColorType:
192 case kRGBA_8888_SkColorType: 192 case kRGBA_8888_SkColorType:
193 case kBGRA_8888_SkColorType: 193 case kBGRA_8888_SkColorType:
194 case kARGB_4444_SkColorType: 194 case kARGB_4444_SkColorType:
195 case kRGB_565_SkColorType: 195 case kRGB_565_SkColorType:
196 break; 196 break;
197 default: 197 default:
198 // TODO(scroggo): support Alpha_8 as Grayscale(black)+Alpha 198 return false;
199 if (originalBitmap.copyTo(&copy, kN32_SkColorType)) {
200 bitmap = ©
201 }
202 } 199 }
203 SkColorType ct = bitmap->colorType(); 200 SkColorType ct = bitmap->colorType();
204 201
205 SkAlphaType alphaType = bitmap->alphaType(); 202 SkAlphaType alphaType = bitmap->alphaType();
206 switch (alphaType) { 203 switch (alphaType) {
207 case kUnpremul_SkAlphaType: 204 case kUnpremul_SkAlphaType:
208 if (kARGB_4444_SkColorType == ct) { 205 if (kARGB_4444_SkColorType == ct) {
209 return false; 206 return false;
210 } 207 }
211 208
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 358
362 /////////////////////////////////////////////////////////////////////////////// 359 ///////////////////////////////////////////////////////////////////////////////
363 DEFINE_ENCODER_CREATOR(PNGImageEncoder); 360 DEFINE_ENCODER_CREATOR(PNGImageEncoder);
364 /////////////////////////////////////////////////////////////////////////////// 361 ///////////////////////////////////////////////////////////////////////////////
365 362
366 SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) { 363 SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) {
367 return (SkImageEncoder::kPNG_Type == t) ? new SkPNGImageEncoder : nullptr; 364 return (SkImageEncoder::kPNG_Type == t) ? new SkPNGImageEncoder : nullptr;
368 } 365 }
369 366
370 static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory); 367 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