add explicit accessor for sRGB singleton colorspaces
SkColorSpace::MakeSRGB().get() is scary, and causes more ref/unref
pairs than strictly necessary for these singletons.
This time the implementation is still in SkColorSpace.cpp,
so these should really work as singletons.
Change-Id: I40f2942c8dcde3040663a04c4f5330aca90868ae
Reviewed-on: https://skia-review.googlesource.com/143305
Auto-Submit: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp
index ff22cc5..8536dd8 100644
--- a/src/shaders/gradients/SkGradientShader.cpp
+++ b/src/shaders/gradients/SkGradientShader.cpp
@@ -8,6 +8,7 @@
#include <algorithm>
#include "Sk4fLinearGradient.h"
#include "SkColorSpace_XYZ.h"
+#include "SkColorSpacePriv.h"
#include "SkColorSpaceXformer.h"
#include "SkFlattenablePriv.h"
#include "SkFloatBits.h"
@@ -462,14 +463,14 @@
// Transform all of the colors to destination color space
fColors = colors;
- // Treat null destinations as sRGB (safe because sRGB is a global singleton)
+ // Treat null destinations as sRGB.
if (!dst) {
- dst = SkColorSpace::MakeSRGB().get();
+ dst = sk_srgb_singleton();
}
- // Treat null sources as sRGB (safe because sRGB is a global singleton)
+ // Treat null sources as sRGB.
if (!src) {
- src = SkColorSpace::MakeSRGB().get();
+ src = sk_srgb_singleton();
}
if (!SkColorSpace::Equals(src, dst)) {