Revision 79acfb0e libavcodec/imgconvert.c

View differences:

libavcodec/imgconvert.c
2256 2256
            int pix_fmt, int padtop, int padbottom, int padleft, int padright,
2257 2257
            int *color)
2258 2258
{
2259
    uint8_t *optr, *iptr;
2259
    uint8_t *optr;
2260 2260
    int y_shift;
2261 2261
    int x_shift;
2262 2262
    int yheight;
......
2274 2274
                dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
2275 2275
        }
2276 2276

  
2277
        if (padleft || padright || src) {
2278
            if (src) { /* first line */
2279
                iptr = src->data[i];
2280
                optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
2281
                        (padleft >> x_shift);
2282
                memcpy(optr, iptr, src->linesize[i]);
2283
                iptr += src->linesize[i];
2277
        if (padleft || padright) {
2278
            optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
2279
                (dst->linesize[i] - (padright >> x_shift));
2280
            yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
2281
            for (y = 0; y < yheight; y++) {
2282
                memset(optr, color[i], (padleft + padright) >> x_shift);
2283
                optr += dst->linesize[i];
2284 2284
            }
2285
        }
2286

  
2287
        if (src) { /* first line */
2288
            uint8_t *iptr = src->data[i];
2289
            optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
2290
                    (padleft >> x_shift);
2291
            memcpy(optr, iptr, src->linesize[i]);
2292
            iptr += src->linesize[i];
2285 2293
            optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
2286 2294
                (dst->linesize[i] - (padright >> x_shift));
2287 2295
            yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
2288 2296
            for (y = 0; y < yheight; y++) {
2289 2297
                memset(optr, color[i], (padleft + padright) >> x_shift);
2290
                if (src) {
2291
                    memcpy(optr + ((padleft + padright) >> x_shift), iptr,
2292
                        src->linesize[i]);
2293
                    iptr += src->linesize[i];
2294
                }
2298
                memcpy(optr + ((padleft + padright) >> x_shift), iptr,
2299
                    src->linesize[i]);
2300
                iptr += src->linesize[i];
2295 2301
                optr += dst->linesize[i];
2296 2302
            }
2297 2303
        }

Also available in: Unified diff