Commit 41d0ef0f authored by Christoffer Ackelman's avatar Christoffer Ackelman Committed by Esteban Blanc

QT: Fixed the image_pixel_iter image postprocessing function.

parent dd794844
...@@ -2328,36 +2328,30 @@ void GlowDrawQt::image_pixel_iter(glow_tImImage orig_image, ...@@ -2328,36 +2328,30 @@ void GlowDrawQt::image_pixel_iter(glow_tImImage orig_image,
glow_tImImage* image, void (*pixel_cb)(void*, unsigned char*), glow_tImImage* image, void (*pixel_cb)(void*, unsigned char*),
void* userdata) void* userdata)
{ {
unsigned char *rgb, *rgb_row; QImage img;
int rgb_height;
int rgb_width;
int rowstride;
if (orig_image) { if (orig_image) {
if (image && *image != orig_image) { if (image && *image != orig_image) {
delete ((QImage*)*image); delete ((QImage*)*image);
} }
*((QImage*)*image) = ((QImage*)orig_image)->copy(); img = ((QImage*)orig_image)->convertToFormat(QImage::Format_ARGB32);
} else if (!*image) { } else if (!*image) {
return; return;
} else {
img = ((QImage*)*image)->convertToFormat(QImage::Format_ARGB32);
} }
rgb = ((QImage*)*image)->convertToFormat(QImage::Format_ARGB32).bits(); unsigned char* rgb_row = img.bits();
rgb_height = ((QImage*)*image)->height(); for (int j = 0; j < img.height(); j++) {
rgb_width = ((QImage*)*image)->width(); unsigned char* rgb = rgb_row;
rowstride = ((QImage*)*image)->bytesPerLine(); for (int i = 0; i < img.width(); i++) {
if (*(rgb)) {
rgb_row = rgb; (pixel_cb)(userdata, rgb+1);
for (int j = 0; j < rgb_height; j++) {
rgb = rgb_row;
for (int i = 0; i < rgb_width; i++) {
if (*(rgb + 3)) {
(pixel_cb)(userdata, rgb);
} }
rgb += 4; rgb += 4;
} }
rgb_row += rowstride; rgb_row += img.bytesPerLine();
} }
*image = new QImage(img);
} }
int GlowDrawQt::gradient_create_pattern(int x, int y, int w, int h, int GlowDrawQt::gradient_create_pattern(int x, int y, int w, int h,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment