⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmesap.h

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 H
📖 第 1 页 / 共 2 页
字号:
   PIXEL = xmesa->xm_visual->RtoPixel[(R)+d]			\         | xmesa->xm_visual->GtoPixel[(G)+d]			\         | xmesa->xm_visual->BtoPixel[(B)+d];			\}/** * If pixelformat==PF_8A8B8G8R: */#define PACK_8A8B8G8R( R, G, B, A )	\	( ((A) << 24) | ((B) << 16) | ((G) << 8) | (R) )/** * Like PACK_8A8B8G8R() but don't use alpha.  This is usually an acceptable * shortcut. */#define PACK_8B8G8R( R, G, B )   ( ((B) << 16) | ((G) << 8) | (R) )/** * If pixelformat==PF_8R8G8B: */#define PACK_8R8G8B( R, G, B)	 ( ((R) << 16) | ((G) << 8) | (B) )/** * If pixelformat==PF_5R6G5B: */#define PACK_5R6G5B( R, G, B)	 ( (((R) & 0xf8) << 8) | (((G) & 0xfc) << 3) | ((B) >> 3) )/** * If pixelformat==PF_8A8R8G8B: */#define PACK_8A8R8G8B( R, G, B, A )	\	( ((A) << 24) | ((R) << 16) | ((G) << 8) | (B) )/** * If pixelformat==PF_DITHER: * * Improved 8-bit RGB dithering code contributed by Bob Mercier * (mercier@hollywood.cinenet.net).  Thanks Bob! */#ifdef DITHER666# define DITH_R   6# define DITH_G   6# define DITH_B   6# define DITH_MIX(r,g,b)  (((r) * DITH_G + (g)) * DITH_B + (b))#else# define DITH_R	5# define DITH_G	9# define DITH_B	5# define DITH_MIX(r,g,b)  (((g) << 6) | ((b) << 3) | (r))#endif#define DITH_DX	4#define DITH_DY	4#define DITH_N	(DITH_DX * DITH_DY)#define _dither(C, c, d)   (((unsigned)((DITH_N * (C - 1) + 1) * c + d)) >> 12)#define MAXC	256extern const int xmesa_kernel8[DITH_DY * DITH_DX];/* Dither for random X,Y */#define DITHER_SETUP						\	int __d;						\	unsigned long *ctable = XMESA_BUFFER(ctx->DrawBuffer)->color_table;#define DITHER( X, Y, R, G, B )				\	(__d = xmesa_kernel8[(((Y)&3)<<2) | ((X)&3)],	\	 ctable[DITH_MIX(_dither(DITH_R, (R), __d),	\		         _dither(DITH_G, (G), __d),	\		         _dither(DITH_B, (B), __d))])/* Dither for random X, fixed Y */#define XDITHER_SETUP(Y)					\	int __d;						\	unsigned long *ctable = XMESA_BUFFER(ctx->DrawBuffer)->color_table;	\	const int *kernel = &xmesa_kernel8[ ((Y)&3) << 2 ];#define XDITHER( X, R, G, B )				\	(__d = kernel[(X)&3],				\	ctable[DITH_MIX(_dither(DITH_R, (R), __d),	\		        _dither(DITH_G, (G), __d),	\		        _dither(DITH_B, (B), __d))])/* * Dithering for flat-shaded triangles.  Precompute all 16 possible * pixel values given the triangle's RGB color.  Contributed by Martin Shenk. */#define FLAT_DITHER_SETUP( R, G, B )					\	GLushort ditherValues[16];					\	{								\	   unsigned long *ctable = XMESA_BUFFER(ctx->DrawBuffer)->color_table;	\	   int msdr = (DITH_N*((DITH_R)-1)+1) * (R);			\	   int msdg = (DITH_N*((DITH_G)-1)+1) * (G);			\	   int msdb = (DITH_N*((DITH_B)-1)+1) * (B);			\	   int i;							\	   for (i=0;i<16;i++) {						\	      int k = xmesa_kernel8[i];					\	      int j = DITH_MIX( (msdr+k)>>12, (msdg+k)>>12, (msdb+k)>>12 );\	      ditherValues[i] = (GLushort) ctable[j];			\	   }								\        }#define FLAT_DITHER_ROW_SETUP(Y)					\	GLushort *ditherRow = ditherValues + ( ((Y)&3) << 2);#define FLAT_DITHER(X)  ditherRow[(X)&3]/** * If pixelformat==PF_LOOKUP: */#define _dither_lookup(C, c)   (((unsigned)((DITH_N * (C - 1) + 1) * c)) >> 12)#define LOOKUP_SETUP						\	unsigned long *ctable = XMESA_BUFFER(ctx->DrawBuffer)->color_table#define LOOKUP( R, G, B )				\	ctable[DITH_MIX(_dither_lookup(DITH_R, (R)),	\		        _dither_lookup(DITH_G, (G)),	\		        _dither_lookup(DITH_B, (B)))]/** * If pixelformat==PF_HPCR: * *      HP Color Recovery dithering               (ad@lms.be 30/08/95) *      HP has on it's 8-bit 700-series computers, a feature called *      'Color Recovery'.  This allows near 24-bit output (so they say). *      It is enabled by selecting the 8-bit  TrueColor  visual AND *      corresponding  colormap (see tkInitWindow) AND doing some special *      dither. */extern const short xmesa_HPCR_DRGB[3][2][16];#define DITHER_HPCR( X, Y, R, G, B )					   \  ( ((xmesa->xm_visual->hpcr_rgbTbl[0][R] + xmesa_HPCR_DRGB[0][(Y)&1][(X)&15]) & 0xE0)     \  |(((xmesa->xm_visual->hpcr_rgbTbl[1][G] + xmesa_HPCR_DRGB[1][(Y)&1][(X)&15]) & 0xE0)>>3) \  | ((xmesa->xm_visual->hpcr_rgbTbl[2][B] + xmesa_HPCR_DRGB[2][(Y)&1][(X)&15])>>6)	   \  )/** * If pixelformat==PF_1BIT: */extern const int xmesa_kernel1[16];#define SETUP_1BIT  int bitFlip = xmesa->xm_visual->bitFlip#define DITHER_1BIT( X, Y, R, G, B )	\	(( ((int)(R)+(int)(G)+(int)(B)) > xmesa_kernel1[(((Y)&3) << 2) | ((X)&3)] ) ^ bitFlip)/** * If pixelformat==PF_GRAYSCALE: */#define GRAY_RGB( R, G, B )   XMESA_BUFFER(ctx->DrawBuffer)->color_table[((R) + (G) + (B))/3]/** * Converts a GL window Y coord to an X window Y coord: */#define YFLIP(XRB, Y)  ((XRB)->bottom - (Y))/** * Return the address of a 1, 2 or 4-byte pixel in the buffer's XImage: * X==0 is left, Y==0 is bottom. */#define PIXEL_ADDR1(XRB, X, Y)  \   ( (XRB)->origin1 - (Y) * (XRB)->width1 + (X) )#define PIXEL_ADDR2(XRB, X, Y)  \   ( (XRB)->origin2 - (Y) * (XRB)->width2 + (X) )#define PIXEL_ADDR3(XRB, X, Y)  \   ( (bgr_t *) ( (XRB)->origin3 - (Y) * (XRB)->width3 + 3 * (X) ))#define PIXEL_ADDR4(XRB, X, Y)  \   ( (XRB)->origin4 - (Y) * (XRB)->width4 + (X) )/* * External functions: */extern struct xmesa_renderbuffer *xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual,                       GLboolean backBuffer);extern voidxmesa_delete_framebuffer(struct gl_framebuffer *fb);extern XMesaBufferxmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis);extern unsigned longxmesa_color_to_pixel( GLcontext *ctx,                      GLubyte r, GLubyte g, GLubyte b, GLubyte a,                      GLuint pixelFormat );extern voidxmesa_get_window_size(XMesaDisplay *dpy, XMesaBuffer b,                      GLuint *width, GLuint *height);extern voidxmesa_check_and_update_buffer_size(XMesaContext xmctx, XMesaBuffer drawBuffer);extern voidxmesa_init_driver_functions( XMesaVisual xmvisual,                             struct dd_function_table *driver );extern voidxmesa_update_state( GLcontext *ctx, GLbitfield new_state );extern voidxmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb,                             enum pixel_format pixelformat, GLint depth);extern voidxmesa_destroy_buffers_on_display(XMesaDisplay *dpy);/** * Using a function instead of an ordinary cast is safer. */static INLINE struct xmesa_renderbuffer *xmesa_renderbuffer(struct gl_renderbuffer *rb){   return (struct xmesa_renderbuffer *) rb;}/** * Return pointer to XMesaContext corresponding to a Mesa GLcontext. * Since we're using structure containment, it's just a cast!. */static INLINE XMesaContextXMESA_CONTEXT(GLcontext *ctx){   return (XMesaContext) ctx;}/** * Return pointer to XMesaBuffer corresponding to a Mesa GLframebuffer. * Since we're using structure containment, it's just a cast!. */static INLINE XMesaBufferXMESA_BUFFER(GLframebuffer *b){   return (XMesaBuffer) b;}/* Plugged into the software rasterizer.  Try to use internal * swrast-style point, line and triangle functions. */extern void xmesa_choose_point( GLcontext *ctx );extern void xmesa_choose_line( GLcontext *ctx );extern void xmesa_choose_triangle( GLcontext *ctx );extern void xmesa_register_swrast_functions( GLcontext *ctx );#define ENABLE_EXT_texure_compression_s3tc 0 /* SW texture compression */#ifdef XFree86Server#define ENABLE_EXT_timer_query 0#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L#define ENABLE_EXT_timer_query 1 /* should have 64-bit GLuint64EXT */#else#define ENABLE_EXT_timer_query 0 /* may not have 64-bit GLuint64EXT */#endif#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -