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

Unified Diff: src/codec/SkCodec_libpng.cpp

Issue 1224453002: Changing name of has_transpareny_in_palette to has_transparency_in_tRNS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: calling has_transparency_in_tRNS Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkCodec_libpng.cpp
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index a14a67c3497856a908a406b76700cc642bff2599..a5d38343138acf1718bb4fc56320c71f760f9a52 100644
--- a/src/codec/SkCodec_libpng.cpp
+++ b/src/codec/SkCodec_libpng.cpp
@@ -100,8 +100,9 @@ private:
};
#define AutoCleanPng(...) SK_REQUIRE_LOCAL_VAR(AutoCleanPng)
-// call only if color_type is PALETTE. Returns true if the ctable has alpha
-static bool has_transparency_in_palette(png_structp png_ptr,
+//checks if there is transparency info in the tRNS chunk
+//image types which could have data in the tRNS chunk include: Index8, Gray8, RGB
+static bool has_transparency_in_tRNS(png_structp png_ptr,
png_infop info_ptr) {
if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
return false;
@@ -287,11 +288,11 @@ static bool read_header(SkStream* stream, png_structp* png_ptrp,
switch (colorType) {
case PNG_COLOR_TYPE_PALETTE:
skColorType = kIndex_8_SkColorType;
- skAlphaType = has_transparency_in_palette(png_ptr, info_ptr) ?
+ skAlphaType = has_transparency_in_tRNS(png_ptr, info_ptr) ?
kUnpremul_SkAlphaType : kOpaque_SkAlphaType;
break;
case PNG_COLOR_TYPE_RGB:
- if (has_transparency_in_palette(png_ptr, info_ptr)) {
+ if (has_transparency_in_tRNS(png_ptr, info_ptr)) {
//convert to RGBA with tranparency information in tRNS chunk if it exists
png_set_tRNS_to_alpha(png_ptr);
skAlphaType = kUnpremul_SkAlphaType;
@@ -303,7 +304,7 @@ static bool read_header(SkStream* stream, png_structp* png_ptrp,
skColorType = kN32_SkColorType;
break;
case PNG_COLOR_TYPE_GRAY:
- if (has_transparency_in_palette(png_ptr, info_ptr)) {
+ if (has_transparency_in_tRNS(png_ptr, info_ptr)) {
//FIXME: support gray with alpha as a color type
//convert to RGBA if there is transparentcy info in the tRNS chunk
png_set_tRNS_to_alpha(png_ptr);
« 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