aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/codec/SkCodec.cpp4
-rw-r--r--src/core/SkBitmap.cpp2
-rw-r--r--src/core/SkImageInfo.cpp5
-rw-r--r--src/core/SkMipMap.cpp2
4 files changed, 10 insertions, 3 deletions
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index 955c86d609..3da7f5fb07 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -117,10 +117,10 @@ SkCodec* SkCodec::NewFromData(SkData* data, SkPngChunkReader* reader) {
SkCodec::SkCodec(int width, int height, const SkEncodedInfo& info, SkStream* stream,
sk_sp<SkColorSpace> colorSpace, Origin origin)
: fEncodedInfo(info)
- , fSrcInfo(info.makeImageInfo(width, height))
+ , fSrcInfo(info.makeImageInfo(width, height, colorSpace))
, fStream(stream)
, fNeedsRewind(false)
- , fColorSpace(colorSpace)
+ , fColorSpace(std::move(colorSpace))
, fOrigin(origin)
, fDstInfo()
, fOptions()
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 3bb763b4f4..f9deb837fa 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -53,6 +53,7 @@ SkBitmap& SkBitmap::operator=(const SkBitmap& src) {
// inc src reference counts
SkSafeRef(src.fPixelRef);
+ SkSafeRef(src.fInfo.colorSpace());
// we reset our locks if we get blown away
fPixelLockCount = 0;
@@ -97,6 +98,7 @@ void SkBitmap::swap(SkBitmap& other) {
void SkBitmap::reset() {
this->freePixels();
+ this->fInfo.reset();
sk_bzero(this, sizeof(*this));
}
diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp
index 5f0a4919ee..81a68f3de3 100644
--- a/src/core/SkImageInfo.cpp
+++ b/src/core/SkImageInfo.cpp
@@ -30,6 +30,11 @@ static bool color_type_is_valid(SkColorType colorType) {
return (colorType >= 0) && (colorType <= kLastEnum_SkColorType);
}
+SkImageInfo SkImageInfo::Make(int width, int height, SkColorType ct, SkAlphaType at,
+ sk_sp<SkColorSpace> cs) {
+ return SkImageInfo(width, height, ct, at, SkDefaultColorProfile(), std::move(cs));
+}
+
void SkImageInfo::unflatten(SkReadBuffer& buffer) {
fWidth = buffer.read32();
fHeight = buffer.read32();
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp
index f579aae955..c851d64a90 100644
--- a/src/core/SkMipMap.cpp
+++ b/src/core/SkMipMap.cpp
@@ -451,7 +451,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) {
height = SkTMax(1, height >> 1);
rowBytes = SkToU32(SkColorTypeMinRowBytes(ct, width));
- levels[i].fPixmap = SkPixmap(SkImageInfo::Make(width, height, ct, at), addr, rowBytes);
+ new (&levels[i].fPixmap) SkPixmap(SkImageInfo::Make(width, height, ct, at), addr, rowBytes);
levels[i].fScale = SkSize::Make(SkIntToScalar(width) / src.width(),
SkIntToScalar(height) / src.height());