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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h

Issue 2512683003: Create ImageDecoder target color space (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 virtual float frameDurationAtIndex(size_t) const { return 0; } 200 virtual float frameDurationAtIndex(size_t) const { return 0; }
201 201
202 // Number of bytes in the decoded frame. Returns 0 if the decoder doesn't 202 // Number of bytes in the decoded frame. Returns 0 if the decoder doesn't
203 // have this frame cached (either because it hasn't been decoded, or because 203 // have this frame cached (either because it hasn't been decoded, or because
204 // it has been cleared). 204 // it has been cleared).
205 virtual size_t frameBytesAtIndex(size_t) const; 205 virtual size_t frameBytesAtIndex(size_t) const;
206 206
207 ImageOrientation orientation() const { return m_orientation; } 207 ImageOrientation orientation() const { return m_orientation; }
208 208
209 bool ignoresColorSpace() const { return m_ignoreColorSpace; } 209 bool ignoresColorSpace() const { return m_ignoreColorSpace; }
210 static void setTargetColorProfile(const WebVector<char>&); 210
211 // Set the target color profile into which all images with embedded color
212 // profiles should be converted. Note that only the first call to this
213 // function in this process has any effect.
214 static void setGlobalTargetColorProfile(const WebVector<char>&);
esprehn 2016/11/21 20:19:30 Since this isn't part of the public API we'd norma
ccameron 2016/11/21 22:28:14 I changed the caller to just pass in its WebVector
215 static sk_sp<SkColorSpace> globalTargetColorSpace();
211 216
212 // This returns the color space of this image. If the image had no embedded 217 // This returns the color space of this image. If the image had no embedded
213 // color profile, this will return sRGB. Returns nullptr if color correct 218 // color profile, this will return sRGB. Returns nullptr if color correct
214 // rendering is not enabled. 219 // rendering is not enabled.
215 sk_sp<SkColorSpace> colorSpace() const; 220 sk_sp<SkColorSpace> colorSpace() const;
216 221
217 // This returns whether or not the image included a not-ignored embedded 222 // This returns whether or not the image included a not-ignored embedded
218 // color space. This is independent of whether or not that space's transform 223 // color space. This is independent of whether or not that space's transform
219 // has been baked into the pixel values. 224 // has been baked into the pixel values.
220 bool hasEmbeddedColorSpace() const { return m_embeddedColorSpace.get(); } 225 bool hasEmbeddedColorSpace() const { return m_embeddedColorSpace.get(); }
221 226
222 // Set the embedded color space directly or via ICC profile. 227 // Set the embedded color space directly or via ICC profile.
223 void setColorProfileAndComputeTransform(const char* iccData, 228 void setEmbeddedColorProfile(const char* iccData, unsigned iccLength);
224 unsigned iccLength); 229 void setEmbeddedColorSpace(sk_sp<SkColorSpace> srcSpace);
225 void setColorSpaceAndComputeTransform(sk_sp<SkColorSpace> srcSpace);
226 230
227 // Transformation from encoded color space to target color space. 231 // Transformation from embedded color space to target color space.
228 SkColorSpaceXform* colorTransform() { 232 SkColorSpaceXform* colorTransform();
229 return m_sourceToOutputDeviceColorTransform.get();
230 }
231 233
232 // Sets the "decode failure" flag. For caller convenience (since so 234 // Sets the "decode failure" flag. For caller convenience (since so
233 // many callers want to return false after calling this), returns false 235 // many callers want to return false after calling this), returns false
234 // to enable easy tailcalling. Subclasses may override this to also 236 // to enable easy tailcalling. Subclasses may override this to also
235 // clean up any local data. 237 // clean up any local data.
236 virtual bool setFailed() { 238 virtual bool setFailed() {
237 m_failed = true; 239 m_failed = true;
238 return false; 240 return false;
239 } 241 }
240 242
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 359 }
358 360
359 bool m_purgeAggressively; 361 bool m_purgeAggressively;
360 362
361 IntSize m_size; 363 IntSize m_size;
362 bool m_sizeAvailable = false; 364 bool m_sizeAvailable = false;
363 bool m_isAllDataReceived = false; 365 bool m_isAllDataReceived = false;
364 bool m_failed = false; 366 bool m_failed = false;
365 bool m_hasHistogrammedColorSpace = false; 367 bool m_hasHistogrammedColorSpace = false;
366 368
369 sk_sp<SkColorSpace> m_targetColorSpace = nullptr;
367 sk_sp<SkColorSpace> m_embeddedColorSpace = nullptr; 370 sk_sp<SkColorSpace> m_embeddedColorSpace = nullptr;
368 std::unique_ptr<SkColorSpaceXform> m_sourceToOutputDeviceColorTransform; 371 bool m_sourceToTargetColorTransformNeedsUpdate = false;
372 std::unique_ptr<SkColorSpaceXform> m_sourceToTargetColorTransform;
369 }; 373 };
370 374
371 } // namespace blink 375 } // namespace blink
372 376
373 #endif 377 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698