streamline skvm errors
store() returns a success bool only because it can, because it wasn't
going to return any sort of skvm::Value anyway. But it should never
fail given a well-formed skvm::PixelFormat, e.g. one from
SkColorType_to_PixelFormat. So move the "error handling" inside, really
just asserting/assuming it doesn't fail.
And similarly, skvm::SkColorType_to_PixelFormat() can no longer fail, so
have it return the skvm::PixelFormat directly instead of the bool I used
to stage things back when building this out.
Change-Id: I6dc3b6da32cdaaef377fe59b8c94846e902841ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/367796
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp
index 6a0c7cf..88f5aa2 100755
--- a/src/shaders/SkImageShader.cpp
+++ b/src/shaders/SkImageShader.cpp
@@ -879,15 +879,6 @@
skvm::Coord upperLocal = SkShaderBase::ApplyMatrix(p, upperInv, origLocal, uniforms);
- // All existing SkColorTypes pass these checks. We'd only fail here adding new ones.
- skvm::PixelFormat unused;
- if (true && !SkColorType_to_PixelFormat(upper.colorType(), &unused)) {
- return {};
- }
- if (lower && !SkColorType_to_PixelFormat(lower->colorType(), &unused)) {
- return {};
- }
-
// We can exploit image opacity to skip work unpacking alpha channels.
const bool input_is_opaque = SkAlphaTypeIsOpaque(upper.alphaType())
|| SkColorTypeIsAlwaysOpaque(upper.colorType());
@@ -924,8 +915,7 @@
};
auto setup_uniforms = [&](const SkPixmap& pm) -> Uniforms {
- skvm::PixelFormat pixelFormat;
- SkAssertResult(SkColorType_to_PixelFormat(pm.colorType(), &pixelFormat));
+ skvm::PixelFormat pixelFormat = skvm::SkColorType_to_PixelFormat(pm.colorType());
return {
p->uniformF(uniforms->pushF( pm.width())),
p->uniformF(uniforms->pushF(1.0f/pm.width())), // iff tileX == kRepeat