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

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

Issue 2646853007: Revert of 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
40 const std::vector<char>& data = profile.GetData(); 36 const std::vector<char>& data = profile.GetData();
37 gTargetColorSpace =
38 SkColorSpace::MakeICC(data.data(), data.size()).release();
41 sk_sp<SkICC> skICC = SkICC::Make(data.data(), data.size()); 39 sk_sp<SkICC> skICC = SkICC::Make(data.data(), data.size());
42 if (skICC) { 40 if (skICC) {
43 SkMatrix44 toXYZD50; 41 SkMatrix44 toXYZD50;
44 bool toXYZD50Result = skICC->toXYZD50(&toXYZD50); 42 bool toXYZD50Result = skICC->toXYZD50(&toXYZD50);
45 UMA_HISTOGRAM_BOOLEAN("Blink.ColorSpace.Destination.Matrix", 43 UMA_HISTOGRAM_BOOLEAN("Blink.ColorSpace.Destination.Matrix",
46 toXYZD50Result); 44 toXYZD50Result);
47 45
48 SkColorSpaceTransferFn fn; 46 SkColorSpaceTransferFn fn;
49 bool isNumericalTransferFnResult = skICC->isNumericalTransferFn(&fn); 47 bool isNumericalTransferFnResult = skICC->isNumericalTransferFn(&fn);
50 UMA_HISTOGRAM_BOOLEAN("Blink.ColorSpace.Destination.Numerical", 48 UMA_HISTOGRAM_BOOLEAN("Blink.ColorSpace.Destination.Numerical",
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 if (m_type != Type::TransformTo) 104 if (m_type != Type::TransformTo)
107 return true; 105 return true;
108 return SkColorSpace::Equals(m_target.get(), other.m_target.get()); 106 return SkColorSpace::Equals(m_target.get(), other.m_target.get());
109 } 107 }
110 108
111 bool ColorBehavior::operator!=(const ColorBehavior& other) const { 109 bool ColorBehavior::operator!=(const ColorBehavior& other) const {
112 return !(*this == other); 110 return !(*this == other);
113 } 111 }
114 112
115 } // namespace blink 113 } // 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