'../include/private',
'../src/android',
'../src/codec',
- '../src/core',
],
'sources': [
'../src/android/SkBitmapRegionCanvas.cpp',
#include "../private/SkTemplates.h"
#include "SkColor.h"
-#include "SkColorSpace.h"
#include "SkEncodedFormat.h"
#include "SkImageInfo.h"
#include "SkSize.h"
#include "SkStream.h"
#include "SkTypes.h"
+class SkColorSpace;
class SkData;
class SkPngChunkReader;
class SkSampler;
* Does not affect ownership.
* Might be NULL.
*/
- SkColorSpace* getColorSpace() const { return fColorSpace; }
+ SkColorSpace* getColorSpace() const { return fColorSpace.get(); }
/**
* Return a size that approximately supports the desired scale factor.
* Takes ownership of SkStream*
* Does not affect ownership of SkColorSpace*
*/
- SkCodec(const SkImageInfo&, SkStream*, SkColorSpace* = nullptr);
+ SkCodec(const SkImageInfo&, SkStream*, sk_sp<SkColorSpace> = nullptr);
virtual SkISize onGetScaledDimensions(float /*desiredScale*/) const {
// By default, scaling is not supported.
const SkImageInfo fSrcInfo;
SkAutoTDelete<SkStream> fStream;
bool fNeedsRewind;
- SkAutoTUnref<SkColorSpace> fColorSpace;
+ sk_sp<SkColorSpace> fColorSpace;
// These fields are only meaningful during scanline decodes.
SkImageInfo fDstInfo;
#define SkBmpCodec_DEFINED
#include "SkCodec.h"
+#include "SkColorSpace.h"
#include "SkColorTable.h"
#include "SkImageInfo.h"
#include "SkStream.h"
#include "SkBmpCodec.h"
#include "SkCodec.h"
#include "SkCodecPriv.h"
+#include "SkColorSpace.h"
#include "SkData.h"
#include "SkGifCodec.h"
#include "SkIcoCodec.h"
return NewFromStream(new SkMemoryStream(data), reader);
}
-SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream, SkColorSpace* colorSpace)
+SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream, sk_sp<SkColorSpace> colorSpace)
: fSrcInfo(info)
, fStream(stream)
, fNeedsRewind(false)
- , fColorSpace(colorSpace ? SkRef(colorSpace) : nullptr)
+ , fColorSpace(colorSpace)
, fDstInfo()
, fOptions()
, fCurrScanline(-1)
*/
#include "SkCodec.h"
+#include "SkColorSpace.h"
#include "SkColorTable.h"
#include "SkImageInfo.h"
#include "SkSwizzler.h"
#define SkJpegCodec_DEFINED
#include "SkCodec.h"
+#include "SkColorSpace.h"
#include "SkImageInfo.h"
#include "SkSwizzler.h"
#include "SkStream.h"
* 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"
// 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) {
#if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 6)
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)
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)
{}
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)
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,
}
SkPngCodec(const SkImageInfo&, SkStream*, SkPngChunkReader*, png_structp, png_infop, int, int,
- SkColorSpace*);
+ sk_sp<SkColorSpace>);
png_structp png_ptr() { return fPng_ptr; }
SkSwizzler* swizzler() { return fSwizzler; }
#define SkRawCodec_DEFINED
#include "SkCodec.h"
+#include "SkColorSpace.h"
#include "SkImageInfo.h"
#include "SkTypes.h"
#define SkCodec_wbmp_DEFINED
#include "SkCodec.h"
+#include "SkColorSpace.h"
#include "SkSwizzler.h"
class SkWbmpCodec final : public SkCodec {
#define SkWebpCodec_DEFINED
#include "SkCodec.h"
+#include "SkColorSpace.h"
#include "SkEncodedFormat.h"
#include "SkImageInfo.h"
#include "SkTypes.h"
}
}
-SkColorSpace* SkColorSpace::NewRGB(const SkFloat3x3& toXYZD50, const SkFloat3& gamma) {
+sk_sp<SkColorSpace> SkColorSpace::NewRGB(const SkFloat3x3& toXYZD50, const SkFloat3& gamma) {
for (int i = 0; i < 3; ++i) {
if (!SkFloatIsFinite(gamma.fVec[i]) || gamma.fVec[i] < 0) {
return nullptr;
return nullptr;
}
- return new SkColorSpace(toXYZD50, gamma, kUnknown_Named);
+ return sk_sp<SkColorSpace>(new SkColorSpace(toXYZD50, gamma, kUnknown_Named));
}
void SkColorSpace::dump() const {
0.1430f, 0.0606f, 0.7139f, // * B
}};
-SkColorSpace* SkColorSpace::NewNamed(Named named) {
+sk_sp<SkColorSpace> SkColorSpace::NewNamed(Named named) {
switch (named) {
case kDevice_Named:
- return new SkColorSpace(gDevice_toXYZD50, gDevice_gamma, kDevice_Named);
+ return sk_sp<SkColorSpace>(new SkColorSpace(gDevice_toXYZD50, gDevice_gamma,
+ kDevice_Named));
case kSRGB_Named:
- return new SkColorSpace(gSRGB_toXYZD50, gSRGB_gamma, kSRGB_Named);
+ return sk_sp<SkColorSpace>(new SkColorSpace(gSRGB_toXYZD50, gSRGB_gamma, kSRGB_Named));
default:
break;
}
}
}
-SkColorSpace* SkColorSpace::NewICC(const void* base, size_t len) {
+sk_sp<SkColorSpace> SkColorSpace::NewICC(const void* base, size_t len) {
const uint8_t* ptr = (const uint8_t*) base;
if (len < kICCHeaderSize) {
concat(inv, mat).dump();
SkDebugf("\n");
- SkAutoTUnref<SkColorSpace> cs0(SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named));
- SkAutoTUnref<SkColorSpace> cs1(SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named));
+ sk_sp<SkColorSpace> cs0(SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named));
+ sk_sp<SkColorSpace> cs1(SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named));
cs0->dump();
cs1->dump();
SkFloat3x3 xform;
- (void)SkColorSpace::Concat(cs0, cs1, &xform);
+ (void)SkColorSpace::Concat(cs0.get(), cs1.get(), &xform);
xform.dump();
SkDebugf("\n");
}
* Return a colorspace instance, given a 3x3 transform from linear_RGB to D50_XYZ
* and the src-gamma, return a ColorSpace
*/
- static SkColorSpace* NewRGB(const SkFloat3x3& toXYZD50, const SkFloat3& gamma);
+ static sk_sp<SkColorSpace> NewRGB(const SkFloat3x3& toXYZD50, const SkFloat3& gamma);
- static SkColorSpace* NewNamed(Named);
- static SkColorSpace* NewICC(const void*, size_t);
+ static sk_sp<SkColorSpace> NewNamed(Named);
+ static sk_sp<SkColorSpace> NewICC(const void*, size_t);
SkFloat3 gamma() const { return fGamma; }
SkFloat3x3 xyz() const { return fToXYZD50; }