65 const QRect &selectionRect,
74 const QRect dataRect =
kisGrowRect(selectionRect, 1);
76 const int dataRowSize = dataRect.width() *
sizeof(quint8);
77 const int selectionRowSize = selectionRect.width() *
sizeof(quint8);
78 QScopedArrayPointer<quint8> dstRow(
new quint8[selectionRowSize]);
80 std::unique_ptr<quint8[]> bmRow1(
new quint8[dataRowSize]);
81 std::unique_ptr<quint8[]> bmRow2(
new quint8[dataRowSize]);
82 std::unique_ptr<quint8[]> bmRow3(
new quint8[dataRowSize]);
84 device->
readBytes(bmRow1.get(), dataRect.left(), dataRect.top(), dataRect.width(), 1);
85 device->
readBytes(bmRow2.get(), dataRect.left(), dataRect.top() + 1, dataRect.width(), 1);
86 device->
readBytes(bmRow3.get(), dataRect.left(), dataRect.top() + 2, dataRect.width(), 1);
92 for (
int row = selectionRect.top();
93 row < selectionRect.top() + selectionRect.height(); row++) {
95 bumpmap_row (bmvals, dstRow.data(), selectionRect.width(),
96 bmRow1.get() + 1, bmRow2.get() + 1, bmRow3.get() + 1,
99 device->
writeBytes(dstRow.data(), selectionRect.left(), row, selectionRect.width(), 1);
104 device->
readBytes(bmRow3.get(), dataRect.left(), row + 1, dataRect.width(), 1);
176 for (x = 0; x < width; x++) {
187 nx = (bm_row1[xofs1] + bm_row2[xofs1] + bm_row3[xofs1] -
188 bm_row1[xofs3] - bm_row2[xofs3] - bm_row3[xofs3]);
189 ny = (bm_row3[xofs1] + bm_row3[xofs2] + bm_row3[xofs3] -
190 bm_row1[xofs1] - bm_row1[xofs2] - bm_row1[xofs3]);
194 if ((nx == 0) && (ny == 0)) {
197 gint ndotl = nx * params->
lx + ny * params->
ly + params->
nzlz;
202 shade = ndotl / sqrt (nx * nx + ny * ny + params->
nz2);
213 *dest++ =
MIN(255, result);
void bumpmap_row(const bumpmap_vals_t &bmvals, guchar *dest, gint width, const guchar *bm_row1, const guchar *bm_row2, const guchar *bm_row3, bumpmap_params_t *params)