From a1fc47169a9eb2ba5d1cf55b60f77405394b449c Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Tue, 25 Jul 2017 16:17:40 +0000 Subject: Revert "Add GM to test SkToSRGBColorFilter" This reverts commit fa3ed03720b5083afd3620c9239863f05f2eedbd. Reason for revert: GM is failing on a lot of bots Original change's description: > Add GM to test SkToSRGBColorFilter > > Bug: skia: > Change-Id: If342ad5503d1b427f2d04ce15b75f0f7fa2706c1 > Reviewed-on: https://skia-review.googlesource.com/26426 > Reviewed-by: Mike Klein > Commit-Queue: Brian Osman TBR=djsollen@google.com,mtklein@google.com,brianosman@google.com Change-Id: I92fe179ead6d115b32b3a9533b8ee0e10bb3ee43 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/26522 Reviewed-by: Kevin Lubick Commit-Queue: Kevin Lubick --- gm/srgb_color_filter.cpp | 57 ------------------------------------- gn/gm.gni | 1 - src/effects/SkToSRGBColorFilter.cpp | 6 +--- 3 files changed, 1 insertion(+), 63 deletions(-) delete mode 100644 gm/srgb_color_filter.cpp diff --git a/gm/srgb_color_filter.cpp b/gm/srgb_color_filter.cpp deleted file mode 100644 index 76c724faaf..0000000000 --- a/gm/srgb_color_filter.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "gm.h" - -#include "SkPM4fPriv.h" -#include "SkToSRGBColorFilter.h" - -DEF_SIMPLE_GM_BG(srgb_color_filter, canvas, 130, 130, SK_ColorBLACK) { - // Src bitmap with some colors that we're going to interpret as being in a few different spaces - SkBitmap bmp; - bmp.allocN32Pixels(3, 2); - SkPMColor* pixels = reinterpret_cast(bmp.getPixels()); - pixels[0] = SkPackARGB32(0xFF, 0xA0, 0x00, 0x00); - pixels[1] = SkPackARGB32(0xFF, 0x00, 0xA0, 0x00); - pixels[2] = SkPackARGB32(0xFF, 0x00, 0x00, 0xA0); - pixels[3] = SkPackARGB32(0xFF, 0x00, 0xA0, 0xA0); - pixels[4] = SkPackARGB32(0xFF, 0xA0, 0x00, 0xA0); - pixels[5] = SkPackARGB32(0xFF, 0xA0, 0xA0, 0x00); - - // Reference image - canvas->drawBitmapRect(bmp, SkRect::MakeXYWH(10, 10, 50, 50), nullptr); - - auto srgb = SkColorSpace::MakeSRGB(); - auto rec2020 = SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma, - SkColorSpace::kRec2020_Gamut); - - // NarrowGamut RGB (an artifically smaller than sRGB gamut) - SkColorSpacePrimaries narrowPrimaries = { - 0.54f, 0.33f, // Rx, Ry - 0.33f, 0.50f, // Gx, Gy - 0.25f, 0.20f, // Bx, By - 0.3127f, 0.3290f, // Wx, Wy - }; - SkMatrix44 narrowGamutRGBMatrix(SkMatrix44::kUninitialized_Constructor); - narrowPrimaries.toXYZD50(&narrowGamutRGBMatrix); - auto narrow = SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma, - narrowGamutRGBMatrix); - - SkPaint paint; - - // Transforming sRGB -> sRGB should do nothing. Top two squares should look identical. - paint.setColorFilter(SkToSRGBColorFilter::Make(srgb)); - canvas->drawBitmapRect(bmp, SkRect::MakeXYWH(70, 10, 50, 50), &paint); - - // Rec2020 -> sRGB should produce more vivid colors. - paint.setColorFilter(SkToSRGBColorFilter::Make(rec2020)); - canvas->drawBitmapRect(bmp, SkRect::MakeXYWH(10, 70, 50, 50), &paint); - - // Narrow -> sRGB should produce more muted colors. - paint.setColorFilter(SkToSRGBColorFilter::Make(narrow)); - canvas->drawBitmapRect(bmp, SkRect::MakeXYWH(70, 70, 50, 50), &paint); -} diff --git a/gn/gm.gni b/gn/gm.gni index 97f8d83ab6..7fd787cea8 100644 --- a/gn/gm.gni +++ b/gn/gm.gni @@ -277,7 +277,6 @@ gm_sources = [ "$_gm/spritebitmap.cpp", "$_gm/srcmode.cpp", "$_gm/srgb.cpp", - "$_gm/srgb_color_filter.cpp", "$_gm/stlouisarch.cpp", "$_gm/stringart.cpp", "$_gm/stroke_rect_shader.cpp", diff --git a/src/effects/SkToSRGBColorFilter.cpp b/src/effects/SkToSRGBColorFilter.cpp index df3dec9dc1..253fea1427 100644 --- a/src/effects/SkToSRGBColorFilter.cpp +++ b/src/effects/SkToSRGBColorFilter.cpp @@ -52,11 +52,7 @@ void SkToSRGBColorFilter::onAppendStages(SkRasterPipeline* p, } sk_sp SkToSRGBColorFilter::Make(sk_sp srcColorSpace) { - if (srcColorSpace->isSRGB()) { - return nullptr; - } else { - return sk_sp(new SkToSRGBColorFilter(std::move(srcColorSpace))); - } + return sk_sp(new SkToSRGBColorFilter(std::move(srcColorSpace))); } SkToSRGBColorFilter::SkToSRGBColorFilter(sk_sp srcColorSpace) -- cgit v1.2.3