Commit e3390825 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Fixed flow pixmaps always being drawn in black.

parent f32864a0
...@@ -1203,23 +1203,19 @@ void FlowDrawGtk::pixmaps_delete(void* pixmaps) ...@@ -1203,23 +1203,19 @@ void FlowDrawGtk::pixmaps_delete(void* pixmaps)
} }
void FlowDrawGtk::pixmap(int x, int y, flow_sPixmapData* pixmap_data, void FlowDrawGtk::pixmap(int x, int y, flow_sPixmapData* pixmap_data,
void* pixmaps, flow_eDrawType gc_type, int idx) void* pixmaps, flow_eDrawType gc_bg, flow_eDrawType gc_fg, int idx)
{ {
flow_sPixmapDataElem* pdata = (flow_sPixmapDataElem*)pixmap_data + idx; flow_sPixmapDataElem* pdata = (flow_sPixmapDataElem*)pixmap_data + idx;
draw_sPixmap* pms = (draw_sPixmap*)pixmaps; draw_sPixmap* pms = (draw_sPixmap*)pixmaps;
flow_eDrawType gc2 = (gc_type == flow_eDrawType_Line) ?
flow_eDrawType_LineErase : flow_eDrawType_Line;
gdk_draw_rectangle( gdk_draw_rectangle(
w->buffer, gcs[gc2][idx], 1, x, y, pdata->width, pdata->height); w->buffer, gcs[gc_bg][idx], 1, x, y, pdata->width, pdata->height);
gdk_gc_set_clip_mask(gcs[gc_type][idx], pms->pixmap[idx]); gdk_gc_set_clip_mask(gcs[gc_fg][idx], pms->pixmap[idx]);
gdk_gc_set_clip_origin(gcs[gc_type][idx], x, y); gdk_gc_set_clip_origin(gcs[gc_fg][idx], x, y);
gdk_draw_rectangle(w->buffer, gcs[gc_type][idx], 1, x, y, gdk_draw_rectangle(w->buffer, gcs[gc_fg][idx], 1, x, y,
pdata->width, pdata->height); pdata->width, pdata->height);
gdk_gc_set_clip_mask(gcs[gc_type][idx], NULL); gdk_gc_set_clip_mask(gcs[gc_fg][idx], NULL);
gdk_gc_set_clip_origin(gcs[gc_type][idx], 0, 0); gdk_gc_set_clip_origin(gcs[gc_fg][idx], 0, 0);
} }
void FlowDrawGtk::image(int x, int y, int width, int height, void FlowDrawGtk::image(int x, int y, int width, int height,
......
...@@ -110,7 +110,7 @@ public: ...@@ -110,7 +110,7 @@ public:
void pixmaps_create(flow_sPixmapData* pixmap_data, void** pixmaps); void pixmaps_create(flow_sPixmapData* pixmap_data, void** pixmaps);
void pixmaps_delete(void* pixmaps); void pixmaps_delete(void* pixmaps);
void pixmap(int x, int y, flow_sPixmapData* pixmap_data, void* pixmaps, void pixmap(int x, int y, flow_sPixmapData* pixmap_data, void* pixmaps,
flow_eDrawType gc_type, int idx); flow_eDrawType gc_bg, flow_eDrawType gc_fg, int idx);
void set_timer(FlowCtx* ctx, int time_ms, void (*callback_func)(FlowCtx* ctx), void set_timer(FlowCtx* ctx, int time_ms, void (*callback_func)(FlowCtx* ctx),
void** id); void** id);
......
...@@ -966,23 +966,18 @@ void FlowDrawQt::pixmaps_delete(void* pixmaps) ...@@ -966,23 +966,18 @@ void FlowDrawQt::pixmaps_delete(void* pixmaps)
delete ((draw_sPixmap*)pixmaps); delete ((draw_sPixmap*)pixmaps);
} }
void FlowDrawQt::pixmap(int x, int y, void FlowDrawQt::pixmap(int x, int y, flow_sPixmapData* pixmap_data,
flow_sPixmapData* pixmap_data, void* pixmaps, flow_eDrawType painter_type, void* pixmaps, flow_eDrawType gc_bg, flow_eDrawType gc_fg, int idx)
int idx)
{ {
flow_sPixmapDataElem* pdata = (flow_sPixmapDataElem*)pixmap_data + idx; flow_sPixmapDataElem* pdata = (flow_sPixmapDataElem*)pixmap_data + idx;
draw_sPixmap* pms = (draw_sPixmap*)pixmaps; draw_sPixmap* pms = (draw_sPixmap*)pixmaps;
flow_eDrawType gc2 = (painter_type == flow_eDrawType_Line) ?
flow_eDrawType_LineErase : flow_eDrawType_Line;
{ {
unique_ptr<QPainter> painter = get_painter(gc2, idx); unique_ptr<QPainter> painter = get_painter(gc_bg, idx);
painter->fillRect(x, y, pdata->width, pdata->height, painter->brush()); painter->fillRect(x, y, pdata->width, pdata->height, painter->brush());
} }
unique_ptr<QPainter> painter = get_painter(painter_type, idx); unique_ptr<QPainter> painter = get_painter(gc_fg, idx);
QRegion clipRegion = QRegion(pms->pixmap[idx].createMaskFromColor(Qt::black)); QRegion clipRegion = QRegion(pms->pixmap[idx].createMaskFromColor(Qt::black));
painter->setClipRegion(clipRegion.translated(x, y)); painter->setClipRegion(clipRegion.translated(x, y));
......
...@@ -100,7 +100,7 @@ public: ...@@ -100,7 +100,7 @@ public:
void image(int x, int y, int width, int height, void image(int x, int y, int width, int height,
flow_tImImage image, flow_tPixmap pixmap, flow_tPixmap clip_mask); flow_tImImage image, flow_tPixmap pixmap, flow_tPixmap clip_mask);
void pixmap(int x, int y, flow_sPixmapData* pixmap_data, void pixmap(int x, int y, flow_sPixmapData* pixmap_data,
void* pixmaps, flow_eDrawType gc_type, int idx); void* pixmaps, flow_eDrawType gc_bg, flow_eDrawType gc_fg, int idx);
void pixmaps_create( void pixmaps_create(
flow_sPixmapData* pixmap_data, void** pixmaps); flow_sPixmapData* pixmap_data, void** pixmaps);
......
...@@ -125,7 +125,7 @@ void FlowAnnotPixmap::draw( ...@@ -125,7 +125,7 @@ void FlowAnnotPixmap::draw(
ctx->fdraw->pixmap(x, p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y, ctx->fdraw->pixmap(x, p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
&((FlowNode*)node)->annotpixmapv[number]->pixmap_data, &((FlowNode*)node)->annotpixmapv[number]->pixmap_data,
((FlowNode*)node)->annotpixmapv[number]->pixmaps, ((FlowNode*)node)->annotpixmapv[number]->pixmaps,
draw_type, idx); draw_type, flow_eDrawType_LineErase, idx);
} }
void FlowAnnotPixmap::draw_inverse(void* pos, int hot, void* node) void FlowAnnotPixmap::draw_inverse(void* pos, int hot, void* node)
...@@ -147,8 +147,8 @@ void FlowAnnotPixmap::draw_inverse(void* pos, int hot, void* node) ...@@ -147,8 +147,8 @@ void FlowAnnotPixmap::draw_inverse(void* pos, int hot, void* node)
x = p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x; x = p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x;
ctx->fdraw->pixmap(x, p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y, ctx->fdraw->pixmap(x, p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y,
&((FlowNode*)node)->annotpixmapv[number]->pixmap_data, &((FlowNode*)node)->annotpixmapv[number]->pixmap_data,
((FlowNode*)node)->annotpixmapv[number]->pixmaps, ctx->inverse_color, ((FlowNode*)node)->annotpixmapv[number]->pixmaps,
idx); flow_eDrawType_LineErase, ctx->inverse_color, idx);
} }
void FlowAnnotPixmap::erase(void* pos, int hot, void* node) void FlowAnnotPixmap::erase(void* pos, int hot, void* node)
...@@ -186,7 +186,8 @@ void FlowAnnotPixmap::nav_draw(void* pos, int highlight, void* node) ...@@ -186,7 +186,8 @@ void FlowAnnotPixmap::nav_draw(void* pos, int highlight, void* node)
ctx->fdraw->pixmap(p.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x, ctx->fdraw->pixmap(p.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
p.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y, p.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y,
&((FlowNode*)node)->annotpixmapv[number]->pixmap_data, &((FlowNode*)node)->annotpixmapv[number]->pixmap_data,
((FlowNode*)node)->annotpixmapv[number]->pixmaps, draw_type, idx); ((FlowNode*)node)->annotpixmapv[number]->pixmaps, draw_type,
flow_eDrawType_LineErase, idx);
} }
void FlowAnnotPixmap::nav_erase(void* pos, void* node) void FlowAnnotPixmap::nav_erase(void* pos, void* node)
......
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
virtual void image(int x, int y, int width, int height, flow_tImImage image, virtual void image(int x, int y, int width, int height, flow_tImImage image,
flow_tPixmap pixmap, flow_tPixmap clip_mask) = 0; flow_tPixmap pixmap, flow_tPixmap clip_mask) = 0;
virtual void pixmap(int x, int y, flow_sPixmapData* pixmap_data, virtual void pixmap(int x, int y, flow_sPixmapData* pixmap_data,
void* pixmaps, flow_eDrawType gc_type, int idx) = 0; void* pixmaps, flow_eDrawType gc_bg, flow_eDrawType gc_fg, int idx) = 0;
virtual void pixmaps_create(flow_sPixmapData* pixmap_data, void** pixmaps) = 0; virtual void pixmaps_create(flow_sPixmapData* pixmap_data, void** pixmaps) = 0;
virtual void pixmaps_delete(void* pixmaps) = 0; virtual void pixmaps_delete(void* pixmaps) = 0;
......
...@@ -107,7 +107,7 @@ void FlowPixmap::draw(void* pos, int highlight, int dimmed, int hot, void* node) ...@@ -107,7 +107,7 @@ void FlowPixmap::draw(void* pos, int highlight, int dimmed, int hot, void* node)
idx = MIN(idx, DRAW_TYPE_SIZE - 1); idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->pixmap(p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x, ctx->fdraw->pixmap(p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y, &pixmap_data, pixmaps, p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y, &pixmap_data, pixmaps,
flow_eDrawType_LineErase, idx); draw_type, flow_eDrawType_LineErase, idx);
} }
void FlowPixmap::draw_inverse(void* pos, int hot, void* node) void FlowPixmap::draw_inverse(void* pos, int hot, void* node)
...@@ -119,7 +119,7 @@ void FlowPixmap::draw_inverse(void* pos, int hot, void* node) ...@@ -119,7 +119,7 @@ void FlowPixmap::draw_inverse(void* pos, int hot, void* node)
idx = MIN(idx, DRAW_TYPE_SIZE - 1); idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->pixmap(p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x, ctx->fdraw->pixmap(p.z_x + ((FlowPoint*)pos)->z_x - ctx->offset_x,
p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y, &pixmap_data, pixmaps, p.z_y + ((FlowPoint*)pos)->z_y - ctx->offset_y, &pixmap_data, pixmaps,
flow_eDrawType_Line, idx); flow_eDrawType_LineErase, draw_type, idx);
} }
void FlowPixmap::erase(void* pos, int hot, void* node) void FlowPixmap::erase(void* pos, int hot, void* node)
...@@ -144,7 +144,7 @@ void FlowPixmap::nav_draw(void* pos, int highlight, void* node) ...@@ -144,7 +144,7 @@ void FlowPixmap::nav_draw(void* pos, int highlight, void* node)
idx = MIN(idx, DRAW_TYPE_SIZE - 1); idx = MIN(idx, DRAW_TYPE_SIZE - 1);
ctx->fdraw->pixmap(p.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x, ctx->fdraw->pixmap(p.nav_z_x + ((FlowPoint*)pos)->nav_z_x - ctx->nav_offset_x,
p.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y, &pixmap_data, p.nav_z_y + ((FlowPoint*)pos)->nav_z_y - ctx->nav_offset_y, &pixmap_data,
pixmaps, draw_type, idx); pixmaps, draw_type, flow_eDrawType_LineErase, idx);
} }
void FlowPixmap::nav_erase(void* pos, void* node) void FlowPixmap::nav_erase(void* pos, void* node)
......
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