Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: gm/colorspacexform.cpp

Issue 2347473007: Revert of Support Float32 output from SkColorSpaceXform (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bench/ColorCodecBench.cpp ('k') | gyp/bench.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/colorspacexform.cpp
diff --git a/gm/colorspacexform.cpp b/gm/colorspacexform.cpp
deleted file mode 100644
index b3d79c91f027f910cea41caffc4aba421d53df54..0000000000000000000000000000000000000000
--- a/gm/colorspacexform.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2013 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 "SkColor.h"
-#include "SkColorSpaceXform.h"
-#include "SkRect.h"
-
-class ColorSpaceXformGM : public skiagm::GM {
-public:
- ColorSpaceXformGM() {}
-
-protected:
- void onOnceBeforeDraw() override {
- SkColor colors[] = {
- SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorMAGENTA, SK_ColorCYAN, SK_ColorYELLOW,
- SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorMAGENTA,
- };
- static_assert(kNumColors == SK_ARRAY_COUNT(colors), "Fix number of colors.");
-
- for (int i = 0; i < kNumColors; i++) {
- fSRGBColors[i] = SkColor4f::FromColor(colors[i]);
-
- // FIXME (msarett): SkColorSpaceXform does not support BGRA.
- colors[i] = SkSwizzle_RB(colors[i]);
- }
-
- static constexpr float kWideGamutRGB_toXYZD50[]{
- 0.7161046f, 0.1009296f, 0.1471858f,
- 0.2581874f, 0.7249378f, 0.0168748f,
- 0.0000000f, 0.0517813f, 0.7734287f,
- };
-
- SkMatrix44 wideGamut(SkMatrix44::kUninitialized_Constructor);
- wideGamut.set3x3RowMajorf(kWideGamutRGB_toXYZD50);
- std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(
- SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named),
- SkColorSpace::NewRGB(SkColorSpace::kLinear_RenderTargetGamma, wideGamut));
-
- xform->apply(fWideGamutColors, colors, kNumColors,
- SkColorSpaceXform::kRGBA_F32_ColorFormat, kOpaque_SkAlphaType);
- }
-
- SkString onShortName() override {
- return SkString("colorspacexform");
- }
-
- SkISize onISize() override {
- return SkISize::Make(500, 200);
- }
-
- void onDraw(SkCanvas* canvas) override {
- auto drawColors = [canvas](SkColor4f* colors) {
- SkRect r = SkRect::MakeXYWH(0.0f, 0.0f, 50.0f, 100.0f);
-
- canvas->save();
- for (int i = 0; i < kNumColors; i++) {
- sk_sp<SkColorSpace> space =
- SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named)->makeLinearGamma();
- sk_sp<SkShader> s = SkShader::MakeColorShader(colors[i], space);
- SkPaint paint;
- paint.setShader(s);
- canvas->drawRect(r, paint);
- canvas->translate(50.0f, 0.0f);
- }
- canvas->restore();
- };
-
- // Wide gamut colors should appear darker - we are simulating a more intense display.
- drawColors(fSRGBColors);
- canvas->translate(0.0f, 100.0f);
- drawColors(fWideGamutColors);
- }
-
-private:
- static constexpr int kNumColors = 10;
-
- SkColor4f fSRGBColors[kNumColors];
- SkColor4f fWideGamutColors[kNumColors];
-
- typedef skiagm::GM INHERITED;
-};
-
-DEF_GM(return new ColorSpaceXformGM;)
« no previous file with comments | « bench/ColorCodecBench.cpp ('k') | gyp/bench.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698