OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkColor.h" | 8 #include "SkColor.h" |
9 #include "SkColorMatrixFilter.h" | 9 #include "SkColorMatrixFilter.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 static sk_sp<SkShader> make_color_sh() { return SkShader::MakeColorShader(0xFFBB
8855); } | 101 static sk_sp<SkShader> make_color_sh() { return SkShader::MakeColorShader(0xFFBB
8855); } |
102 | 102 |
103 static sk_sp<SkShader> make_image_sh() { | 103 static sk_sp<SkShader> make_image_sh() { |
104 const SkImageInfo info = SkImageInfo::MakeN32Premul(2, 2); | 104 const SkImageInfo info = SkImageInfo::MakeN32Premul(2, 2); |
105 const SkPMColor pixels[] { | 105 const SkPMColor pixels[] { |
106 SkPackARGB32(0xFF, 0xBB, 0x88, 0x55), | 106 SkPackARGB32(0xFF, 0xBB, 0x88, 0x55), |
107 SkPackARGB32(0xFF, 0xBB, 0x88, 0x55), | 107 SkPackARGB32(0xFF, 0xBB, 0x88, 0x55), |
108 SkPackARGB32(0xFF, 0xBB, 0x88, 0x55), | 108 SkPackARGB32(0xFF, 0xBB, 0x88, 0x55), |
109 SkPackARGB32(0xFF, 0xBB, 0x88, 0x55), | 109 SkPackARGB32(0xFF, 0xBB, 0x88, 0x55), |
110 }; | 110 }; |
111 SkAutoTUnref<SkImage> image(SkImage::NewRasterCopy(info, pixels, sizeof(SkPM
Color) * 2)); | 111 sk_sp<SkImage> image(SkImage::MakeRasterCopy(SkPixmap(info, pixels, sizeof(S
kPMColor) * 2))); |
112 return image->makeShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMod
e); | 112 return image->makeShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMod
e); |
113 } | 113 } |
114 | 114 |
115 static sk_sp<SkShader> make_grad_sh() { | 115 static sk_sp<SkShader> make_grad_sh() { |
116 #if 0 | 116 #if 0 |
117 const SkPoint pts[] {{ 0, 0 }, { 100, 100 }}; | 117 const SkPoint pts[] {{ 0, 0 }, { 100, 100 }}; |
118 const SkColor colors[] { SK_ColorRED, SK_ColorBLUE }; | 118 const SkColor colors[] { SK_ColorRED, SK_ColorBLUE }; |
119 return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kCl
amp_TileMode); | 119 return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kCl
amp_TileMode); |
120 #else | 120 #else |
121 // TODO: need to convert new gradient code to enforce PM4f --> RGBA order | 121 // TODO: need to convert new gradient code to enforce PM4f --> RGBA order |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // | 243 // |
244 DEF_TEST(Color4f_xfermode_proc4f, reporter) { | 244 DEF_TEST(Color4f_xfermode_proc4f, reporter) { |
245 // TODO: extend xfermodes so that all cases can be tested. | 245 // TODO: extend xfermodes so that all cases can be tested. |
246 // | 246 // |
247 for (int mode = SkXfermode::kClear_Mode; mode <= SkXfermode::kScreen_Mode; +
+mode) { | 247 for (int mode = SkXfermode::kClear_Mode; mode <= SkXfermode::kScreen_Mode; +
+mode) { |
248 SkXfermodeProc proc32 = SkXfermode::GetProc((SkXfermode::Mode)mode); | 248 SkXfermodeProc proc32 = SkXfermode::GetProc((SkXfermode::Mode)mode); |
249 SkXfermodeProc4f proc4f = SkXfermode::GetProc4f((SkXfermode::Mode)mode); | 249 SkXfermodeProc4f proc4f = SkXfermode::GetProc4f((SkXfermode::Mode)mode); |
250 REPORTER_ASSERT(reporter, compare_procs(proc32, proc4f)); | 250 REPORTER_ASSERT(reporter, compare_procs(proc32, proc4f)); |
251 } | 251 } |
252 } | 252 } |
OLD | NEW |