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

Side by Side Diff: tests/SkColor4fTest.cpp

Issue 1757993002: add support for new bitmapshader context (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: enforce 16byte alignment in more places 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 | « src/image/SkImageShader.cpp ('k') | no next file » | 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 { make_color_sh, true, 1.0f/255 }, 142 { make_color_sh, true, 1.0f/255 },
143 // PMColor 4f gradients are interpolated in 255-multiplied values, so we need a 143 // PMColor 4f gradients are interpolated in 255-multiplied values, so we need a
144 // slightly relaxed tolerance to accommodate the cumulative precision de viation. 144 // slightly relaxed tolerance to accommodate the cumulative precision de viation.
145 { make_grad_sh, true, 1.001f/255 }, 145 { make_grad_sh, true, 1.001f/255 },
146 { make_image_sh, false, 1.0f/255 }, 146 { make_image_sh, false, 1.0f/255 },
147 { make_cf_sh, true, 1.0f/255 }, 147 { make_cf_sh, true, 1.0f/255 },
148 }; 148 };
149 149
150 SkPaint paint; 150 SkPaint paint;
151 for (const auto& rec : recs) { 151 for (const auto& rec : recs) {
152 uint32_t storage[200]; 152 uint32_t storage[300];
153 paint.setShader(rec.fFact())->unref(); 153 paint.setShader(rec.fFact())->unref();
154 // Encourage 4f context selection. At some point we may need 154 // Encourage 4f context selection. At some point we may need
155 // to instantiate two separate contexts for optimal 4b/4f selection. 155 // to instantiate two separate contexts for optimal 4b/4f selection.
156 const SkShader::ContextRec contextRec(paint, SkMatrix::I(), nullptr, 156 const SkShader::ContextRec contextRec(paint, SkMatrix::I(), nullptr,
157 SkShader::ContextRec::kPM4f_DstTyp e); 157 SkShader::ContextRec::kPM4f_DstTyp e);
158 SkASSERT(paint.getShader()->contextSize(contextRec) <= sizeof(storage)); 158 SkASSERT(paint.getShader()->contextSize(contextRec) <= sizeof(storage));
159 SkShader::Context* ctx = paint.getShader()->createContext(contextRec, st orage); 159 SkShader::Context* ctx = paint.getShader()->createContext(contextRec, st orage);
160 if (rec.fSupports4f) { 160 if (rec.fSupports4f) {
161 const int N = 100; 161 const int N = 100;
162 SkPM4f buffer4f[N]; 162 SkPM4f buffer4f[N];
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // 235 //
236 DEF_TEST(Color4f_xfermode_proc4f, reporter) { 236 DEF_TEST(Color4f_xfermode_proc4f, reporter) {
237 // TODO: extend xfermodes so that all cases can be tested. 237 // TODO: extend xfermodes so that all cases can be tested.
238 // 238 //
239 for (int mode = SkXfermode::kClear_Mode; mode <= SkXfermode::kScreen_Mode; + +mode) { 239 for (int mode = SkXfermode::kClear_Mode; mode <= SkXfermode::kScreen_Mode; + +mode) {
240 SkXfermodeProc proc32 = SkXfermode::GetProc((SkXfermode::Mode)mode); 240 SkXfermodeProc proc32 = SkXfermode::GetProc((SkXfermode::Mode)mode);
241 SkXfermodeProc4f proc4f = SkXfermode::GetProc4f((SkXfermode::Mode)mode); 241 SkXfermodeProc4f proc4f = SkXfermode::GetProc4f((SkXfermode::Mode)mode);
242 REPORTER_ASSERT(reporter, compare_procs(proc32, proc4f)); 242 REPORTER_ASSERT(reporter, compare_procs(proc32, proc4f));
243 } 243 }
244 } 244 }
OLDNEW
« no previous file with comments | « src/image/SkImageShader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698