diff options
Diffstat (limited to 'src')
55 files changed, 161 insertions, 76 deletions
diff --git a/src/cairo/cdcairodbuf.c b/src/cairo/cdcairodbuf.c index 91f1649..845a24b 100644 --- a/src/cairo/cdcairodbuf.c +++ b/src/cairo/cdcairodbuf.c @@ -137,7 +137,8 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdDBufferContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_REGION | CD_CAP_WRITEMODE | CD_CAP_PALETTE ), - 0, + 1, + CD_CTX_IMAGE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/cairo/cdcairoemf.c b/src/cairo/cdcairoemf.c index 979caa7..f83ae11 100644 --- a/src/cairo/cdcairoemf.c +++ b/src/cairo/cdcairoemf.c @@ -108,7 +108,8 @@ static cdContext cdEMFCairoContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_REGION | CD_CAP_GETIMAGERGB | CD_CAP_WRITEMODE | CD_CAP_PALETTE | CD_CAP_IMAGESRV), - 0, + 1, + CD_CTX_FILE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/cairo/cdcairoimg.c b/src/cairo/cdcairoimg.c index bc39129..3786de1 100644 --- a/src/cairo/cdcairoimg.c +++ b/src/cairo/cdcairoimg.c @@ -38,7 +38,8 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdImageContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_REGION | CD_CAP_WRITEMODE | CD_CAP_PALETTE ), - 0, + 1, + CD_CTX_IMAGE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/cairo/cdcairoirgb.c b/src/cairo/cdcairoirgb.c index b326834..21ff6c5 100644 --- a/src/cairo/cdcairoirgb.c +++ b/src/cairo/cdcairoirgb.c @@ -146,7 +146,8 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdCairoImageRGBContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_REGION | CD_CAP_WRITEMODE | CD_CAP_PALETTE), - 0, + 0, /* not a plus driver */ + CD_CTX_IMAGE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/cairo/cdcaironative_gdk.c b/src/cairo/cdcaironative_gdk.c index 143efaf..1e177a4 100644 --- a/src/cairo/cdcaironative_gdk.c +++ b/src/cairo/cdcaironative_gdk.c @@ -96,6 +96,7 @@ static cdContext cdNativeWindowContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_REGION | CD_CAP_WRITEMODE | CD_CAP_PALETTE), 1, + CD_CTX_WINDOW, cdcreatecanvas, cdinittable, NULL, diff --git a/src/cairo/cdcaironative_win32.c b/src/cairo/cdcaironative_win32.c index e0b860e..3cc1972 100644 --- a/src/cairo/cdcaironative_win32.c +++ b/src/cairo/cdcaironative_win32.c @@ -145,6 +145,7 @@ static cdContext cdNativeWindowContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_REGION | CD_CAP_WRITEMODE | CD_CAP_PALETTE), 1, + CD_CTX_WINDOW, cdcreatecanvas, cdinittable, NULL, @@ -156,5 +157,3 @@ cdContext* cdContextCairoNativeWindow(void) { return &cdNativeWindowContext; } - -// cairo_win32_printing_surface_create CD_PRINTER diff --git a/src/cairo/cdcaironative_x11.c b/src/cairo/cdcaironative_x11.c index 1030745..ae08420 100644 --- a/src/cairo/cdcaironative_x11.c +++ b/src/cairo/cdcaironative_x11.c @@ -85,6 +85,7 @@ static cdContext cdNativeWindowContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_REGION | CD_CAP_WRITEMODE | CD_CAP_PALETTE ), 1, + CD_CTX_WINDOW, cdcreatecanvas, cdinittable, NULL, diff --git a/src/cairo/cdcairopdf.c b/src/cairo/cdcairopdf.c index f17fff4..980da72 100644 --- a/src/cairo/cdcairopdf.c +++ b/src/cairo/cdcairopdf.c @@ -109,7 +109,8 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdCairoPDFContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_REGION | CD_CAP_WRITEMODE | CD_CAP_PALETTE), - 0, + 0, /* not a plus driver */ + CD_CTX_FILE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/cairo/cdcairoplus.c b/src/cairo/cdcairoplus.c index a46d9f3..d37efa7 100644 --- a/src/cairo/cdcairoplus.c +++ b/src/cairo/cdcairoplus.c @@ -16,14 +16,14 @@ void cdInitContextPlus(void) cdContext* ctx_list[NUM_CONTEXTPLUS]; memset(ctx_list, 0, sizeof(ctx_list)); - ctx_list[CD_CTX_NATIVEWINDOW] = cdContextCairoNativeWindow(); - ctx_list[CD_CTX_IMAGE] = cdContextCairoImage(); - ctx_list[CD_CTX_DBUFFER] = cdContextCairoDBuffer(); + ctx_list[CD_CTXPLUS_NATIVEWINDOW] = cdContextCairoNativeWindow(); + ctx_list[CD_CTXPLUS_IMAGE] = cdContextCairoImage(); + ctx_list[CD_CTXPLUS_DBUFFER] = cdContextCairoDBuffer(); #ifndef CAIRO_X11 - ctx_list[CD_CTX_PRINTER] = cdContextCairoPrinter(); + ctx_list[CD_CTXPLUS_PRINTER] = cdContextCairoPrinter(); #endif #ifdef WIN32 - ctx_list[CD_CTX_EMF] = cdContextCairoEMF(); + ctx_list[CD_CTXPLUS_EMF] = cdContextCairoEMF(); #endif cdInitContextPlusList(ctx_list); diff --git a/src/cairo/cdcairoprn_unix.c b/src/cairo/cdcairoprn_unix.c index 67fad83..0c4544c 100644 --- a/src/cairo/cdcairoprn_unix.c +++ b/src/cairo/cdcairoprn_unix.c @@ -194,7 +194,8 @@ static cdContext cdPrinterCairoContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_REGION | CD_CAP_GETIMAGERGB | CD_CAP_WRITEMODE | CD_CAP_PALETTE | CD_CAP_IMAGESRV), - 0, + 1, + CD_CTX_DEVICE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/cairo/cdcairoprn_win32.c b/src/cairo/cdcairoprn_win32.c index cbf4d66..a5fadbd 100644 --- a/src/cairo/cdcairoprn_win32.c +++ b/src/cairo/cdcairoprn_win32.c @@ -181,7 +181,8 @@ static cdContext cdPrinterCairoContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_REGION | CD_CAP_GETIMAGERGB | CD_CAP_WRITEMODE | CD_CAP_PALETTE | CD_CAP_IMAGESRV), - 0, + 1, + CD_CTX_DEVICE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/cairo/cdcairops.c b/src/cairo/cdcairops.c index 78cd3db..8880255 100644 --- a/src/cairo/cdcairops.c +++ b/src/cairo/cdcairops.c @@ -158,7 +158,8 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdCairoPSContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_REGION | CD_CAP_WRITEMODE | CD_CAP_PALETTE), - 0, + 0, /* not a plus driver */ + CD_CTX_FILE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/cairo/cdcairosvg.c b/src/cairo/cdcairosvg.c index d97cb24..116d39d 100644 --- a/src/cairo/cdcairosvg.c +++ b/src/cairo/cdcairosvg.c @@ -70,7 +70,8 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdCairoSVGContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_REGION | CD_CAP_WRITEMODE | CD_CAP_PALETTE), - 0, + 0, /* not a plus driver */ + CD_CTX_FILE, cdcreatecanvas, cdinittable, NULL, @@ -264,6 +264,20 @@ unsigned long cdContextCaps(cdContext *context) return context->caps; } +int cdContextIsPlus(cdContext *context) +{ + if (!context) + return (unsigned long)CD_ERROR; + return context->plus; +} + +int cdContextType(cdContext *context) +{ + if (!context) + return (unsigned long)CD_ERROR; + return context->type; +} + int cdCanvasSimulate(cdCanvas* canvas, int mode) { int sim_mode; @@ -38,6 +38,8 @@ EXPORTS cdKillCanvas cdGetContext cdContextCaps + cdContextIsPlus + cdContextType cdActivate cdActiveCanvas cdSimulate diff --git a/src/cdgdk.def b/src/cdgdk.def index 6489315..a338ee3 100644 --- a/src/cdgdk.def +++ b/src/cdgdk.def @@ -38,6 +38,8 @@ EXPORTS cdKillCanvas cdGetContext cdContextCaps + cdContextIsPlus + cdContextType cdActivate cdActiveCanvas cdSimulate diff --git a/src/drv/cd0emf.c b/src/drv/cd0emf.c index 7e05134..920d7ee 100644 --- a/src/drv/cd0emf.c +++ b/src/drv/cd0emf.c @@ -14,7 +14,7 @@ cdContext* cdContextEMF(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_EMF); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_EMF); if (ctx != NULL) return ctx; } diff --git a/src/drv/cd0prn.c b/src/drv/cd0prn.c index fa313d8..0293bb4 100644 --- a/src/drv/cd0prn.c +++ b/src/drv/cd0prn.c @@ -15,7 +15,7 @@ cdContext* cdContextPrinter(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_PRINTER); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_PRINTER); if (ctx != NULL) return ctx; } diff --git a/src/drv/cdcgm.c b/src/drv/cdcgm.c index 28624d0..17a1239 100644 --- a/src/drv/cdcgm.c +++ b/src/drv/cdcgm.c @@ -1136,6 +1136,7 @@ static cdContext cdCGMContext = CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB | CD_CAP_TEXTORIENTATION | CD_CAP_PATH | CD_CAP_BEZIER), 0, + CD_CTX_FILE, cdcreatecanvas, cdinittable, cdplayCGM, diff --git a/src/drv/cddebug.c b/src/drv/cddebug.c index bd91209..3550fc6 100644 --- a/src/drv/cddebug.c +++ b/src/drv/cddebug.c @@ -821,6 +821,7 @@ static cdContext cdDebugContext = { CD_CAP_ALL, 0, + CD_CTX_FILE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/drv/cddgn.c b/src/drv/cddgn.c index e0c497b..505526a 100644 --- a/src/drv/cddgn.c +++ b/src/drv/cddgn.c @@ -1688,6 +1688,7 @@ static cdContext cdDGNContext = CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB | CD_CAP_FPRIMTIVES | CD_CAP_TEXTORIENTATION), 0, + CD_CTX_FILE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/drv/cddxf.c b/src/drv/cddxf.c index c5d0df5..bdb77a4 100644 --- a/src/drv/cddxf.c +++ b/src/drv/cddxf.c @@ -1364,6 +1364,7 @@ static cdContext cdDXFContext = CD_CAP_HATCH | CD_CAP_STIPPLE | CD_CAP_PATTERN | CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB), 0, + CD_CTX_FILE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/drv/cdgl.c b/src/drv/cdgl.c index fb1739d..120e4bc 100644 --- a/src/drv/cdgl.c +++ b/src/drv/cdgl.c @@ -1548,6 +1548,7 @@ static cdContext cdGLContext = CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_PALETTE | CD_CAP_LINEJOIN | CD_CAP_LINECAP | CD_CAP_REGION | CD_CAP_STIPPLE | CD_CAP_PATTERN), 0, + CD_CTX_WINDOW, cdcreatecanvas, cdinittable, NULL, diff --git a/src/drv/cdirgb.c b/src/drv/cdirgb.c index fa45f97..5b72dc6 100644 --- a/src/drv/cdirgb.c +++ b/src/drv/cdirgb.c @@ -1879,6 +1879,7 @@ static cdContext cdImageRGBContext = CD_CAP_LINECAP | CD_CAP_LINEJOIN | CD_CAP_PALETTE ), 0, + CD_CTX_IMAGE, cdcreatecanvas, cdinittable, NULL, @@ -1975,6 +1976,7 @@ static cdContext cdDBufferRGBContext = CD_CAP_LINECAP | CD_CAP_LINEJOIN | CD_CAP_PALETTE ), 0, + CD_CTX_IMAGE, cdcreatecanvasDB, cdinittableDB, NULL, diff --git a/src/drv/cdmf.c b/src/drv/cdmf.c index ddb109c..ecbdf8c 100644 --- a/src/drv/cdmf.c +++ b/src/drv/cdmf.c @@ -1263,6 +1263,7 @@ static cdContext cdMetafileContext = CD_CAP_ALL & ~(CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV | CD_CAP_REGION | CD_CAP_FONTDIM | CD_CAP_TEXTSIZE), 0, + CD_CTX_FILE, cdcreatecanvasMF, cdinittableMF, cdplay, diff --git a/src/drv/cdpdf.c b/src/drv/cdpdf.c index 3211cba..f7f3b36 100644 --- a/src/drv/cdpdf.c +++ b/src/drv/cdpdf.c @@ -1734,6 +1734,7 @@ static cdContext cdPDFContext = CD_CAP_REGION | CD_CAP_IMAGESRV | CD_CAP_TEXTSIZE | CD_CAP_WRITEMODE | CD_CAP_GETIMAGERGB), 0, + CD_CTX_FILE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/drv/cdpicture.c b/src/drv/cdpicture.c index 8cd586e..85bb84a 100644 --- a/src/drv/cdpicture.c +++ b/src/drv/cdpicture.c @@ -1397,6 +1397,7 @@ static cdContext cdPictureContext = CD_CAP_ALL & ~(CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV | CD_CAP_REGION | CD_CAP_FONTDIM | CD_CAP_TEXTSIZE), 0, + CD_CTX_DEVICE, cdcreatecanvas, cdinittable, cdplay, diff --git a/src/drv/cdps.c b/src/drv/cdps.c index 0db3590..abd7359 100644 --- a/src/drv/cdps.c +++ b/src/drv/cdps.c @@ -2128,6 +2128,7 @@ static cdContext cdPSContext = CD_CAP_FONTDIM | CD_CAP_TEXTSIZE | CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB), 0, + CD_CTX_FILE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/gdiplus/cdwclpp.cpp b/src/gdiplus/cdwclpp.cpp index 2d1c7e6..9fa2c4c 100644 --- a/src/gdiplus/cdwclpp.cpp +++ b/src/gdiplus/cdwclpp.cpp @@ -189,6 +189,7 @@ static cdContext cdClipboardContext = CD_CAP_ALL & ~(CD_CAP_CLEAR | CD_CAP_FLUSH | CD_CAP_YAXIS | CD_CAP_PLAY | CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV ), 1, + CD_CTX_DEVICE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/gdiplus/cdwdbufp.cpp b/src/gdiplus/cdwdbufp.cpp index 68bc7b8..df81265 100644 --- a/src/gdiplus/cdwdbufp.cpp +++ b/src/gdiplus/cdwdbufp.cpp @@ -149,6 +149,7 @@ static cdContext cdDBufferContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS ), 1, + CD_CTX_IMAGE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/gdiplus/cdwemfp.cpp b/src/gdiplus/cdwemfp.cpp index 23ae02d..b19f4cb 100644 --- a/src/gdiplus/cdwemfp.cpp +++ b/src/gdiplus/cdwemfp.cpp @@ -88,6 +88,7 @@ static cdContext cdEMFContext = CD_CAP_ALL & ~(CD_CAP_CLEAR | CD_CAP_PLAY | CD_CAP_FLUSH | CD_CAP_YAXIS | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV), 1, + CD_CTX_FILE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/gdiplus/cdwgdiplus.c b/src/gdiplus/cdwgdiplus.c index a6862bc..4997d3c 100644 --- a/src/gdiplus/cdwgdiplus.c +++ b/src/gdiplus/cdwgdiplus.c @@ -28,12 +28,12 @@ void cdInitContextPlus(void) cdContext* ctx_list[NUM_CONTEXTPLUS]; memset(ctx_list, 0, sizeof(ctx_list)); - ctx_list[CD_CTX_NATIVEWINDOW] = cdContextNativeWindowPlus(); - ctx_list[CD_CTX_IMAGE] = cdContextImagePlus(); - ctx_list[CD_CTX_DBUFFER] = cdContextDBufferPlus(); - ctx_list[CD_CTX_PRINTER] = cdContextPrinterPlus(); - ctx_list[CD_CTX_EMF] = cdContextEMFPlus(); - ctx_list[CD_CTX_CLIPBOARD] = cdContextClipboardPlus(); + ctx_list[CD_CTXPLUS_NATIVEWINDOW] = cdContextNativeWindowPlus(); + ctx_list[CD_CTXPLUS_IMAGE] = cdContextImagePlus(); + ctx_list[CD_CTXPLUS_DBUFFER] = cdContextDBufferPlus(); + ctx_list[CD_CTXPLUS_PRINTER] = cdContextPrinterPlus(); + ctx_list[CD_CTXPLUS_EMF] = cdContextEMFPlus(); + ctx_list[CD_CTXPLUS_CLIPBOARD] = cdContextClipboardPlus(); cdInitContextPlusList(ctx_list); diff --git a/src/gdiplus/cdwimgp.cpp b/src/gdiplus/cdwimgp.cpp index 5dd8b96..9b45edb 100644 --- a/src/gdiplus/cdwimgp.cpp +++ b/src/gdiplus/cdwimgp.cpp @@ -50,6 +50,7 @@ static cdContext cdImageContext = { CD_CAP_ALL & ~(CD_CAP_FLUSH | CD_CAP_PLAY | CD_CAP_YAXIS ), 1, + CD_CTX_IMAGE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/gdiplus/cdwnativep.cpp b/src/gdiplus/cdwnativep.cpp index 80209af..4fdc19a 100644 --- a/src/gdiplus/cdwnativep.cpp +++ b/src/gdiplus/cdwnativep.cpp @@ -123,6 +123,7 @@ static cdContext cdNativeContext = { CD_CAP_ALL & ~(CD_CAP_FLUSH | CD_CAP_PLAY | CD_CAP_YAXIS ), 1, + CD_CTX_WINDOW, cdcreatecanvas, cdinittable, NULL, diff --git a/src/gdiplus/cdwprnp.cpp b/src/gdiplus/cdwprnp.cpp index 2eed9d9..df62ca5 100644 --- a/src/gdiplus/cdwprnp.cpp +++ b/src/gdiplus/cdwprnp.cpp @@ -142,6 +142,7 @@ static cdContext cdPrinterContext = CD_CAP_ALL & ~(CD_CAP_CLEAR | CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV), 1, + CD_CTX_DEVICE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/gdk/cdgdkclp.c b/src/gdk/cdgdkclp.c index c6557b9..e861b5e 100644 --- a/src/gdk/cdgdkclp.c +++ b/src/gdk/cdgdkclp.c @@ -122,6 +122,7 @@ static cdContext cdClipboardContext = { CD_CAP_ALL & ~(CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV | CD_CAP_FONTDIM | CD_CAP_TEXTSIZE ), /* same as CD_MF */ 0, + CD_CTX_DEVICE, cdcreatecanvas, cdinittable, cdplay, diff --git a/src/gdk/cdgdkdbuf.c b/src/gdk/cdgdkdbuf.c index 50a93a5..3df8ec3 100644 --- a/src/gdk/cdgdkdbuf.c +++ b/src/gdk/cdgdkdbuf.c @@ -129,6 +129,7 @@ static cdContext cdDBufferContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_PATH | CD_CAP_BEZIER | CD_CAP_FPRIMTIVES ), 0, + CD_CTX_IMAGE, cdcreatecanvas, cdinittable, NULL, @@ -139,7 +140,7 @@ cdContext* cdContextDBuffer(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_DBUFFER); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_DBUFFER); if (ctx != NULL) return ctx; } diff --git a/src/gdk/cdgdkimg.c b/src/gdk/cdgdkimg.c index 4b4475b..aab9a1b 100644 --- a/src/gdk/cdgdkimg.c +++ b/src/gdk/cdgdkimg.c @@ -32,6 +32,7 @@ static cdContext cdImageContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES | CD_CAP_PATH | CD_CAP_BEZIER ), 0, + CD_CTX_IMAGE, cdcreatecanvas, cdinittable, NULL, @@ -43,7 +44,7 @@ cdContext* cdContextImage(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_IMAGE); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_IMAGE); if (ctx != NULL) return ctx; } diff --git a/src/gdk/cdgdknative.c b/src/gdk/cdgdknative.c index 8865d7e..8e66dbe 100644 --- a/src/gdk/cdgdknative.c +++ b/src/gdk/cdgdknative.c @@ -96,7 +96,8 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdNativeWindowContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES | CD_CAP_PATH | CD_CAP_BEZIER ), - 1, + 0, + CD_CTX_WINDOW, cdcreatecanvas, cdinittable, NULL, @@ -108,7 +109,7 @@ cdContext* cdContextNativeWindow(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_NATIVEWINDOW); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_NATIVEWINDOW); if (ctx != NULL) return ctx; } diff --git a/src/lua5/cdlua5.c b/src/lua5/cdlua5.c index 024ed6b..6eb1769 100644 --- a/src/lua5/cdlua5.c +++ b/src/lua5/cdlua5.c @@ -335,7 +335,21 @@ void cdlua_pushbitmap(lua_State* L, cdBitmap* bitmap) static int cdlua5_contextcaps(lua_State * L) { cdluaContext* cdlua_ctx = cdlua_getcontext(L, 1); - lua_pushnumber(L, cdContextCaps(cdlua_ctx->ctx())); + lua_pushinteger(L, cdContextCaps(cdlua_ctx->ctx())); + return 1; +} + +static int cdlua5_contexttype(lua_State * L) +{ + cdluaContext* cdlua_ctx = cdlua_getcontext(L, 1); + lua_pushinteger(L, cdContextType(cdlua_ctx->ctx())); + return 1; +} + +static int cdlua5_contextisplus(lua_State * L) +{ + cdluaContext* cdlua_ctx = cdlua_getcontext(L, 1); + lua_pushboolean(L, cdContextIsPlus(cdlua_ctx->ctx())); return 1; } @@ -1315,6 +1329,8 @@ static const struct luaL_reg cdlib[] = { /* Initialization */ {"ContextCaps" , cdlua5_contextcaps}, + {"ContextType" , cdlua5_contexttype}, + {"ContextIsPlus" , cdlua5_contextisplus}, /* Control */ {"ReleaseState" , cdlua5_releasestate}, @@ -1553,38 +1569,45 @@ static const struct cdlua5_constant cdlibconstant[] = { {"LARGE" , CD_LARGE}, /* Canvas Capabilities */ - {"CAP_NONE" , CD_CAP_NONE}, - {"CAP_FLUSH" , CD_CAP_FLUSH}, - {"CAP_CLEAR" , CD_CAP_CLEAR}, - {"CAP_PLAY" , CD_CAP_PLAY}, - {"CAP_YAXIS" , CD_CAP_YAXIS}, - {"CAP_CLIPAREA" , CD_CAP_CLIPAREA}, - {"CAP_CLIPPOLY" , CD_CAP_CLIPPOLY}, - {"CAP_RECT" , CD_CAP_RECT}, - {"CAP_IMAGERGB" , CD_CAP_IMAGERGB}, - {"CAP_IMAGERGBA" , CD_CAP_IMAGERGBA}, - {"CAP_IMAGEMAP" , CD_CAP_IMAGEMAP}, - {"CAP_GETIMAGERGB" , CD_CAP_GETIMAGERGB}, - {"CAP_IMAGESRV" , CD_CAP_IMAGESRV}, - {"CAP_BACKGROUND" , CD_CAP_BACKGROUND}, - {"CAP_BACKOPACITY" , CD_CAP_BACKOPACITY}, - {"CAP_WRITEMODE" , CD_CAP_WRITEMODE}, - {"CAP_LINESTYLE" , CD_CAP_LINESTYLE}, - {"CAP_LINEWITH" , CD_CAP_LINEWITH}, - {"CAP_WD" , CD_CAP_FPRIMTIVES}, - {"CAP_HATCH" , CD_CAP_HATCH}, - {"CAP_STIPPLE" , CD_CAP_STIPPLE}, - {"CAP_PATTERN" , CD_CAP_PATTERN}, - {"CAP_FONT" , CD_CAP_FONT}, - {"CAP_FONTDIM" , CD_CAP_FONTDIM}, - {"CAP_TEXTSIZE" , CD_CAP_TEXTSIZE}, - {"CAP_TEXTORIENTATION", CD_CAP_TEXTORIENTATION}, - {"CAP_PALETTE" , CD_CAP_PALETTE}, - {"CAP_LINECAP" , CD_CAP_LINECAP}, - {"CAP_LINEJOIN" , CD_CAP_LINEJOIN}, - {"CAP_REGION" , CD_CAP_REGION}, + {"CAP_NONE" , CD_CAP_NONE}, + {"CAP_FLUSH" , CD_CAP_FLUSH}, + {"CAP_CLEAR" , CD_CAP_CLEAR}, + {"CAP_PLAY" , CD_CAP_PLAY}, + {"CAP_YAXIS" , CD_CAP_YAXIS}, + {"CAP_CLIPAREA" , CD_CAP_CLIPAREA}, + {"CAP_CLIPPOLY" , CD_CAP_CLIPPOLY}, + {"CAP_REGION" , CD_CAP_REGION}, + {"CAP_RECT" , CD_CAP_RECT}, {"CAP_CHORD" , CD_CAP_CHORD}, - {"CAP_ALL" , CD_CAP_ALL}, + {"CAP_IMAGERGB" , CD_CAP_IMAGERGB}, + {"CAP_IMAGERGBA" , CD_CAP_IMAGERGBA}, + {"CAP_IMAGEMAP" , CD_CAP_IMAGEMAP}, + {"CAP_GETIMAGERGB" , CD_CAP_GETIMAGERGB}, + {"CAP_IMAGESRV" , CD_CAP_IMAGESRV}, + {"CAP_BACKGROUND" , CD_CAP_BACKGROUND}, + {"CAP_BACKOPACITY" , CD_CAP_BACKOPACITY}, + {"CAP_WRITEMODE" , CD_CAP_WRITEMODE}, + {"CAP_LINESTYLE" , CD_CAP_LINESTYLE}, + {"CAP_LINEWITH" , CD_CAP_LINEWITH}, + {"CAP_WD" , CD_CAP_FPRIMTIVES}, + {"CAP_HATCH" , CD_CAP_HATCH}, + {"CAP_STIPPLE" , CD_CAP_STIPPLE}, + {"CAP_PATTERN" , CD_CAP_PATTERN}, + {"CAP_FONT" , CD_CAP_FONT}, + {"CAP_FONTDIM" , CD_CAP_FONTDIM}, + {"CAP_TEXTSIZE" , CD_CAP_TEXTSIZE}, + {"CAP_TEXTORIENTATION", CD_CAP_TEXTORIENTATION}, + {"CAP_PALETTE" , CD_CAP_PALETTE}, + {"CAP_LINECAP" , CD_CAP_LINECAP}, + {"CAP_LINEJOIN" , CD_CAP_LINEJOIN}, + {"CAP_PATH" , CD_CAP_PATH}, + {"CAP_BEZIER" , CD_CAP_BEZIER}, + {"CAP_ALL" , CD_CAP_ALL}, + + {"CTX_WINDOW" , CD_CTX_WINDOW}, + {"CTX_DEVICE" , CD_CTX_DEVICE}, + {"CTX_IMAGE" , CD_CTX_IMAGE}, + {"CTX_FILE" , CD_CTX_FILE}, /* cdPlay definitions */ {"SIZECB", CD_SIZECB}, diff --git a/src/lua5/cdvoid5.c b/src/lua5/cdvoid5.c index 67c2c99..ebc965c 100644 --- a/src/lua5/cdvoid5.c +++ b/src/lua5/cdvoid5.c @@ -117,6 +117,7 @@ static cdContext cdVoidContext = { 0, 0, + 0, cdcreatecanvas, cdinittable, NULL, diff --git a/src/svg/cdsvg.c b/src/svg/cdsvg.c index bfde533..64d6be7 100644 --- a/src/svg/cdsvg.c +++ b/src/svg/cdsvg.c @@ -1343,6 +1343,7 @@ static cdContext cdSVGContext = CD_CAP_FONTDIM | CD_CAP_TEXTSIZE | CD_CAP_GETIMAGERGB), 0, + CD_CTX_FILE, cdcreatecanvas, cdinittable, NULL, diff --git a/src/win32/cdwclp.c b/src/win32/cdwclp.c index 60c29e0..3c31569 100644 --- a/src/win32/cdwclp.c +++ b/src/win32/cdwclp.c @@ -531,6 +531,7 @@ static cdContext cdClipboardContext = CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV | CD_CAP_FPRIMTIVES ), 0, + CD_CTX_DEVICE, cdcreatecanvas, cdinittable, cdplay, @@ -541,7 +542,7 @@ cdContext* cdContextClipboard(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_CLIPBOARD); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_CLIPBOARD); if (ctx != NULL) return ctx; } diff --git a/src/win32/cdwdbuf.c b/src/win32/cdwdbuf.c index 9d79e9b..54dbf16 100644 --- a/src/win32/cdwdbuf.c +++ b/src/win32/cdwdbuf.c @@ -142,6 +142,7 @@ static cdContext cdDBufferContext = CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES ), 0, + CD_CTX_IMAGE, cdcreatecanvas, cdinittable, NULL, @@ -152,7 +153,7 @@ cdContext* cdContextDBuffer(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_DBUFFER); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_DBUFFER); if (ctx != NULL) return ctx; } diff --git a/src/win32/cdwemf.c b/src/win32/cdwemf.c index ad037c9..3932c36 100644 --- a/src/win32/cdwemf.c +++ b/src/win32/cdwemf.c @@ -98,6 +98,7 @@ static cdContext cdEMFContext = CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV | CD_CAP_FPRIMTIVES ), 0, + CD_CTX_FILE, cdcreatecanvas, cdinittable, cdplayEMF, @@ -108,7 +109,7 @@ cdContext* cdContextEMF(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_EMF); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_EMF); if (ctx != NULL) return ctx; } diff --git a/src/win32/cdwimg.c b/src/win32/cdwimg.c index 47d99f9..294a8d7 100644 --- a/src/win32/cdwimg.c +++ b/src/win32/cdwimg.c @@ -64,6 +64,7 @@ static cdContext cdImageContext = CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES ), 0, + CD_CTX_IMAGE, cdcreatecanvas, cdinittable, NULL, @@ -74,7 +75,7 @@ cdContext* cdContextImage(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_IMAGE); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_IMAGE); if (ctx != NULL) return ctx; } diff --git a/src/win32/cdwnative.c b/src/win32/cdwnative.c index 3534c6e..bd9d4dd 100644 --- a/src/win32/cdwnative.c +++ b/src/win32/cdwnative.c @@ -186,6 +186,7 @@ static cdContext cdNativeContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES ), 0, + CD_CTX_WINDOW, cdcreatecanvas, cdinittable, NULL, @@ -196,7 +197,7 @@ cdContext* cdContextNativeWindow(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_NATIVEWINDOW); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_NATIVEWINDOW); if (ctx != NULL) return ctx; } diff --git a/src/win32/cdwprn.c b/src/win32/cdwprn.c index 1b3e1e0..1ffcd03 100644 --- a/src/win32/cdwprn.c +++ b/src/win32/cdwprn.c @@ -186,6 +186,7 @@ static cdContext cdPrinterContext = CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV | CD_CAP_FPRIMTIVES ), 0, + CD_CTX_DEVICE, cdcreatecanvas, cdinittable, NULL, @@ -196,7 +197,7 @@ cdContext* cdContextPrinter(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_PRINTER); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_PRINTER); if (ctx != NULL) return ctx; } diff --git a/src/win32/cdwwmf.c b/src/win32/cdwwmf.c index 0571c9f..26d8fa9 100644 --- a/src/win32/cdwwmf.c +++ b/src/win32/cdwwmf.c @@ -97,6 +97,7 @@ static cdContext cdWMFContext = CD_CAP_LINECAP | CD_CAP_LINEJOIN | CD_CAP_FPRIMTIVES ), 0, + CD_CTX_FILE, cdcreatecanvas, cdinittable, cdplayWMF, diff --git a/src/x11/cdxclp.c b/src/x11/cdxclp.c index 9363491..ed3b0db 100644 --- a/src/x11/cdxclp.c +++ b/src/x11/cdxclp.c @@ -125,6 +125,7 @@ static cdContext cdClipboardContext = { CD_CAP_ALL & ~(CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV | CD_CAP_FONTDIM | CD_CAP_TEXTSIZE ), /* same as CD_MF */ 0, + CD_CTX_DEVICE, cdcreatecanvas, cdinittable, cdplay, diff --git a/src/x11/cdxdbuf.c b/src/x11/cdxdbuf.c index 29d1e4e..7d29467 100644 --- a/src/x11/cdxdbuf.c +++ b/src/x11/cdxdbuf.c @@ -128,6 +128,7 @@ static cdContext cdDBufferContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES | CD_CAP_PATH | CD_CAP_BEZIER ), 0, + CD_CTX_IMAGE, cdcreatecanvas, cdinittable, NULL, @@ -138,7 +139,7 @@ cdContext* cdContextDBuffer(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_DBUFFER); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_DBUFFER); if (ctx != NULL) return ctx; } diff --git a/src/x11/cdximg.c b/src/x11/cdximg.c index c823705..12db352 100644 --- a/src/x11/cdximg.c +++ b/src/x11/cdximg.c @@ -32,6 +32,7 @@ static cdContext cdImageContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES | CD_CAP_PATH | CD_CAP_BEZIER ), 0, + CD_CTX_IMAGE, cdcreatecanvas, cdinittable, NULL, @@ -43,7 +44,7 @@ cdContext* cdContextImage(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_IMAGE); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_IMAGE); if (ctx != NULL) return ctx; } diff --git a/src/x11/cdxnative.c b/src/x11/cdxnative.c index a69314c..ddf6670 100644 --- a/src/x11/cdxnative.c +++ b/src/x11/cdxnative.c @@ -144,7 +144,8 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdNativeWindowContext = { CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES | CD_CAP_PATH | CD_CAP_BEZIER), - 1, + 0, + CD_CTX_WINDOW, cdcreatecanvas, cdinittable, NULL, @@ -156,7 +157,7 @@ cdContext* cdContextNativeWindow(void) { if (cdUseContextPlus(CD_QUERY)) { - cdContext* ctx = cdGetContextPlus(CD_CTX_NATIVEWINDOW); + cdContext* ctx = cdGetContextPlus(CD_CTXPLUS_NATIVEWINDOW); if (ctx != NULL) return ctx; } diff --git a/src/xrender/cdxrender.c b/src/xrender/cdxrender.c index 2f99da3..dfd4370 100644 --- a/src/xrender/cdxrender.c +++ b/src/xrender/cdxrender.c @@ -981,9 +981,9 @@ static void xrCreateContextPlus(cdCtxCanvas *ctxcanvas) /*******************************************************************************************************/ -static cdContext cdDBufferContext = {0,0,NULL,NULL,NULL,NULL}; -static cdContext cdNativeWindowContext = {0,0,NULL,NULL,NULL,NULL}; -static cdContext cdImageContext = {0,0,NULL,NULL,NULL,NULL}; +static cdContext cdDBufferContext = {0,0,0,NULL,NULL,NULL,NULL}; +static cdContext cdNativeWindowContext = {0,0,0,NULL,NULL,NULL,NULL}; +static cdContext cdImageContext = {0,0,0,NULL,NULL,NULL,NULL}; static void (*cdcreatecanvasDBUFFER)(cdCanvas* canvas, void* data) = NULL; static void (*cdcreatecanvasNATIVE)(cdCanvas* canvas, void* data) = NULL; diff --git a/src/xrender/cdxrplus.c b/src/xrender/cdxrplus.c index f938a6f..589aa3c 100644 --- a/src/xrender/cdxrplus.c +++ b/src/xrender/cdxrplus.c @@ -18,9 +18,9 @@ void cdInitContextPlus(void) cdContext* ctx_list[NUM_CONTEXTPLUS]; memset(ctx_list, 0, sizeof(ctx_list)); - ctx_list[CD_CTX_NATIVEWINDOW] = cdContextNativeWindowPlus(); - ctx_list[CD_CTX_IMAGE] = cdContextImagePlus(); - ctx_list[CD_CTX_DBUFFER] = cdContextDBufferPlus(); + ctx_list[CD_CTXPLUS_NATIVEWINDOW] = cdContextNativeWindowPlus(); + ctx_list[CD_CTXPLUS_IMAGE] = cdContextImagePlus(); + ctx_list[CD_CTXPLUS_DBUFFER] = cdContextDBufferPlus(); cdInitContextPlusList(ctx_list); } |