mirror of https://github.com/mpv-player/mpv
bitmap_packer: remove some unused functions
This commit is contained in:
parent
8523e1fd95
commit
3738bfb451
|
@ -29,8 +29,6 @@
|
||||||
#include "mpv_talloc.h"
|
#include "mpv_talloc.h"
|
||||||
#include "bitmap_packer.h"
|
#include "bitmap_packer.h"
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
#include "sub/dec_sub.h"
|
|
||||||
#include "video/mp_image.h"
|
|
||||||
|
|
||||||
#define IS_POWER_OF_2(x) (((x) > 0) && !(((x) - 1) & (x)))
|
#define IS_POWER_OF_2(x) (((x) > 0) && !(((x) - 1) & (x)))
|
||||||
|
|
||||||
|
@ -199,34 +197,3 @@ void packer_set_size(struct bitmap_packer *packer, int size)
|
||||||
packer->scratch = talloc_array_ptrtype(packer, packer->scratch,
|
packer->scratch = talloc_array_ptrtype(packer, packer->scratch,
|
||||||
packer->asize + 16);
|
packer->asize + 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
int packer_pack_from_subbitmaps(struct bitmap_packer *packer,
|
|
||||||
struct sub_bitmaps *b)
|
|
||||||
{
|
|
||||||
packer->count = 0;
|
|
||||||
if (b->format == SUBBITMAP_EMPTY)
|
|
||||||
return 0;
|
|
||||||
packer_set_size(packer, b->num_parts);
|
|
||||||
for (int i = 0; i < b->num_parts; i++)
|
|
||||||
packer->in[i] = (struct pos){b->parts[i].w, b->parts[i].h};
|
|
||||||
return packer_pack(packer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void packer_copy_subbitmaps(struct bitmap_packer *packer, struct sub_bitmaps *b,
|
|
||||||
void *data, int pixel_stride, int stride)
|
|
||||||
{
|
|
||||||
assert(packer->count == b->num_parts);
|
|
||||||
if (packer->padding) {
|
|
||||||
struct pos bb[2];
|
|
||||||
packer_get_bb(packer, bb);
|
|
||||||
memset_pic(data, 0, bb[1].x * pixel_stride, bb[1].y, stride);
|
|
||||||
}
|
|
||||||
for (int n = 0; n < packer->count; n++) {
|
|
||||||
struct sub_bitmap *s = &b->parts[n];
|
|
||||||
struct pos p = packer->result[n];
|
|
||||||
|
|
||||||
void *pdata = (uint8_t *)data + p.y * stride + p.x * pixel_stride;
|
|
||||||
memcpy_pic(pdata, s->bitmap, s->w * pixel_stride, s->h,
|
|
||||||
stride, s->stride);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -48,20 +48,4 @@ void packer_set_size(struct bitmap_packer *packer, int size);
|
||||||
*/
|
*/
|
||||||
int packer_pack(struct bitmap_packer *packer);
|
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_subbitmaps(struct bitmap_packer *packer,
|
|
||||||
struct sub_bitmaps *b);
|
|
||||||
|
|
||||||
// Copy the (already packed) sub-bitmaps from b to the image in data.
|
|
||||||
// data must point to an image that is at least (packer->w, packer->h) big.
|
|
||||||
// The image has the given stride (bytes between (x, y) to (x, y + 1)), and the
|
|
||||||
// pixel format used by both the sub-bitmaps and the image uses pixel_stride
|
|
||||||
// bytes per pixel (bytes between (x, y) to (x + 1, y)).
|
|
||||||
// If packer->padding is set, the padding borders are cleared with 0.
|
|
||||||
void packer_copy_subbitmaps(struct bitmap_packer *packer, struct sub_bitmaps *b,
|
|
||||||
void *data, int pixel_stride, int stride);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue