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

Unified Diff: tests/SkColor4fTest.cpp

Issue 1720933002: Add ContextRec param to SkShader::contextSize() (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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
« include/core/SkShader.h ('K') | « src/image/SkImageShader.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SkColor4fTest.cpp
diff --git a/tests/SkColor4fTest.cpp b/tests/SkColor4fTest.cpp
index 5700e4b79c347caa7e6d71fc17e6c04a818fa9ce..1149734f6f4c779e8c44b7b8328b5008e950516d 100644
--- a/tests/SkColor4fTest.cpp
+++ b/tests/SkColor4fTest.cpp
@@ -148,9 +148,13 @@ DEF_TEST(Color4f_shader, reporter) {
for (const auto& rec : recs) {
uint32_t storage[200];
paint.setShader(rec.fFact())->unref();
- SkASSERT(paint.getShader()->contextSize() <= sizeof(storage));
- SkShader::Context* ctx = paint.getShader()->createContext({paint, SkMatrix::I(), nullptr},
- storage);
+ // Claim F16 to encourage 4f context selection. At some point we may need
+ // to instantiate two separate contexts for optimal 4b/4f selection.
+ const SkShader::ContextRec contextRec(paint, SkMatrix::I(), nullptr,
+ kRGBA_F16_SkColorType,
+ kLinear_SkColorProfileType);
+ SkASSERT(paint.getShader()->contextSize(contextRec) <= sizeof(storage));
+ SkShader::Context* ctx = paint.getShader()->createContext(contextRec, storage);
REPORTER_ASSERT(reporter, ctx->supports4f() == rec.fSupports4f);
if (ctx->supports4f()) {
const int N = 100;
« include/core/SkShader.h ('K') | « src/image/SkImageShader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698