OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 return false; | 1104 return false; |
1105 } | 1105 } |
1106 png_read_update_info(fPng_ptr, fInfo_ptr); | 1106 png_read_update_info(fPng_ptr, fInfo_ptr); |
1107 | 1107 |
1108 // Reset fSwizzler and fColorXform. We can't do this in onRewind() because
the | 1108 // Reset fSwizzler and fColorXform. We can't do this in onRewind() because
the |
1109 // interlaced scanline decoder may need to rewind. | 1109 // interlaced scanline decoder may need to rewind. |
1110 fSwizzler.reset(nullptr); | 1110 fSwizzler.reset(nullptr); |
1111 fColorXform = nullptr; | 1111 fColorXform = nullptr; |
1112 | 1112 |
1113 if (needs_color_xform(dstInfo, this->getInfo())) { | 1113 if (needs_color_xform(dstInfo, this->getInfo())) { |
1114 fColorXform = SkColorSpaceXform::New(sk_ref_sp(this->getInfo().colorSpac
e()), | 1114 fColorXform = SkColorSpaceXform::New(this->getInfo().colorSpace(), dstIn
fo.colorSpace()); |
1115 sk_ref_sp(dstInfo.colorSpace())); | |
1116 SkASSERT(fColorXform); | 1115 SkASSERT(fColorXform); |
1117 } | 1116 } |
1118 | 1117 |
1119 // If the image is RGBA and we have a color xform, we can skip the swizzler. | 1118 // If the image is RGBA and we have a color xform, we can skip the swizzler. |
1120 // FIXME (msarett): | 1119 // FIXME (msarett): |
1121 // Support more input types to fColorXform (ex: RGB, Gray) and skip the swiz
zler more often. | 1120 // Support more input types to fColorXform (ex: RGB, Gray) and skip the swiz
zler more often. |
1122 if (fColorXform && SkEncodedInfo::kRGBA_Color == this->getEncodedInfo().colo
r() && | 1121 if (fColorXform && SkEncodedInfo::kRGBA_Color == this->getEncodedInfo().colo
r() && |
1123 !options.fSubset) | 1122 !options.fSubset) |
1124 { | 1123 { |
1125 fXformMode = kColorOnly_XformMode; | 1124 fXformMode = kColorOnly_XformMode; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 SkCodec* outCodec = nullptr; | 1298 SkCodec* outCodec = nullptr; |
1300 if (read_header(streamDeleter.get(), chunkReader, &outCodec, nullptr, nullpt
r)) { | 1299 if (read_header(streamDeleter.get(), chunkReader, &outCodec, nullptr, nullpt
r)) { |
1301 // Codec has taken ownership of the stream. | 1300 // Codec has taken ownership of the stream. |
1302 SkASSERT(outCodec); | 1301 SkASSERT(outCodec); |
1303 streamDeleter.release(); | 1302 streamDeleter.release(); |
1304 return outCodec; | 1303 return outCodec; |
1305 } | 1304 } |
1306 | 1305 |
1307 return nullptr; | 1306 return nullptr; |
1308 } | 1307 } |
OLD | NEW |