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

📄 mgmesa.c

📁 mesa-6.5-minigui源码
💻 C
📖 第 1 页 / 共 3 页
字号:
        for (i=0; i<n; i++)            SetPixelRGB (pwc->dc, x+i, y,                             rgba[i][RCOMP],                             rgba[i][GCOMP],                             rgba[i][BCOMP]);    }    }/* Write a horizontal span of RGB color pixels with a boolean mask. */static void write_rgb_span_front(const GLcontext *ctx,                   struct gl_renderbuffer *rb,                   GLuint n, GLint x, GLint y,                  const GLubyte rgb[][3],                   const GLubyte mask[] ){    mgMesaContext pwc = mgmesa_context(ctx);    GLuint i;        (void) ctx;    y = FLIP(y);    if (mask) {        for (i=0; i<n; i++)            if (mask[i])            SetPixelRGB (pwc->dc, x+i, y,                             rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]);    }    else {        for (i=0; i<n; i++)            SetPixelRGB (pwc->dc, x+i, y,                             rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]);    }    }/* * Write a horizontal span of pixels with a boolean mask.  The current color * is used for all pixels. */static void write_mono_rgba_span_front(const GLcontext *ctx,                     struct gl_renderbuffer *rb,                    GLuint n, GLint x, GLint y,                    const GLchan color[4],                     const GLubyte mask[]){    GLuint i;    mgMesaContext pwc = mgmesa_context(ctx);    RGB rgb;    (void) ctx;    rgb.r = color[RCOMP];    rgb.g = color[GCOMP];    rgb.b = color[BCOMP];    y = FLIP(y);    if (mask) {        for (i=0; i<n; i++)            if (mask[i])                SetPixelRGB (pwc->dc, x+i, y,                                 color[RCOMP], color[GCOMP], color[BCOMP]);    }    else        for (i=0; i<n; i++)            SetPixelRGB (pwc->dc, x+i, y,                             color[RCOMP], color[GCOMP], color[BCOMP]);}/* Write an array of RGBA pixels with a boolean mask. */static void write_rgba_pixels_front (const GLcontext *ctx,                      struct gl_renderbuffer *rb,                     GLuint n,                      const GLint x[], const GLint y[],                     const GLubyte rgba[][4],                      const GLubyte mask[] ){    GLuint i;    mgMesaContext pwc = mgmesa_context(ctx);    (void) ctx;    for (i=0; i<n; i++)        if (mask[i])            SetPixelRGB (pwc->dc, x[i], FLIP(y[i]),                             rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);}/* * Write an array of pixels with a boolean mask.  The current color * is used for all pixels. */static void write_mono_rgba_pixels_front(const GLcontext *ctx,                       struct gl_renderbuffer *rb,                      GLuint n,                      const GLint x[], const GLint y[],                      const GLchan color[4],                      const GLubyte mask[] ){    GLuint i;    mgMesaContext pwc = mgmesa_context(ctx);    RGB rgb;    (void) ctx;    for (i=0; i<n; i++)        if (mask[i])            SetPixelRGB (pwc->dc, x[i], FLIP(y[i]),                             color[RCOMP], color[GCOMP], color[BCOMP]);}/* Read a horizontal span of color pixels. */static void read_rgba_span_front(const GLcontext *ctx,                   struct gl_renderbuffer *rb,                  GLuint n, GLint x, GLint y,                  GLubyte rgba[][4] ){    mgMesaContext pwc = mgmesa_context(ctx);    GLuint i;    y = FLIP(y);    for (i=0; i<n; i++) {        GetPixelRGB (pwc->dc, x+i, y, &rgba[i][RCOMP],                        &rgba[i][GCOMP],                        &rgba[i][BCOMP]);        rgba[i][ACOMP] = 255;    }}/* Read an array of color pixels. */static void read_rgba_pixels_front(const GLcontext *ctx,                     struct gl_renderbuffer *rb,                    GLuint n, const GLint x[], const GLint y[],                    GLubyte rgba[][4]){    mgMesaContext pwc = mgmesa_context(ctx);    GLuint i;    for (i=0; i<n; i++) {        GLint y2 = FLIP(y[i]);        GetPixelRGB (pwc->dc, x[i], y2, &rgba[i][RCOMP],                        &rgba[i][GCOMP], &rgba[i][BCOMP]);        rgba[i][ACOMP] = 255;    }}/*********************************************************************//* DOUBLE BUFFER 32-bit */#define WMSETPIXEL32(pwc, y, x, r, g, b) { \DWORD* lpdw = ((DWORD*)((pwc)->pixels + (pwc)->pitch * (y)) + (x)); \*lpdw = BGR32((r),(g),(b)); }/* Write a horizontal span of RGBA color pixels with a boolean mask. */static void write_rgba_span_32(const GLcontext *ctx,                    struct gl_renderbuffer *rb,                    GLuint n, GLint x, GLint y,                   const GLubyte rgba[][4],                    const GLubyte mask[] ){    mgMesaContext pwc = mgmesa_context(ctx);    mgMesaFramebuffer pwfb = mgmesa_framebuffer(ctx->DrawBuffer);    GLuint i;    DWORD* lpdw;    (void) ctx;        y = FLIP(y);    lpdw = ((DWORD*)(pwfb->pixels + pwfb->pitch * y)) + x;    if (mask) {        for (i=0; i<n; i++)            if (mask[i])                lpdw[i] = BGR32(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);    }    else {        for (i=0; i<n; i++)            *lpdw++ = BGR32(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);    }}/* Write a horizontal span of RGB color pixels with a boolean mask. */static void write_rgb_span_32(const GLcontext *ctx,                   struct gl_renderbuffer *rb,                   GLuint n, GLint x, GLint y,                  const GLubyte rgb[][3],                   const GLubyte mask[] ){    mgMesaContext pwc = mgmesa_context(ctx);    mgMesaFramebuffer pwfb = mgmesa_framebuffer(ctx->DrawBuffer);    GLuint i;    DWORD* lpdw;    (void) ctx;        y=FLIP(y);    lpdw = ((DWORD*)(pwfb->pixels + pwfb->pitch * y)) + x;    if (mask) {        for (i=0; i<n; i++)            if (mask[i])                lpdw[i] = BGR32(rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]);    }    else {        for (i=0; i<n; i++)            *lpdw++ = BGR32(rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]);    }}/* * Write a horizontal span of pixels with a boolean mask.  The current color * is used for all pixels. */static void write_mono_rgba_span_32(const GLcontext *ctx,                     struct gl_renderbuffer *rb,                    GLuint n, GLint x, GLint y,                    const GLchan color[4],                     const GLubyte mask[]){    DWORD* lpdw;    DWORD pixel;    GLuint i;    mgMesaContext pwc = mgmesa_context(ctx);    mgMesaFramebuffer pwfb = mgmesa_framebuffer(ctx->DrawBuffer);    lpdw = ((DWORD*)(pwfb->pixels + pwfb->pitch * y)) + x;    y=FLIP(y);    pixel = BGR32(color[RCOMP], color[GCOMP], color[BCOMP]);    if (mask) {        for (i=0; i<n; i++)            if (mask[i])                lpdw[i] = pixel;    }    else        for (i=0; i<n; i++)            *lpdw++ = pixel;}/* Write an array of RGBA pixels with a boolean mask. */static void write_rgba_pixels_32(const GLcontext *ctx,                  struct gl_renderbuffer *rb,                 GLuint n, const GLint x[], const GLint y[],                 const GLubyte rgba[][4],                  const GLubyte mask[]){    GLuint i;    mgMesaContext pwc = mgmesa_context(ctx);    mgMesaFramebuffer pwfb = mgmesa_framebuffer(ctx->DrawBuffer);    for (i=0; i<n; i++)        if (mask[i])            WMSETPIXEL32(pwfb, FLIP(y[i]), x[i],                rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);}/* * Write an array of pixels with a boolean mask.  The current color * is used for all pixels. */static void write_mono_rgba_pixels_32(const GLcontext *ctx,                       struct gl_renderbuffer *rb,                      GLuint n,                      const GLint x[], const GLint y[],                      const GLchan color[4],                      const GLubyte mask[]){    GLuint i;    mgMesaContext pwc = mgmesa_context(ctx);    mgMesaFramebuffer pwfb = mgmesa_framebuffer(ctx->DrawBuffer);    for (i=0; i<n; i++)        if (mask[i])            WMSETPIXEL32(pwfb, FLIP(y[i]),x[i],color[RCOMP],                color[GCOMP], color[BCOMP]);}/* Read a horizontal span of color pixels. */static void read_rgba_span_32(const GLcontext *ctx,                   struct gl_renderbuffer *rb,                  GLuint n, GLint x, GLint y,                  GLubyte rgba[][4] ){    GLuint i;    DWORD pixel;    DWORD* lpdw;    mgMesaContext pwc = mgmesa_context(ctx);    mgMesaFramebuffer pwfb = mgmesa_framebuffer(ctx->DrawBuffer);        y = FLIP(y);    lpdw = ((DWORD*)(pwfb->pixels + pwfb->pitch * y)) + x;    for (i=0; i<n; i++) {        pixel = lpdw[i];        rgba[i][RCOMP] = (pixel & 0x00ff0000) >> 16;        rgba[i][GCOMP] = (pixel & 0x0000ff00) >> 8;        rgba[i][BCOMP] = (pixel & 0x000000ff);        rgba[i][ACOMP] = 255;    }}/* Read an array of color pixels. */static void read_rgba_pixels_32(const GLcontext *ctx,                 struct gl_renderbuffer *rb,                GLuint n, const GLint x[], const GLint y[],                GLubyte rgba[][4]){    GLuint i;    DWORD pixel;    DWORD* lpdw;    mgMesaContext pwc = mgmesa_context(ctx);    mgMesaFramebuffer pwfb = mgmesa_framebuffer(ctx->DrawBuffer);    for (i=0; i<n; i++) {        GLint y2 = FLIP(y[i]);        lpdw = ((DWORD*)(pwfb->pixels + pwfb->pitch * y2)) + x[i];        pixel = lpdw[i];        rgba[i][RCOMP] = (pixel & 0x00ff0000) >> 16;        rgba[i][GCOMP] = (pixel & 0x0000ff00) >> 8;        rgba[i][BCOMP] = (pixel & 0x000000ff);        rgba[i][ACOMP] = 255;  }}/*********************************************************************//* DOUBLE BUFFER 16-bit */#define WMSETPIXEL16(pwc, y, x, r, g, b) { \WORD* lpw = ((WORD*)((pwc)->pixels + (pwc)->pitch * (y)) + (x)); \*lpw = BGR16((r),(g),(b)); }/* Write a horizontal span of RGBA color pixels with a boolean mask. */static void write_rgba_span_16(const GLcontext *ctx,                    struct gl_renderbuffer *rb,                    GLuint n, GLint x, GLint y,                   const GLubyte rgba[][4],                    const GLubyte mask[] ){    mgMesaContext pwc = mgmesa_context(ctx);    mgMesaFramebuffer pwfb = mgmesa_framebuffer(ctx->DrawBuffer);    GLuint i;    WORD* lpw;    (void) ctx;        y=FLIP(y);    lpw = ((WORD*)(pwfb->pixels + pwfb->pitch * y)) + x;    if (mask) {        for (i=0; i<n; i++)            if (mask[i])                lpw[i] = BGR16(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);    }    else {        for (i=0; i<n; i++)            *lpw++ = BGR16(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);    }}/* Write a horizontal span of RGB color pixels with a boolean mask. */static void write_rgb_span_16(const GLcontext *ctx,                   struct gl_renderbuffer *rb,                   GLuint n, GLint x, GLint y,                  const GLubyte rgb[][3],                   const GLubyte mask[] ){    mgMesaContext pwc = mgmesa_context(ctx);    mgMesaFramebuffer pwfb = mgmesa_framebuffer(ctx->DrawBuffer);    GLuint i;    WORD* lpw;    (void) ctx;        y=FLIP(y);    lpw = ((WORD*)(pwfb->pixels + pwfb->pitch * y)) + x;    if (mask) {        for (i=0; i<n; i++)            if (mask[i])                lpw[i] = BGR16(rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]);    }    else {        for (i=0; i<n; i++)                *lpw++ = BGR16(rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]);    }}/* * Write a horizontal span of pixels with a boolean mask.  The current color * is used for all pixels. */static void write_mono_rgba_span_16(const GLcontext *ctx,                     struct gl_renderbuffer *rb,                    GLuint n, GLint x, GLint y,                    const GLchan color[4],                     const GLubyte mask[]){    WORD* lpw;    WORD pixel;    GLuint i;    mgMesaContext pwc = mgmesa_context(ctx);    mgMesaFramebuffer pwfb = mgmesa_framebuffer(ctx->DrawBuffer);    (void) ctx;    lpw = ((WORD*)(pwfb->pixels + pwfb->pitch * y)) + x;    y=FLIP(y);    pixel = BGR16(color[RCOMP], color[GCOMP], color[BCOMP]);    if (mask) {        for (i=0; i<n; i++)            if (mask[i])                lpw[i] = pixel;    }    else        for (i=0; i<n; i++)            *lpw++ = pixel;}/* Write an array of RGBA pixels with a boolean mask. */static void write_rgba_pixels_16(const GLcontext *ctx,                  struct gl_renderbuffer *rb,                 GLuint n, const GLint x[], const GLint y[],                 const GLubyte rgba[][4],                  const GLubyte mask[]){    GLuint i;    mgMesaContext pwc = mgmesa_context(ctx);    mgMesaFramebuffer pwfb = mgmesa_framebuffer(ctx->DrawBuffer);    (void) ctx;    for (i=0; i<n; i++)        if (mask[i])            WMSETPIXEL16(pwfb, FLIP(y[i]), x[i],                             rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);}/* * Write an array of pixels with a boolean mask.  The current color * is used for all pixels. */static void write_mono_rgba_pixels_16(const GLcontext *ctx,                       struct gl_renderbuffer *rb,                      GLuint n,                      const GLint x[], const GLint y[],                      const GLchan color[4],                      const GLubyte mask[]){    GLuint i;    mgMesaContext pwc = mgmesa_context(ctx);    mgMesaFramebuffer pwfb = mgmesa_framebuffer(ctx->DrawBuffer);    (void) ctx;    for (i=0; i<n; i++)        if (mask[i])            WMSETPIXEL16 (pwfb, FLIP(y[i]), x[i],                            color[RCOMP], color[GCOMP], color[BCOMP]);}/* Read a horizontal span of color pixels. */static void read_rgba_span_16(const GLcontext *ctx, 

⌨️ 快捷键说明

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