Fix dimensions and color-spin in color4shader GM

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3907

Change-Id: I0f263d98f942eda07eec4dabfec484461f77f83d
Reviewed-on: https://skia-review.googlesource.com/3907
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2016-10-25 11:45:14 -04:00 committed by Skia Commit-Bot
parent b00c949c36
commit cc813ae9a0

View File

@ -8,6 +8,7 @@
#include "gm.h" #include "gm.h"
#include "SkCanvas.h" #include "SkCanvas.h"
#include "SkColorPriv.h" #include "SkColorPriv.h"
#include "SkColorSpace_Base.h"
#include "SkShader.h" #include "SkShader.h"
#include "SkSurface.h" #include "SkSurface.h"
@ -91,12 +92,15 @@ DEF_SIMPLE_GM(color4f, canvas, 1024, 260) {
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#include "SkColorSpace.h" #include "SkColorSpace.h"
DEF_SIMPLE_GM(color4shader, canvas, 1024, 260) { DEF_SIMPLE_GM(color4shader, canvas, 360, 480) {
canvas->translate(10, 10); canvas->translate(10, 10);
auto srgb = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor); SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
// red -> blue, green -> red, blue -> green // red -> blue, green -> red, blue -> green (sRGB)
mat.set3x3(0, 0, 1, 1, 0, 0, 0, 1, 0); mat.set3x3(0, 0, 1, 1, 0, 0, 0, 1, 0);
mat.postConcat(*as_CSB(srgb)->toXYZD50());
const SkColor4f colors[] { const SkColor4f colors[] {
{ 1, 0, 0, 1 }, { 1, 0, 0, 1 },
@ -111,7 +115,7 @@ DEF_SIMPLE_GM(color4shader, canvas, 1024, 260) {
for (const auto& c4 : colors) { for (const auto& c4 : colors) {
sk_sp<SkShader> shaders[] { sk_sp<SkShader> shaders[] {
SkShader::MakeColorShader(c4, nullptr), SkShader::MakeColorShader(c4, nullptr),
SkShader::MakeColorShader(c4, SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named)), SkShader::MakeColorShader(c4, srgb),
SkShader::MakeColorShader(c4, SkShader::MakeColorShader(c4,
SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma, mat)), SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma, mat)),
}; };