Op_noop is pointless
We were using it as signal to skip a stage,
but a null argument pointer serves just as well.
Change-Id: I0bab2c5468c4fb9cd4dc3968d1ddd0520d84f892
Reviewed-on: https://skia-review.googlesource.com/152680
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/skcms.cc b/skcms.cc
index b7aaee4..84da16f 100644
--- a/skcms.cc
+++ b/skcms.cc
@@ -1750,8 +1750,6 @@
// ~~~~ Impl. of skcms_Transform() ~~~~
typedef enum {
- Op_noop,
-
Op_load_a8,
Op_load_g8,
Op_load_4444,
@@ -1976,9 +1974,11 @@
{ Op_tf_a, Op_table_8_a, Op_table_16_a },
};
+ const OpAndArg noop = { Op_load_a8/*doesn't matter*/, nullptr };
+
if (curve->table_entries == 0) {
return is_identity_tf(&curve->parametric)
- ? OpAndArg{ Op_noop, nullptr }
+ ? noop
: OpAndArg{ ops[channel].parametric, &curve->parametric };
} else if (curve->table_8) {
return OpAndArg{ ops[channel].table_8, curve };
@@ -1987,7 +1987,7 @@
}
assert(false);
- return OpAndArg{Op_noop,nullptr};
+ return noop;
}
static size_t bytes_per_pixel(skcms_PixelFormat fmt) {
@@ -2121,7 +2121,7 @@
if (srcProfile->A2B.input_channels) {
for (int i = 0; i < (int)srcProfile->A2B.input_channels; i++) {
OpAndArg oa = select_curve_op(&srcProfile->A2B.input_curves[i], i);
- if (oa.op != Op_noop) {
+ if (oa.arg) {
*ops++ = oa.op;
*args++ = oa.arg;
}
@@ -2139,7 +2139,7 @@
if (srcProfile->A2B.matrix_channels == 3) {
for (int i = 0; i < 3; i++) {
OpAndArg oa = select_curve_op(&srcProfile->A2B.matrix_curves[i], i);
- if (oa.op != Op_noop) {
+ if (oa.arg) {
*ops++ = oa.op;
*args++ = oa.arg;
}
@@ -2159,7 +2159,7 @@
if (srcProfile->A2B.output_channels == 3) {
for (int i = 0; i < 3; i++) {
OpAndArg oa = select_curve_op(&srcProfile->A2B.output_curves[i], i);
- if (oa.op != Op_noop) {
+ if (oa.arg) {
*ops++ = oa.op;
*args++ = oa.arg;
}
@@ -2173,7 +2173,7 @@
} else if (srcProfile->has_trc && srcProfile->has_toXYZD50) {
for (int i = 0; i < 3; i++) {
OpAndArg oa = select_curve_op(&srcProfile->trc[i], i);
- if (oa.op != Op_noop) {
+ if (oa.arg) {
*ops++ = oa.op;
*args++ = oa.arg;
}
diff --git a/src/Transform_inl.h b/src/Transform_inl.h
index f89c312..24c725b 100644
--- a/src/Transform_inl.h
+++ b/src/Transform_inl.h
@@ -590,8 +590,6 @@
F r = F0, g = F0, b = F0, a = F1;
while (true) {
switch (*ops++) {
- case Op_noop: break;
-
case Op_load_a8:{
a = F_from_U8(load<U8>(src + 1*i));
} break;