summaryrefslogtreecommitdiff
path: root/fb
diff options
context:
space:
mode:
authorBen Byer <bbyer@bbyer.local>2008-04-20 04:49:57 -0700
committerBen Byer <bbyer@bbyer.local>2008-04-20 04:49:57 -0700
commit6877235d176dc534ee6ac655182d939fe83f3117 (patch)
tree97a9644131c401d28e78c11d37fc9caaaf828f78 /fb
parentb83ceaaabc989c80e78391e1d81e17d6d9c31afe (diff)
converted fbGetDrawable into a function, for extra debugging bliss
Diffstat (limited to 'fb')
-rw-r--r--fb/fb.h5
-rw-r--r--fb/fbutil.c43
2 files changed, 48 insertions, 0 deletions
diff --git a/fb/fb.h b/fb/fb.h
index 65fa17356..a37eab47a 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -707,6 +707,7 @@ typedef struct {
#define __fbPixOffXPix(pPix) (__fbPixDrawableX(pPix))
#define __fbPixOffYPix(pPix) (__fbPixDrawableY(pPix))
+#if 0
#define fbGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
PixmapPtr _pPix; \
if ((pDrawable)->type != DRAWABLE_PIXMAP) { \
@@ -724,6 +725,10 @@ typedef struct {
(bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
CHECK_NULL(pointer); \
}
+#else
+ #define fbGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) \
+ _fbGetDrawable(pDrawable, &(pointer), &(stride), &(bpp), &(xoff), &(yoff))
+#endif
#define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
PixmapPtr _pPix; \
diff --git a/fb/fbutil.c b/fb/fbutil.c
index 5e232971e..fae42d90a 100644
--- a/fb/fbutil.c
+++ b/fb/fbutil.c
@@ -360,3 +360,46 @@ const FbBits * const fbStippleTable[] = {
0,
fbStipple8Bits,
};
+
+static char *_fb_drawable_type_names[] = {
+ "DRAWABLE_WINDOW",
+ "DRAWABLE_PIXMAP",
+ "UNDRAWABLE_WINDOW",
+ "DRAWABLE_BUFFER"
+};
+
+void _fbGetDrawable(DrawablePtr pDrawable, FbBits ** pointer, int *stride,
+ int *bpp, int *xoff, int *yoff) {
+ PixmapPtr _pPix;
+ switch (pDrawable->type) {
+ case DRAWABLE_PIXMAP:
+ _pPix = (PixmapPtr) pDrawable;
+ *xoff = __fbPixOffXPix(_pPix);
+ *yoff = __fbPixOffYPix(_pPix);
+ break;
+ case DRAWABLE_BUFFER:
+ ErrorF("Invalid call to fbGetDrawable on a non-window buffer\n");
+ assert(pDrawable->type != DRAWABLE_BUFFER); // die
+ break;
+ case UNDRAWABLE_WINDOW:
+ ErrorF("Undrawable window?\n");
+ assert(_pPix->type == DRAWABLE_PIXMAP);
+ break;
+ case DRAWABLE_WINDOW:
+ ErrorF("drawable type is %d\n", pDrawable->type);
+ _pPix = fbGetWindowPixmap(pDrawable);
+ assert(_pPix->type == DRAWABLE_PIXMAP);
+ *xoff = __fbPixOffXWin(_pPix);
+ *yoff = __fbPixOffYWin(_pPix);
+ break;
+ default:
+ FatalError("Unknown drawable type %d\n", pDrawable->type);
+ break;
+ }
+
+ fbPrepareAccess(pDrawable);
+ *pointer = (FbBits *) _pPix->devPrivate.ptr;
+ *stride = ((int) _pPix->devKind) / sizeof (FbBits);
+ *bpp = _pPix->drawable.bitsPerPixel;
+ CHECK_NULL(pointer);
+ }