108 constexpr int BM_WORDSIZE =
int(
sizeof(potrace_word));
109 constexpr int BM_WORDBITS = 8 * BM_WORDSIZE;
110 constexpr potrace_word BM_HIBIT = potrace_word(1) << (BM_WORDBITS - 1);
113 const int num_words =
bm->dy *
bm->h;
114 const int words_per_scanline =
bm->dy;
124 constexpr bool is_float_color_fn =
125 std::is_invocable_r_v<void, ThresholdFn, const ColorGeometry4f &>;
126 for (const int y : range) {
127 MutableSpan<potrace_word> scanline_words = words.slice(
128 IndexRange(words_per_scanline * y, words_per_scanline));
129 const Span<ColorGeometry4f> scanline_colors = colors.slice(IndexRange(y * ibuf.x, ibuf.x));
130 for (int x = 0; x < ibuf.x; x++) {
131 potrace_word &word = scanline_words[x / BM_WORDBITS];
132 const potrace_word mask = BM_HIBIT >> (x & (BM_WORDBITS - 1));
134 const ColorGeometry4f &fcolor = scanline_colors[x];
136 if constexpr (!is_float_color_fn) {
138 ColorGeometry4b(fcolor.r * 255, fcolor.g * 255, fcolor.b * 255, fcolor.a * 255));
141 is_foreground = fn(fcolor);
160 constexpr bool is_float_color_fn =
161 std::is_invocable_r_v<void, ThresholdFn, const ColorGeometry4f &>;
162 for (const int y : range) {
163 MutableSpan<potrace_word> scanline_words = words.slice(
164 IndexRange(words_per_scanline * y, words_per_scanline));
165 const Span<ColorGeometry4b> scanline_colors = colors.slice(IndexRange(y * ibuf.x, ibuf.x));
166 for (uint32_t x = 0; x < ibuf.x; x++) {
167 potrace_word &word = scanline_words[x / BM_WORDBITS];
168 const potrace_word mask = BM_HIBIT >> (x & (BM_WORDBITS - 1));
170 const ColorGeometry4b bcolor = scanline_colors[x];
172 if constexpr (is_float_color_fn) {
173 is_foreground = fn(ColorGeometry4f(
174 bcolor.r / 255.0f, bcolor.r / 255.0f, bcolor.r / 255.0f, bcolor.r / 255.0f));
177 is_foreground = fn(bcolor);
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int