Fixed up the GTK+ uiArea a bit.
This commit is contained in:
parent
e27781cce7
commit
752467b543
|
@ -177,7 +177,7 @@ static gboolean areaWidget_draw(GtkWidget *w, cairo_t *cr)
|
||||||
|
|
||||||
(*(ap->ah->Draw))(ap->ah, ap->a, &dp);
|
(*(ap->ah->Draw))(ap->ah, ap->a, &dp);
|
||||||
|
|
||||||
g_free(dp.Context);
|
freeContext(dp.Context);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
unix/draw.c
21
unix/draw.c
|
@ -26,8 +26,7 @@ uiDrawPath *uiDrawNewPath(uiDrawFillMode mode)
|
||||||
{
|
{
|
||||||
uiDrawPath *p;
|
uiDrawPath *p;
|
||||||
|
|
||||||
// TODO uiNew
|
p = uiNew(uiDrawPath);
|
||||||
p = g_malloc0(sizeof (uiDrawPath));
|
|
||||||
p->pieces = g_array_new(FALSE, TRUE, sizeof (struct piece));
|
p->pieces = g_array_new(FALSE, TRUE, sizeof (struct piece));
|
||||||
p->fillMode = mode;
|
p->fillMode = mode;
|
||||||
return p;
|
return p;
|
||||||
|
@ -36,14 +35,13 @@ uiDrawPath *uiDrawNewPath(uiDrawFillMode mode)
|
||||||
void uiDrawFreePath(uiDrawPath *p)
|
void uiDrawFreePath(uiDrawPath *p)
|
||||||
{
|
{
|
||||||
g_array_free(p->pieces, TRUE);
|
g_array_free(p->pieces, TRUE);
|
||||||
// TODO uiFree
|
uiFree(p);
|
||||||
g_free(p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add(uiDrawPath *p, struct piece *piece)
|
static void add(uiDrawPath *p, struct piece *piece)
|
||||||
{
|
{
|
||||||
if (p->ended)
|
if (p->ended)
|
||||||
g_error("path ended in add()");
|
complain("path ended in add()");
|
||||||
g_array_append_vals(p->pieces, piece, 1);
|
g_array_append_vals(p->pieces, piece, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +136,7 @@ static void runPath(uiDrawPath *p, cairo_t *cr)
|
||||||
struct piece *piece;
|
struct piece *piece;
|
||||||
|
|
||||||
if (!p->ended)
|
if (!p->ended)
|
||||||
g_error("path not ended in runPath()");
|
complain("path not ended in runPath()");
|
||||||
cairo_new_path(cr);
|
cairo_new_path(cr);
|
||||||
for (i = 0; i < p->pieces->len; i++) {
|
for (i = 0; i < p->pieces->len; i++) {
|
||||||
piece = &g_array_index(p->pieces, struct piece, i);
|
piece = &g_array_index(p->pieces, struct piece, i);
|
||||||
|
@ -193,13 +191,16 @@ uiDrawContext *newContext(cairo_t *cr)
|
||||||
{
|
{
|
||||||
uiDrawContext *c;
|
uiDrawContext *c;
|
||||||
|
|
||||||
// TODO use uiNew
|
c = uiNew(uiDrawContext);
|
||||||
c = (uiDrawContext *) g_malloc0(sizeof (uiDrawContext));
|
|
||||||
c->cr = cr;
|
c->cr = cr;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO replace all g_error with complain
|
void freeContext(uiDrawContext *c)
|
||||||
|
{
|
||||||
|
uiFree(c);
|
||||||
|
}
|
||||||
|
|
||||||
static cairo_pattern_t *mkbrush(uiDrawBrush *b)
|
static cairo_pattern_t *mkbrush(uiDrawBrush *b)
|
||||||
{
|
{
|
||||||
cairo_pattern_t *pat;
|
cairo_pattern_t *pat;
|
||||||
|
@ -221,7 +222,7 @@ static cairo_pattern_t *mkbrush(uiDrawBrush *b)
|
||||||
// case uiDrawBrushTypeImage:
|
// case uiDrawBrushTypeImage:
|
||||||
}
|
}
|
||||||
if (cairo_pattern_status(pat) != CAIRO_STATUS_SUCCESS)
|
if (cairo_pattern_status(pat) != CAIRO_STATUS_SUCCESS)
|
||||||
g_error("error creating pattern in mkbrush(): %s",
|
complain("error creating pattern in mkbrush(): %s",
|
||||||
cairo_status_to_string(cairo_pattern_status(pat)));
|
cairo_status_to_string(cairo_pattern_status(pat)));
|
||||||
switch (b->Type) {
|
switch (b->Type) {
|
||||||
case uiDrawBrushTypeLinearGradient:
|
case uiDrawBrushTypeLinearGradient:
|
||||||
|
|
|
@ -39,6 +39,7 @@ extern void childSetMargined(struct child *c, int margined);
|
||||||
|
|
||||||
// draw.c
|
// draw.c
|
||||||
extern uiDrawContext *newContext(cairo_t *);
|
extern uiDrawContext *newContext(cairo_t *);
|
||||||
|
extern void freeContext(uiDrawContext *);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
#define uiControlQueueResize(...)
|
#define uiControlQueueResize(...)
|
||||||
|
|
Loading…
Reference in New Issue