MCPcopy Create free account
hub / github.com/cselab/aphros / Render

Function Render

examples/107_wasm/diffusion.cpp:124–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124static void Render(Canvas& canvas, const FieldCell<Scal>& fcu, const M& m) {
125 const auto msize = m.GetGlobalSize();
126 for (auto c : m.CellsM()) {
127 const MIdx w(c);
128 const MIdx start = w * canvas.size / msize;
129 const MIdx end = (w + MIdx(1)) * canvas.size / msize;
130 unsigned char qr = 255 * Clamp(fcu[c]);
131 unsigned char qg = 0;
132 unsigned char qb = 0;
133 uint32_t q = 0xff000000 | (qr << 0) | (qg << 8) | (qb << 16);
134 for (int y = start[1]; y < end[1]; y++) {
135 for (int x = start[0]; x < end[0]; x++) {
136 canvas.buf[canvas.size[0] * (canvas.size[1] - y - 1) + x] = q;
137 }
138 }
139 }
140}
141
142void Solver::Run() {
143 auto sem = m.GetSem();

Callers 1

RunMethod · 0.85

Calls 3

GetGlobalSizeMethod · 0.80
ClampFunction · 0.70
CellsMMethod · 0.45

Tested by

no test coverage detected