79 switch (bpp * 2 + be) {
82 return bytestream2_get_byte(gb);
84 return bytestream2_get_le16(gb);
86 return bytestream2_get_be16(gb);
88 return bytestream2_get_le32(gb);
90 return bytestream2_get_be32(gb);
98 const int bpp = c->
bpp2;
100 uint16_t *dst16 = (uint16_t *)c->
curbits;
101 uint32_t *dst32 = (uint32_t *)c->
curbits;
103 for (j = 0; j < c->
cur_h; j++) {
104 for (i = 0; i < c->
cur_w; i++) {
117 for (j = 0; j < c->
cur_h; j++) {
118 for (i = 0; i < c->
cur_w; i++) {
151 if ((w < 1) || (h < 1))
157 for (j = 0; j < h; j++) {
158 for (i = 0; i < w; i++)
159 dst[i] = (dst[i] & cd[i]) ^ msk[i];
164 }
else if (c->
bpp2 == 2) {
165 uint16_t *cd = (uint16_t*)c->
curbits, *msk = (uint16_t*)c->
curmask;
167 for (j = 0; j < h; j++) {
168 dst2 = (uint16_t*)dst;
169 for (i = 0; i < w; i++)
170 dst2[i] = (dst2[i] & cd[i]) ^ msk[i];
175 }
else if (c->
bpp2 == 4) {
176 uint32_t *cd = (uint32_t*)c->
curbits, *msk = (uint32_t*)c->
curmask;
178 for (j = 0; j < h; j++) {
179 dst2 = (uint32_t*)dst;
180 for (i = 0; i < w; i++)
181 dst2[i] = (dst2[i] & cd[i]) ^ msk[i];
191 int w,
int h,
int color,
195 dst += dx * bpp + dy *
stride;
197 for (j = 0; j < h; j++) {
198 memset(dst, color, w);
201 }
else if (bpp == 2) {
203 for (j = 0; j < h; j++) {
204 dst2 = (uint16_t*)dst;
205 for (i = 0; i < w; i++)
209 }
else if (bpp == 4) {
211 for (j = 0; j < h; j++) {
212 dst2 = (uint32_t*)dst;
213 for (i = 0; i < w; i++)
225 for (j = 0; j < h; j++) {
226 for (i = 0; i < w; i++) {
233 ((uint16_t*)dst)[i] = p;
236 ((uint32_t*)dst)[i] = p;
248 int bg = 0, fg = 0, rects,
color,
flags, xy, wh;
249 const int bpp = c->
bpp2;
251 int bw = 16, bh = 16;
253 for (j = 0; j < h; j += 16) {
258 for (i = 0; i < w; i += 16, dst2 += 16 * bpp) {
265 flags = bytestream2_get_byte(gb);
279 rects = bytestream2_get_byte(gb);
280 color = !!(flags &
HT_CLR);
282 paint_rect(dst2, 0, 0, bw, bh, bg, bpp, stride);
288 for (k = 0; k < rects; k++) {
291 xy = bytestream2_get_byte(gb);
292 wh = bytestream2_get_byte(gb);
294 (wh>>4)+1, (wh & 0xF)+1, fg, bpp, stride);
315 int buf_size = avpkt->
size;
319 int dx, dy, w, h, depth, enc, chunks, res, size_left;
352 if ((w > 0) && (h > 0)) {
354 for (i = 0; i < h; i++) {
362 chunks = bytestream2_get_be16(gb);
364 dx = bytestream2_get_be16(gb);
365 dy = bytestream2_get_be16(gb);
366 w = bytestream2_get_be16(gb);
367 h = bytestream2_get_be16(gb);
368 enc = bytestream2_get_be32(gb);
373 if (size_left < 2 + w * h * c->bpp2 * 2) {
375 "Premature end of data! (need %i got %i)\n",
376 2 + w * h * c->
bpp2 * 2, size_left);
386 "Cursor hot spot is not in image: "
387 "%ix%i of %ix%i cursor size\n",
400 return screen_size ?
AVERROR(ENOMEM) : 0;
421 depth = bytestream2_get_byte(gb);
422 if (depth != c->
bpp) {
424 "Depth mismatch. Container %i bpp, "
425 "Frame data: %i bpp\n",
432 "Invalid header: bigendian flag = %i\n", c->
bigendian);
444 "Incorrect frame size: %ix%i+%ix%i of %ix%i\n",
448 if (size_left < w * h * c->bpp2) {
450 "Premature end of data! (need %i got %i)\n",
451 w * h * c->
bpp2, size_left);
460 "Incorrect frame size: %ix%i+%ix%i of %ix%i\n",
492 if ((w > 0) && (h > 0)) {
494 for (i = 0; i < h; i++) {