diff options
author | wm4 <wm4@nowhere> | 2015-01-22 17:37:40 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-22 17:37:40 +0100 |
commit | e9ac3fc3a1505c4db1773a2a24d35ac41ab69887 (patch) | |
tree | 2d394ce71467916ec7850e9705639123bd054c7f /video | |
parent | aae9af348e62d5feba6547855003df0d954cb3ae (diff) | |
download | mpv-e9ac3fc3a1505c4db1773a2a24d35ac41ab69887.tar.bz2 mpv-e9ac3fc3a1505c4db1773a2a24d35ac41ab69887.tar.xz |
mp_image_pool: allow passing pool=NULL in more places
It's convenient.
Diffstat (limited to 'video')
-rw-r--r-- | video/mp_image_pool.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/video/mp_image_pool.c b/video/mp_image_pool.c index 62d55cc372..17c2526b6f 100644 --- a/video/mp_image_pool.c +++ b/video/mp_image_pool.c @@ -146,11 +146,14 @@ struct mp_image *mp_image_pool_get_no_alloc(struct mp_image_pool *pool, int fmt, // Return a new image of given format/size. The only difference to // mp_image_alloc() is that there is a transparent mechanism to recycle image // data allocations through this pool. +// If pool==NULL, mp_image_alloc() is called (for convenience). // The image can be free'd with talloc_free(). // Returns NULL on OOM. struct mp_image *mp_image_pool_get(struct mp_image_pool *pool, int fmt, int w, int h) { + if (!pool) + return mp_image_alloc(fmt, w, h); struct mp_image *new = mp_image_pool_get_no_alloc(pool, fmt, w, h); if (!new) { if (pool->num_images >= pool->max_count) @@ -172,6 +175,7 @@ struct mp_image *mp_image_pool_get(struct mp_image_pool *pool, int fmt, } // Like mp_image_new_copy(), but allocate the image out of the pool. +// If pool==NULL, a plain copy is made (for convenience). // Returns NULL on OOM. struct mp_image *mp_image_pool_new_copy(struct mp_image_pool *pool, struct mp_image *img) @@ -193,8 +197,6 @@ bool mp_image_pool_make_writeable(struct mp_image_pool *pool, { if (mp_image_is_writeable(img)) return true; - if (!pool) - return mp_image_make_writeable(img); struct mp_image *new = mp_image_pool_new_copy(pool, img); if (!new) return false; |