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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ColorBehavior.cpp

Issue 2644233004: Use ICCProfile to construct SkColorSpace (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/graphics/ColorBehavior.h" 5 #include "platform/graphics/ColorBehavior.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "platform/graphics/BitmapImageMetrics.h" 8 #include "platform/graphics/BitmapImageMetrics.h"
9 #include "third_party/skia/include/core/SkICC.h" 9 #include "third_party/skia/include/core/SkICC.h"
10 #include "ui/gfx/icc_profile.h" 10 #include "ui/gfx/icc_profile.h"
(...skipping 15 matching lines...) Expand all
26 // Take a lock around initializing and accessing the global device color 26 // Take a lock around initializing and accessing the global device color
27 // profile. 27 // profile.
28 SpinLock::Guard guard(gTargetColorSpaceLock); 28 SpinLock::Guard guard(gTargetColorSpaceLock);
29 29
30 // Layout tests expect that only the first call will take effect. 30 // Layout tests expect that only the first call will take effect.
31 if (gTargetColorSpace) 31 if (gTargetColorSpace)
32 return; 32 return;
33 33
34 // Attempt to convert the ICC profile to an SkColorSpace. 34 // Attempt to convert the ICC profile to an SkColorSpace.
35 if (!(profile == gfx::ICCProfile())) { 35 if (!(profile == gfx::ICCProfile())) {
36 sk_sp<SkColorSpace> profileColorSpace =
37 profile.GetColorSpace().ToSkColorSpace();
38 gTargetColorSpace = profileColorSpace.release();
39
36 const std::vector<char>& data = profile.GetData(); 40 const std::vector<char>& data = profile.GetData();
37 gTargetColorSpace =
38 SkColorSpace::MakeICC(data.data(), data.size()).release();
39 sk_sp<SkICC> skICC = SkICC::Make(data.data(), data.size()); 41 sk_sp<SkICC> skICC = SkICC::Make(data.data(), data.size());
40 if (skICC) { 42 if (skICC) {
41 SkMatrix44 toXYZD50; 43 SkMatrix44 toXYZD50;
42 bool toXYZD50Result = skICC->toXYZD50(&toXYZD50); 44 bool toXYZD50Result = skICC->toXYZD50(&toXYZD50);
43 UMA_HISTOGRAM_BOOLEAN("Blink.ColorSpace.Destination.Matrix", 45 UMA_HISTOGRAM_BOOLEAN("Blink.ColorSpace.Destination.Matrix",
44 toXYZD50Result); 46 toXYZD50Result);
45 47
46 SkColorSpaceTransferFn fn; 48 SkColorSpaceTransferFn fn;
47 bool isNumericalTransferFnResult = skICC->isNumericalTransferFn(&fn); 49 bool isNumericalTransferFnResult = skICC->isNumericalTransferFn(&fn);
48 UMA_HISTOGRAM_BOOLEAN("Blink.ColorSpace.Destination.Numerical", 50 UMA_HISTOGRAM_BOOLEAN("Blink.ColorSpace.Destination.Numerical",
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 if (m_type != Type::TransformTo) 106 if (m_type != Type::TransformTo)
105 return true; 107 return true;
106 return SkColorSpace::Equals(m_target.get(), other.m_target.get()); 108 return SkColorSpace::Equals(m_target.get(), other.m_target.get());
107 } 109 }
108 110
109 bool ColorBehavior::operator!=(const ColorBehavior& other) const { 111 bool ColorBehavior::operator!=(const ColorBehavior& other) const {
110 return !(*this == other); 112 return !(*this == other);
111 } 113 }
112 114
113 } // namespace blink 115 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698