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

Unified Diff: src/codec/SkPngCodec.cpp

Issue 1766413002: Use a smart pointer for SkColorSpace factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix spacing Created 4 years, 9 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 | « src/codec/SkPngCodec.h ('k') | src/codec/SkRawCodec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkPngCodec.cpp
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 1b51432e5ec1c1bb143ca69972d08968ce1a8c5f..5e155dab7ec417ab4be1796c2dd02c467ccc3e6f 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -5,10 +5,11 @@
* found in the LICENSE file.
*/
+#include "SkBitmap.h"
#include "SkCodecPriv.h"
#include "SkColorPriv.h"
+#include "SkColorSpace.h"
#include "SkColorTable.h"
-#include "SkBitmap.h"
#include "SkMath.h"
#include "SkOpts.h"
#include "SkPngCodec.h"
@@ -176,7 +177,7 @@ static float png_fixed_point_to_float(png_fixed_point x) {
// Returns a colorSpace object that represents any color space information in
// the encoded data. If the encoded data contains no color space, this will
// return NULL.
-SkColorSpace* read_color_space(png_structp png_ptr, png_infop info_ptr) {
+sk_sp<SkColorSpace> read_color_space(png_structp png_ptr, png_infop info_ptr) {
// First check for an ICC profile
png_bytep profile;
@@ -422,7 +423,7 @@ static bool read_header(SkStream* stream, SkPngChunkReader* chunkReader,
SkPngCodec::SkPngCodec(const SkImageInfo& info, SkStream* stream, SkPngChunkReader* chunkReader,
png_structp png_ptr, png_infop info_ptr, int bitDepth, int numberPasses,
- SkColorSpace* colorSpace)
+ sk_sp<SkColorSpace> colorSpace)
: INHERITED(info, stream, colorSpace)
, fPngChunkReader(SkSafeRef(chunkReader))
, fPng_ptr(png_ptr)
@@ -634,7 +635,7 @@ class SkPngScanlineDecoder : public SkPngCodec {
public:
SkPngScanlineDecoder(const SkImageInfo& srcInfo, SkStream* stream,
SkPngChunkReader* chunkReader, png_structp png_ptr, png_infop info_ptr, int bitDepth,
- SkColorSpace* colorSpace)
+ sk_sp<SkColorSpace> colorSpace)
: INHERITED(srcInfo, stream, chunkReader, png_ptr, info_ptr, bitDepth, 1, colorSpace)
, fSrcRow(nullptr)
{}
@@ -700,7 +701,7 @@ class SkPngInterlacedScanlineDecoder : public SkPngCodec {
public:
SkPngInterlacedScanlineDecoder(const SkImageInfo& srcInfo, SkStream* stream,
SkPngChunkReader* chunkReader, png_structp png_ptr, png_infop info_ptr,
- int bitDepth, int numberPasses, SkColorSpace* colorSpace)
+ int bitDepth, int numberPasses, sk_sp<SkColorSpace> colorSpace)
: INHERITED(srcInfo, stream, chunkReader, png_ptr, info_ptr, bitDepth, numberPasses,
colorSpace)
, fHeight(-1)
@@ -833,7 +834,7 @@ SkCodec* SkPngCodec::NewFromStream(SkStream* stream, SkPngChunkReader* chunkRead
return nullptr;
}
- SkAutoTUnref<SkColorSpace> colorSpace(read_color_space(png_ptr, info_ptr));
+ auto colorSpace = read_color_space(png_ptr, info_ptr);
if (1 == numberPasses) {
return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunkReader,
« no previous file with comments | « src/codec/SkPngCodec.h ('k') | src/codec/SkRawCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698