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

Side by Side Diff: src/codec/SkPngCodec.cpp

Issue 2009813003: Assign sRGB color space to unmarked jpegs and pngs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 | « src/codec/SkJpegCodec.cpp ('k') | 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 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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 autoClean.release(); 601 autoClean.release();
602 if (png_ptrp) { 602 if (png_ptrp) {
603 *png_ptrp = png_ptr; 603 *png_ptrp = png_ptr;
604 } 604 }
605 if (info_ptrp) { 605 if (info_ptrp) {
606 *info_ptrp = info_ptr; 606 *info_ptrp = info_ptr;
607 } 607 }
608 608
609 if (outCodec) { 609 if (outCodec) {
610 sk_sp<SkColorSpace> colorSpace = read_color_space(png_ptr, info_ptr); 610 sk_sp<SkColorSpace> colorSpace = read_color_space(png_ptr, info_ptr);
611 if (!colorSpace) {
612 // Treat unmarked pngs as sRGB.
613 colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
614 }
615
611 SkEncodedInfo info = SkEncodedInfo::Make(color, alpha, 8); 616 SkEncodedInfo info = SkEncodedInfo::Make(color, alpha, 8);
612 617
613 if (1 == numberPasses) { 618 if (1 == numberPasses) {
614 *outCodec = new SkPngScanlineDecoder(origWidth, origHeight, info, st ream, 619 *outCodec = new SkPngScanlineDecoder(origWidth, origHeight, info, st ream,
615 chunkReader, png_ptr, info_ptr, bitDepth, colorSpace); 620 chunkReader, png_ptr, info_ptr, bitDepth, colorSpace);
616 } else { 621 } else {
617 *outCodec = new SkPngInterlacedScanlineDecoder(origWidth, origHeight , info, stream, 622 *outCodec = new SkPngInterlacedScanlineDecoder(origWidth, origHeight , info, stream,
618 chunkReader, png_ptr, info_ptr, bitDepth, numberPasses, colo rSpace); 623 chunkReader, png_ptr, info_ptr, bitDepth, numberPasses, colo rSpace);
619 } 624 }
620 } 625 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 SkCodec* outCodec; 807 SkCodec* outCodec;
803 if (read_header(stream, chunkReader, &outCodec, nullptr, nullptr)) { 808 if (read_header(stream, chunkReader, &outCodec, nullptr, nullptr)) {
804 // Codec has taken ownership of the stream. 809 // Codec has taken ownership of the stream.
805 SkASSERT(outCodec); 810 SkASSERT(outCodec);
806 streamDeleter.release(); 811 streamDeleter.release();
807 return outCodec; 812 return outCodec;
808 } 813 }
809 814
810 return nullptr; 815 return nullptr;
811 } 816 }
OLDNEW
« no previous file with comments | « src/codec/SkJpegCodec.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698