diff options
author | Uoti Urpala <uau@mplayer2.org> | 2012-08-26 19:00:26 +0300 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-09-18 21:04:46 +0200 |
commit | 62ccf6c5cccdf1a34a4b85f91615f0f8305b5279 (patch) | |
tree | 4d00b3cc83fde735c26992d83bae9fe6159b8259 /libvo/bitmap_packer.h | |
parent | 6a5f00b875131b99ce7a771f23d608b3f0866d70 (diff) | |
download | mpv-62ccf6c5cccdf1a34a4b85f91615f0f8305b5279.tar.bz2 mpv-62ccf6c5cccdf1a34a4b85f91615f0f8305b5279.tar.xz |
vo_vdpau: split bitmap packing code into a separate file
Split the vo_vdpau code that calculates how to pack all subtitle
bitmaps into a larger surface into a separate file. This will allow
using it in other VOs.
Conflicts:
Makefile
libvo/vo_vdpau.c
Note: this commit does the same as an earlier commit by me
(4010dd0b1a27e3996). My commit added the vo_vdpau packer code as
eosd_packer.c, while this commit by uau uses bitmap_packer.c. Since
bitmap_packer.c has a different interface, and because there are more
commits changing OSD rendering coming, I will pick uau's version.
However, vo_gl, vo_gl3 and vo_direct3d are still using eosd_packer.c,
so to make the transition easier, don't delete eosd_packer.c yet.
Diffstat (limited to 'libvo/bitmap_packer.h')
-rw-r--r-- | libvo/bitmap_packer.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/libvo/bitmap_packer.h b/libvo/bitmap_packer.h new file mode 100644 index 0000000000..45b6fbc4ae --- /dev/null +++ b/libvo/bitmap_packer.h @@ -0,0 +1,47 @@ +#ifndef MPLAYER_PACK_RECTANGLES_H +#define MPLAYER_PACK_RECTANGLES_H + +struct pos { + int x; + int y; +}; + +struct bitmap_packer { + int w; + int h; + int w_max; + int h_max; + int count; + struct pos *in; + struct pos *result; + + // internal + int *scratch; + int asize; +}; + +struct ass_image; + +/* Reallocate packer->in for at least to desired number of items. + * Also sets packer->count to the same value. + */ +void packer_set_size(struct bitmap_packer *packer, int size); + +/* To use this, set packer->count to number of rectangles, w_max and h_max + * to maximum output rectangle size, and w and h to start size (may be 0). + * Write input sizes in packer->in. + * Resulting packing will be written in packer->result. + * w and h will be increased if necessary for successful packing. + * Return value is -1 if packing failed because w and h were set to max + * values but that wasn't enough, 1 if w or h was increased, and 0 otherwise. + */ +int packer_pack(struct bitmap_packer *packer); + +/* Like above, but packer->count will be automatically set and + * packer->in will be reallocated if needed and filled from the + * given image list. + */ +int packer_pack_from_assimg(struct bitmap_packer *packer, + struct ass_image *imglist); + +#endif |