aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2018-07-25 13:05:17 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-25 23:51:15 +0000
commite28a6b55dfbcd510d86cca39a167d179b81e4f4c (patch)
tree7d9151d55b67f749fd701b7c8fe52b6f922988d3 /gm
parent68300c270916b2740fccdbe6c6dce8f085e83316 (diff)
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>
Diffstat (limited to 'gm')
-rw-r--r--gm/readpixels.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/gm/readpixels.cpp b/gm/readpixels.cpp
index c112314df1..aac2aa60ad 100644
--- a/gm/readpixels.cpp
+++ b/gm/readpixels.cpp
@@ -9,6 +9,7 @@
#include "Resources.h"
#include "SkCodec.h"
#include "SkColorSpace.h"
+#include "SkColorSpacePriv.h"
#include "SkColorSpaceXform.h"
#include "SkColorSpaceXformPriv.h"
#include "SkHalf.h"
@@ -153,8 +154,7 @@ static void draw_image(SkCanvas* canvas, SkImage* image, SkColorType dstColorTyp
clamp_if_necessary(dstInfo, data->writable_data());
// Now that we have called readPixels(), dump the raw pixels into an srgb image.
- sk_sp<SkColorSpace> srgb = fix_for_colortype(
- SkColorSpace::MakeSRGB().get(), dstColorType);
+ sk_sp<SkColorSpace> srgb = fix_for_colortype(sk_srgb_singleton(), dstColorType);
sk_sp<SkImage> raw = SkImage::MakeRasterData(dstInfo.makeColorSpace(srgb), data, rowBytes);
canvas->drawImage(raw.get(), 0.0f, 0.0f, nullptr);
}