Skip to content
QtWS25 Last Chance
  • 0 Votes
    18 Posts
    10k Views
    C
    Fixed! I posted the problem there http://stackoverflow.com/questions/33130691/qimage-and-openmp-when-updating-image-display/33133653#33133653 I needed to declare variables private for the pragma directive. So, instead of using cred, cgreen, and cblue as I was, the code becomes: int cred2, cgreen2, cblue2 #pragma omp parallel for private(cred2, cgreen2, cblue2) for ( int ii = 0; ii < nPixels; ++ii ) { cred2 = (int) 255 * red16[ii] / range; cgreen2 = (int) 255 * green16[ii] / range; cblue2 = (int) 255 * blue16[ii] / range; QRgb argb = qRgba( cred2, cgreen2, cblue2, 255); QRgb* rowData = (QRgb*) newPaintImage->scanLine(ii/naxis1); rowData[ii%naxis1] = argb; } That's all. Then all methods become strictly equivalent regarding the end result. Haven't compared speed though, which is a concern in my context.