aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2016-10-13 18:24:20 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-14 13:57:37 +0000
commitc434f5122a2394639ddeb66a1ded456565b043cd (patch)
tree556393422cfa433b9562d126385157e1ae34cc19 /src
parent285db44562da7136686e6d34a8443c6c6e0b942c (diff)
Add NewRGB() with float gamma to SkColorSpace public API
Necessary because PNGs like to specify their gamma this way. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3402 Change-Id: I399984d611db907b115b345df1afc88d39326fbb Reviewed-on: https://skia-review.googlesource.com/3402 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/codec/SkPngCodec.cpp6
-rw-r--r--src/core/SkColorSpace.cpp4
-rw-r--r--src/core/SkColorSpace_Base.h3
3 files changed, 5 insertions, 8 deletions
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 83032e6c18..9f8722f787 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -8,7 +8,7 @@
#include "SkBitmap.h"
#include "SkCodecPriv.h"
#include "SkColorPriv.h"
-#include "SkColorSpace_Base.h"
+#include "SkColorSpace.h"
#include "SkColorTable.h"
#include "SkMath.h"
#include "SkOpts.h"
@@ -387,7 +387,7 @@ sk_sp<SkColorSpace> read_color_space(png_structp png_ptr, png_infop info_ptr) {
gammas[1] = value;
gammas[2] = value;
- return SkColorSpace_Base::NewRGB(gammas, toXYZD50);
+ return SkColorSpace::NewRGB(gammas, toXYZD50);
}
// Default to sRGB gamma if the image has color space information,
@@ -408,7 +408,7 @@ sk_sp<SkColorSpace> read_color_space(png_structp png_ptr, png_infop info_ptr) {
SkMatrix44 toXYZD50(SkMatrix44::kUninitialized_Constructor);
toXYZD50.set3x3RowMajorf(gSRGB_toXYZD50);
- return SkColorSpace_Base::NewRGB(gammas, toXYZD50);
+ return SkColorSpace::NewRGB(gammas, toXYZD50);
}
#endif // LIBPNG >= 1.6
diff --git a/src/core/SkColorSpace.cpp b/src/core/SkColorSpace.cpp
index 405285636b..bdef5b3b75 100644
--- a/src/core/SkColorSpace.cpp
+++ b/src/core/SkColorSpace.cpp
@@ -138,7 +138,7 @@ static bool xyz_almost_equal(const SkMatrix44& toXYZD50, const float* standard)
color_space_almost_equal(toXYZD50.getFloat(3, 3), 1.0f);
}
-sk_sp<SkColorSpace> SkColorSpace_Base::NewRGB(const float values[3], const SkMatrix44& toXYZD50) {
+sk_sp<SkColorSpace> SkColorSpace::NewRGB(const float values[3], const SkMatrix44& toXYZD50) {
if (0.0f > values[0] || 0.0f > values[1] || 0.0f > values[2]) {
return nullptr;
}
@@ -560,7 +560,7 @@ sk_sp<SkColorSpace> SkColorSpace::Deserialize(const void* data, size_t length) {
SkMatrix44 toXYZ(SkMatrix44::kUninitialized_Constructor);
toXYZ.set3x4RowMajorf((const float*) data);
- return SkColorSpace_Base::NewRGB(gammas, toXYZ);
+ return SkColorSpace::NewRGB(gammas, toXYZ);
}
case ColorSpaceHeader::kTransferFn_Flag: {
if (length < 19 * sizeof(float)) {
diff --git a/src/core/SkColorSpace_Base.h b/src/core/SkColorSpace_Base.h
index 04f9b0b108..36cc47779a 100644
--- a/src/core/SkColorSpace_Base.h
+++ b/src/core/SkColorSpace_Base.h
@@ -169,9 +169,6 @@ struct SkColorLookUpTable : public SkRefCnt {
class SkColorSpace_Base : public SkColorSpace {
public:
-
- static sk_sp<SkColorSpace> NewRGB(const float gammas[3], const SkMatrix44& toXYZD50);
-
SkGammaNamed gammaNamed() const { return fGammaNamed; }
const SkGammas* gammas() const { return fGammas.get(); }