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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp

Issue 2454123002: Refactor image decoders to use 'colorSpace' instead of 'colorProfile' (Closed)
Patch Set: Fix legacy ImageFrame Created 4 years, 2 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
Index: third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
index a62866e9a8cdac6513f7bedca484daa3b5dd073a..9d0791f64778280dbc797795ed0a02a0bf8a3686 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
@@ -103,27 +103,24 @@ bool ImageFrame::takeBitmapDataIfWritable(ImageFrame* other) {
return true;
}
-bool ImageFrame::setSizeAndColorProfile(int newWidth,
- int newHeight,
- const ICCProfile& newIccProfile) {
+bool ImageFrame::setSizeAndColorSpace(int newWidth,
+ int newHeight,
+ sk_sp<SkColorSpace> colorSpace) {
// setSizeAndColorProfile() should only be called once, it leaks memory
// otherwise.
ASSERT(!width() && !height());
- sk_sp<SkColorSpace> colorSpace;
if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) {
- if (newIccProfile.isEmpty())
+ if (!colorSpace)
colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
- else
- colorSpace =
- SkColorSpace::NewICC(newIccProfile.data(), newIccProfile.size());
- DCHECK(colorSpace);
+ } else {
+ colorSpace = nullptr;
}
m_bitmap.setInfo(SkImageInfo::MakeN32(
newWidth, newHeight,
m_premultiplyAlpha ? kPremul_SkAlphaType : kUnpremul_SkAlphaType,
- colorSpace));
+ std::move(colorSpace)));
if (!m_bitmap.tryAllocPixels(m_allocator, 0))
return false;

Powered by Google App Engine
This is Rietveld 408576698