Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
First pass (untested) at RenderWritePixels()
  • Loading branch information
slouken committed Nov 18, 2009
1 parent e81d4aa commit 3bbf955
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/video/SDL_glfuncs.h
Expand Up @@ -291,7 +291,7 @@ SDL_PROC_UNUSED(void, glRasterPos2d, (GLdouble x, GLdouble y))
SDL_PROC_UNUSED(void, glRasterPos2dv, (const GLdouble * v))
SDL_PROC_UNUSED(void, glRasterPos2f, (GLfloat x, GLfloat y))
SDL_PROC_UNUSED(void, glRasterPos2fv, (const GLfloat * v))
SDL_PROC_UNUSED(void, glRasterPos2i, (GLint x, GLint y))
SDL_PROC(void, glRasterPos2i, (GLint x, GLint y))
SDL_PROC_UNUSED(void, glRasterPos2iv, (const GLint * v))
SDL_PROC_UNUSED(void, glRasterPos2s, (GLshort x, GLshort y))
SDL_PROC_UNUSED(void, glRasterPos2sv, (const GLshort * v))
Expand Down
10 changes: 5 additions & 5 deletions src/video/SDL_renderer_gl.c
Expand Up @@ -1273,9 +1273,9 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
} else if (pixel_format == SDL_PIXELFORMAT_INDEX1MSB) {
data->glPixelStorei(GL_PACK_LSB_FIRST, 0);
}
//data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
//data->glPixelStorei(GL_PACK_ROW_LENGTH,
// (pitch / bytes_per_pixel(pixel_format)));
data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
data->glPixelStorei(GL_PACK_ROW_LENGTH,
(pitch / bytes_per_pixel(pixel_format)));
data->glReadBuffer(GL_FRONT);

memset(pixels, 0xff, rect->h*pitch);
Expand Down Expand Up @@ -1325,8 +1325,8 @@ GL_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect,
data->glPixelStorei(GL_UNPACK_ROW_LENGTH,
(pitch / bytes_per_pixel(pixel_format)));

data->glReadPixels(rect->x, rect->y+rect->h-1, rect->w, rect->h,
format, type, pixels);
data->glRasterPos2i(rect->x, rect->y);
data->glDrawPixels(rect->w, rect->h, format, type, pixels);

return 0;
}
Expand Down

0 comments on commit 3bbf955

Please sign in to comment.