use references instead of pointer

This commit is contained in:
jrkb 2023-06-02 09:58:49 +02:00
parent 7c2f886239
commit 7d1a43cb5e

View file

@ -16,7 +16,7 @@ void ofxMsdfgen::toOfImage(const msdfgen::Bitmap <float, 3> bitmap,
int h = bitmap.height(); int h = bitmap.height();
for(int y = 0; y < h; y++){ for(int y = 0; y < h; y++){
for(int x = 0; x < w; x++){ for(int x = 0; x < w; x++){
const float * rgb = bitmap(x, y); const auto & rgb = bitmap(x, y);
int index = 3 * (x + y * w); int index = 3 * (x + y * w);
pixels.getData()[index] = (unsigned char)std::clamp(rgb[0] * 256.0, pixels.getData()[index] = (unsigned char)std::clamp(rgb[0] * 256.0,
0.0, 255.0); 0.0, 255.0);
@ -47,7 +47,7 @@ ofImage ofxMsdfgen::toOfImage(const msdfgen::Bitmap <float, 3> bitmap){
int h = bitmap.height(); int h = bitmap.height();
for(int y = 0; y < h; y++){ for(int y = 0; y < h; y++){
for(int x = 0; x < w; x++){ for(int x = 0; x < w; x++){
const float * rgb = bitmap(x, y); const auto & rgb = bitmap(x, y);
int index = 3 * (x + y * w); int index = 3 * (x + y * w);
pixels.getData()[index] = (unsigned char)std::clamp(rgb[0] * 256.0, pixels.getData()[index] = (unsigned char)std::clamp(rgb[0] * 256.0,
0.0, 255.0); 0.0, 255.0);