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

Side by Side Diff: tests/SkColor4fTest.cpp

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « tests/SerializationTest.cpp ('k') | tests/SkImageTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « tests/SerializationTest.cpp ('k') | tests/SkImageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698