| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/BitmapImageMetrics.h" | 5 #include "platform/graphics/BitmapImageMetrics.h" |
| 6 | 6 |
| 7 #include "platform/Histogram.h" | 7 #include "platform/Histogram.h" |
| 8 #include "wtf/Threading.h" | 8 #include "wtf/Threading.h" |
| 9 #include "wtf/text/WTFString.h" | 9 #include "wtf/text/WTFString.h" |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 { | 28 { |
| 29 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, orientationHistogram,
new EnumerationHistogram("Blink.DecodedImage.Orientation", ImageOrientationEnumE
nd)); | 29 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, orientationHistogram,
new EnumerationHistogram("Blink.DecodedImage.Orientation", ImageOrientationEnumE
nd)); |
| 30 orientationHistogram.count(orientation); | 30 orientationHistogram.count(orientation); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void BitmapImageMetrics::countGamma(SkColorSpace* colorSpace) | 33 void BitmapImageMetrics::countGamma(SkColorSpace* colorSpace) |
| 34 { | 34 { |
| 35 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, gammaNamedHistogram, n
ew EnumerationHistogram("Blink.ColorSpace.Destination", GammaEnd)); | 35 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, gammaNamedHistogram, n
ew EnumerationHistogram("Blink.ColorSpace.Destination", GammaEnd)); |
| 36 | 36 |
| 37 if (colorSpace) { | 37 if (colorSpace) { |
| 38 SkColorSpace::GammaNamed skGamma = colorSpace->gammaNamed(); | 38 // TODO (msarett): Add a check for gammaIsLinear() when that API lands i
n Skia. |
| 39 | |
| 40 Gamma gamma; | 39 Gamma gamma; |
| 41 switch (skGamma) { | 40 if (colorSpace->gammaCloseToSRGB()) { |
| 42 case SkColorSpace::kLinear_GammaNamed: | |
| 43 gamma = GammaLinear; | |
| 44 break; | |
| 45 case SkColorSpace::kSRGB_GammaNamed: | |
| 46 gamma = GammaSRGB; | 41 gamma = GammaSRGB; |
| 47 break; | 42 } else { |
| 48 case SkColorSpace::k2Dot2Curve_GammaNamed: | 43 gamma = GammaNonStandard; |
| 49 gamma = Gamma2Dot2; | |
| 50 break; | |
| 51 default: | |
| 52 if (colorSpace->gammasAreMatching()) { | |
| 53 if (colorSpace->gammasAreValues()) { | |
| 54 gamma = GammaExponent; | |
| 55 } else if (colorSpace->gammasAreParams()) { | |
| 56 gamma = GammaParametric; | |
| 57 } else if (colorSpace->gammasAreTables()) { | |
| 58 gamma = GammaTable; | |
| 59 } else if (colorSpace->gammasAreNamed()) { | |
| 60 gamma = GammaNamed; | |
| 61 } else { | |
| 62 gamma = GammaFail; | |
| 63 } | |
| 64 } else { | |
| 65 gamma = GammaNonStandard; | |
| 66 } | |
| 67 break; | |
| 68 } | 44 } |
| 69 | 45 |
| 70 gammaNamedHistogram.count(gamma); | 46 gammaNamedHistogram.count(gamma); |
| 71 } else { | 47 } else { |
| 72 gammaNamedHistogram.count(GammaNull); | 48 gammaNamedHistogram.count(GammaNull); |
| 73 } | 49 } |
| 74 } | 50 } |
| 75 | 51 |
| 76 } // namespace blink | 52 } // namespace blink |
| OLD | NEW |