diff options
author | wm4 <wm4@nowhere> | 2015-01-22 18:29:37 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-22 18:31:10 +0100 |
commit | 5bb24980ae3a111cb7b905631c3fc7e79ca84ccc (patch) | |
tree | c953ad84e692cb86b8e0e21fe793847c46a6a37a /video/out/gl_common.c | |
parent | 16cc429eb8ba74da9a774186e25b171e416d99a6 (diff) | |
download | mpv-5bb24980ae3a111cb7b905631c3fc7e79ca84ccc.tar.bz2 mpv-5bb24980ae3a111cb7b905631c3fc7e79ca84ccc.tar.xz |
vo_opengl: simplify screenshot code
Instead of reading back the image from textures, keep a reference to the
original image, and return that.
The main reason this was done this way was that originally, images
weren't refcounted, and would be deallocated or overwritten as soon as
the VO's draw call returned. But now there isn't really a good reason
for this anymore. One possibly _could_ argue that it was better because
other code could reuse the image sooner (e.g. for the cache), but on the
other hand, the VO runs already on a different thread, and filtering and
decoding each run on other threads too, so this argument probably
wouldn't hold up.
Diffstat (limited to 'video/out/gl_common.c')
-rw-r--r-- | video/out/gl_common.c | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/video/out/gl_common.c b/video/out/gl_common.c index 9384bc9e18..8bb570684a 100644 --- a/video/out/gl_common.c +++ b/video/out/gl_common.c @@ -211,7 +211,6 @@ static const struct gl_functions gl_functions[] = { MPGL_CAP_1ST_CLASS_ARRAYS, .functions = (const struct gl_function[]) { DEF_FN(DrawBuffer), - DEF_FN(GetTexImage), DEF_FN(GetTexLevelParameteriv), DEF_FN(MapBuffer), DEF_FN(ReadBuffer), @@ -705,29 +704,6 @@ void glClearTex(GL *gl, GLenum target, GLenum format, GLenum type, } } -/** - * \brief download a texture, handling things like stride and slices - * \param target texture target, usually GL_TEXTURE_2D - * \param format OpenGL format of data - * \param type OpenGL type of data - * \param dataptr destination memory for download - * \param stride data stride (must be positive) - * \ingroup gltexture - */ -void glDownloadTex(GL *gl, GLenum target, GLenum format, GLenum type, - void *dataptr, int stride) -{ - if (!gl->GetTexImage) - abort(); - assert(gl->mpgl_caps & MPGL_CAP_ROW_LENGTH); - // this is not always correct, but should work for MPlayer - gl->PixelStorei(GL_PACK_ALIGNMENT, get_alignment(stride)); - gl->PixelStorei(GL_PACK_ROW_LENGTH, stride / glFmt2bpp(format, type)); - gl->GetTexImage(target, 0, format, type, dataptr); - gl->PixelStorei(GL_PACK_ROW_LENGTH, 0); - gl->PixelStorei(GL_PACK_ALIGNMENT, 4); -} - mp_image_t *glGetWindowScreenshot(GL *gl) { if (gl->es) |