diff options
author | msarett <msarett@google.com> | 2016-05-27 07:39:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-27 07:39:02 -0700 |
commit | 23c5110ba291cfc303e3fdc73af99cd3d595df67 (patch) | |
tree | e91dd207442d664baed99bdce4579011203908ba /src/core | |
parent | 85f758c33446eaccfadc12292fa5a0e71d7661b9 (diff) |
Add SkColorSpace to SkImageInfo
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=2000713003
Review-Url: https://codereview.chromium.org/2000713003
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkBitmap.cpp | 2 | ||||
-rw-r--r-- | src/core/SkImageInfo.cpp | 5 | ||||
-rw-r--r-- | src/core/SkMipMap.cpp | 2 |
3 files changed, 8 insertions, 1 deletions
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()); |