better use of intel_context() cast wrappers

This commit is contained in:
Brian
2007-11-05 09:28:28 -07:00
parent 2edc87eb3d
commit 29c1fdd0ce
3 changed files with 15 additions and 11 deletions

View File

@@ -163,8 +163,7 @@ intelCreateContext(const __GLcontextModes * mesaVis,
void void
intelDestroyContext(__DRIcontextPrivate * driContextPriv) intelDestroyContext(__DRIcontextPrivate * driContextPriv)
{ {
struct intel_context *intel = struct intel_context *intel = intel_context(driContextPriv);
(struct intel_context *) driContextPriv->driverPrivate;
assert(intel); /* should never be null */ assert(intel); /* should never be null */
if (intel) { if (intel) {
@@ -191,8 +190,7 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
GLboolean GLboolean
intelUnbindContext(__DRIcontextPrivate * driContextPriv) intelUnbindContext(__DRIcontextPrivate * driContextPriv)
{ {
struct intel_context *intel struct intel_context *intel = intel_context(driContextPriv);
= (struct intel_context *) driContextPriv->driverPrivate;
st_flush(intel->st); st_flush(intel->st);
return GL_TRUE; return GL_TRUE;
} }
@@ -204,8 +202,7 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
__DRIdrawablePrivate * driReadPriv) __DRIdrawablePrivate * driReadPriv)
{ {
if (driContextPriv) { if (driContextPriv) {
struct intel_context *intel struct intel_context *intel = intel_context(driContextPriv);
= (struct intel_context *) driContextPriv->driverPrivate;
struct intel_framebuffer *draw_fb = intel_framebuffer(driDrawPriv); struct intel_framebuffer *draw_fb = intel_framebuffer(driDrawPriv);
struct intel_framebuffer *read_fb = intel_framebuffer(driReadPriv); struct intel_framebuffer *read_fb = intel_framebuffer(driReadPriv);

View File

@@ -145,12 +145,20 @@ extern int __intel_debug;
/** Cast wrapper */ /** Cast wrapper */
static INLINE struct intel_context * static INLINE struct intel_context *
intel_context(GLcontext * ctx) intel_context_mesa(GLcontext * ctx)
{ {
return (struct intel_context *) ctx->DriverCtx; return (struct intel_context *) ctx->DriverCtx;
} }
/** Cast wrapper */
static INLINE struct intel_context *
intel_context(__DRIcontextPrivate *driContextPriv)
{
return (struct intel_context *) driContextPriv->driverPrivate;
}
/** Cast wrapper */ /** Cast wrapper */
static INLINE struct intel_framebuffer * static INLINE struct intel_framebuffer *
intel_framebuffer(__DRIdrawablePrivate * driDrawPriv) intel_framebuffer(__DRIdrawablePrivate * driDrawPriv)

View File

@@ -58,7 +58,7 @@ intelScreenContext(intelScreenPrivate *intelScreen)
return intelScreen->dummyctxptr; return intelScreen->dummyctxptr;
} }
return intel_context(ctx); return intel_context_mesa(ctx);
} }
@@ -117,7 +117,7 @@ intelDisplaySurface(__DRIdrawablePrivate * dPriv,
/* if this drawable isn't currently bound the LOCK_HARDWARE done on the /* if this drawable isn't currently bound the LOCK_HARDWARE done on the
current context (which is what intelScreenContext should return) might current context (which is what intelScreenContext should return) might
not get a contended lock and thus cliprects not updated (tests/manywin) */ not get a contended lock and thus cliprects not updated (tests/manywin) */
if ((struct intel_context *)dPriv->driContextPriv->driverPrivate != intel) if (intel_context(dPriv->driContextPriv) != intel)
DRI_VALIDATE_DRAWABLE_INFO(intel->driScreen, dPriv); DRI_VALIDATE_DRAWABLE_INFO(intel->driScreen, dPriv);
@@ -277,8 +277,7 @@ void
intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h) intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
{ {
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
struct intel_context *intel = struct intel_context *intel = intel_context(dPriv->driContextPriv);
(struct intel_context *) dPriv->driContextPriv->driverPrivate;
GLcontext *ctx = intel->st->ctx; GLcontext *ctx = intel->st->ctx;
if (ctx->Visual.doubleBufferMode) { if (ctx->Visual.doubleBufferMode) {