This allows us to eventually make g3d states opaque.
struct st_framebuffer *stfb = ctx->draw_buffer;
struct st_renderbuffer *strb = stfb->strb;
- struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
VGfloat temp[VEGA_MAX_IMAGE_WIDTH][4];
VGfloat *df = (VGfloat*)temp;
sy = 0;
}
- if (sx + width > fb->width || sy + height > fb->height) {
- width = fb->width - sx;
- height = fb->height - sy;
+ if (sx + width > stfb->width || sy + height > stfb->height) {
+ width = stfb->width - sx;
+ height = stfb->height - sy;
/* nothing to read */
if (width <= 0 || height <= 0)
return;
}
{
- VGint y = (fb->height - sy) - 1, yStep = -1;
+ VGint y = (stfb->height - sy) - 1, yStep = -1;
struct pipe_transfer *transfer;
transfer = pipe_get_transfer(pipe, strb->texture, 0, 0, 0,
PIPE_TRANSFER_READ,
- 0, 0, sx + width, fb->height - sy);
+ 0, 0, sx + width, stfb->height - sy);
/* Do a row at a time to flip image data vertically */
for (i = 0; i < height; i++) {
VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
- struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
- struct st_renderbuffer *strb = ctx->draw_buffer->strb;
+ struct st_framebuffer *stfb = ctx->draw_buffer;
+ struct st_renderbuffer *strb = stfb->strb;
if (width <= 0 || height <= 0) {
vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
}
/* do nothing if we copy from outside the fb */
- if (dx >= (VGint)fb->width || dy >= (VGint)fb->height ||
- sx >= (VGint)fb->width || sy >= (VGint)fb->height)
+ if (dx >= (VGint)stfb->width || dy >= (VGint)stfb->height ||
+ sx >= (VGint)stfb->width || sy >= (VGint)stfb->height)
return;
vg_validate_state(ctx);
VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
- struct pipe_framebuffer_state *fb;
+ struct st_framebuffer *stfb = ctx->draw_buffer;
if (width <= 0 || height <= 0) {
vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
ctx->state.vg.clear_color[3]);
#endif
- fb = &ctx->state.g3d.fb;
/* check for a whole surface clear */
if (!ctx->state.vg.scissoring &&
- (x == 0 && y == 0 && width == fb->width && height == fb->height)) {
+ (x == 0 && y == 0 && width == stfb->width && height == stfb->height)) {
ctx->pipe->clear(ctx->pipe, PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL,
ctx->state.vg.clear_color, 1., 0);
} else if (renderer_clear_begin(ctx->renderer)) {
struct st_framebuffer *stfb = ctx->draw_buffer;
struct st_renderbuffer *strb = stfb->alpha_mask;
- struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
VGfloat temp[VEGA_MAX_IMAGE_WIDTH][4];
VGfloat *df = (VGfloat*)temp;
- VGint y = (fb->height - sy) - 1, yStep = -1;
+ VGint y = (stfb->height - sy) - 1, yStep = -1;
VGint i;
VGubyte *dst = (VGubyte *)data;
VGint xoffset = 0, yoffset = 0;
yoffset = -sy;
height += sy;
sy = 0;
- y = (fb->height - sy) - 1;
+ y = (stfb->height - sy) - 1;
yoffset *= dataStride;
}
void save_alpha_to_file(const char *filename)
{
struct vg_context *ctx = vg_current_context();
- struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
+ struct st_framebuffer *stfb = ctx->draw_buffer;
VGint *data;
int i, j;
- data = malloc(sizeof(int) * fb->width * fb->height);
- read_alpha_mask(data, fb->width * sizeof(int),
+ data = malloc(sizeof(int) * stfb->width * stfb->height);
+ read_alpha_mask(data, stfb->width * sizeof(int),
VG_sRGBA_8888,
- 0, 0, fb->width, fb->height);
+ 0, 0, stfb->width, stfb->height);
fprintf(stderr, "/*---------- start */\n");
fprintf(stderr, "const int image_width = %d;\n",
- fb->width);
+ stfb->width);
fprintf(stderr, "const int image_height = %d;\n",
- fb->height);
+ stfb->height);
fprintf(stderr, "const int image_data = {\n");
- for (i = 0; i < fb->height; ++i) {
- for (j = 0; j < fb->width; ++j) {
- int rgba = data[i * fb->height + j];
+ for (i = 0; i < stfb->height; ++i) {
+ for (j = 0; j < stfb->width; ++j) {
+ int rgba = data[i * stfb->height + j];
int argb = 0;
argb = (rgba >> 8);
argb |= ((rgba & 0xff) << 24);
void vg_set_viewport(struct vg_context *ctx, VegaOrientation orientation)
{
+ struct st_framebuffer *stfb = ctx->draw_buffer;
struct pipe_viewport_state viewport;
- struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
VGfloat y_scale = (orientation == VEGA_Y0_BOTTOM) ? -2.f : 2.f;
- viewport.scale[0] = fb->width / 2.f;
- viewport.scale[1] = fb->height / y_scale;
+ viewport.scale[0] = stfb->width / 2.f;
+ viewport.scale[1] = stfb->height / y_scale;
viewport.scale[2] = 1.0;
viewport.scale[3] = 1.0;
- viewport.translate[0] = fb->width / 2.f;
- viewport.translate[1] = fb->height / 2.f;
+ viewport.translate[0] = stfb->width / 2.f;
+ viewport.translate[1] = stfb->height / 2.f;
viewport.translate[2] = 0.0;
viewport.translate[3] = 0.0;