Update color space API in examples

Bug: skia:
Change-Id: I2304a7265ebae8dc67f9ddf3f94aa7c4d5eb2e26
Reviewed-on: https://skia-review.googlesource.com/c/187388
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2019-01-28 15:42:55 -05:00 committed by Skia Commit-Bot
parent 57abfe9737
commit 410b302fb7
2 changed files with 9 additions and 9 deletions

View File

@ -868,10 +868,10 @@ or was parsed from encoded data.
source.peekPixels(&pixmap);
canvas->scale(.25f, .25f);
int y = 0;
for (auto gamma : { SkColorSpace::kLinear_RenderTargetGamma,
SkColorSpace::kSRGB_RenderTargetGamma } ) {
for (auto gamma : { SkNamedTransferFn::kLinear,
SkNamedTransferFn::kSRGB } ) {
int x = 0;
sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeRGB(gamma, SkColorSpace::kSRGB_Gamut);
sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeRGB(gamma, SkNamedGamut::kSRGB);
for (int index = 0; index < 2; ++index) {
pixmap.setColorSpace(colorSpace);
sk_sp<SkImage> image = SkImage::MakeRasterCopy(pixmap);
@ -901,10 +901,10 @@ or was parsed from encoded data.
source.peekPixels(&pixmap);
canvas->scale(.25f, .25f);
int y = 0;
for (auto gamma : { SkColorSpace::kLinear_RenderTargetGamma,
SkColorSpace::kSRGB_RenderTargetGamma } ) {
for (auto gamma : { SkNamedTransferFn::kLinear,
SkNamedTransferFn::kSRGB } ) {
int x = 0;
sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeRGB(gamma, SkColorSpace::kSRGB_Gamut);
sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeRGB(gamma, SkNamedGamut::kSRGB);
for (int index = 0; index < 2; ++index) {
pixmap.setColorSpace(colorSpace);
sk_sp<SkImage> image = SkImage::MakeRasterCopy(pixmap);
@ -1771,7 +1771,7 @@ void draw(SkCanvas* canvas) {
#Image 5
#Set sRGB
sk_sp<SkColorSpace> normalColorSpace = SkColorSpace::MakeRGB(
SkColorSpace::kSRGB_RenderTargetGamma, SkColorSpace::kSRGB_Gamut);
SkNamedTransferFn::kSRGB, SkNamedGamut::kSRGB);
sk_sp<SkColorSpace> wackyColorSpace = normalColorSpace->makeColorSpin();
for (auto colorSpace : { normalColorSpace, wackyColorSpace } ) {
sk_sp<SkImage> colorSpaced = image->makeColorSpace(colorSpace);

View File

@ -159,8 +159,8 @@ void draw(SkCanvas* canvas) {
#Example
void draw(SkCanvas* canvas) {
SkPixmap pixmap;
sk_sp<SkColorSpace> colorSpace1 = SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma,
SkColorSpace::kRec2020_Gamut);
sk_sp<SkColorSpace> colorSpace1 = SkColorSpace::MakeRGB(SkNamedTransferFn::kLinear,
SkNamedGamut::kRec2020);
SkDebugf("is %sunique\n", colorSpace1->unique() ? "" : "not ");
pixmap.setColorSpace(colorSpace1);
SkDebugf("is %sunique\n", colorSpace1->unique() ? "" : "not ");