diff options
| author | Dana Jansens <danakj@orodu.net> | 2002-12-21 13:49:57 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2002-12-21 13:49:57 +0000 |
| commit | 55b2aaf973063796a668bc758232141c3d6f5cc9 (patch) | |
| tree | 5d61fe0ac903b5130ec85997296befab7909bdf9 /otk_c/color.c | |
| parent | 16e1192e4d18cd0d32b1ab8bf38ac8d69347229d (diff) | |
add font
Diffstat (limited to 'otk_c/color.c')
| -rw-r--r-- | otk_c/color.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/otk_c/color.c b/otk_c/color.c index 4ecca30c..732f7b7d 100644 --- a/otk_c/color.c +++ b/otk_c/color.c @@ -75,8 +75,6 @@ static void doCacheCleanup() { static void allocate(OtkColor *self) { XColor xcol; - assert(!self->allocated); - // allocate color from rgb values xcol.red = self->red | self->red << 8; xcol.green = self->green | self->green << 8; @@ -92,7 +90,6 @@ static void allocate(OtkColor *self) { } self->pixel = xcol.pixel; - self->allocated = True; if (cleancache) doCacheCleanup(); @@ -108,11 +105,9 @@ PyObject *OtkColor_FromRGB(int r, int g, int b, int screen) if (!colorcache) colorcache = PyDict_New(); - self->allocated = False; self->red = r; self->green = g; self->blue = b; - self->pixel = 0; self->screen = screen; // does this color already exist in the cache? @@ -124,6 +119,7 @@ PyObject *OtkColor_FromRGB(int r, int g, int b, int screen) // add it to the cache PyDict_SetItem(colorcache, (PyObject*)self, (PyObject*)self); + allocate(self); return (PyObject*)self; } @@ -136,11 +132,9 @@ PyObject *OtkColor_FromName(const char *name, int screen) if (!colorcache) colorcache = PyDict_New(); - self->allocated = False; self->red = -1; self->green = -1; self->blue = -1; - self->pixel = 0; self->screen = screen; parseColorName(self, name); @@ -154,16 +148,10 @@ PyObject *OtkColor_FromName(const char *name, int screen) // add it to the cache PyDict_SetItem(colorcache, (PyObject*)self, (PyObject*)self); + allocate(self); return (PyObject*)self; } -unsigned long OtkColor_Pixel(OtkColor *self) -{ - if (!self->allocated) - allocate(self); - return self->pixel; -} - void OtkColor_CleanupColorCache() { cleancache = True; |
