View | Details | Raw Unified | Return to bug 152730
Collapse All | Expand All

(-)fb/fbcompose.c (-43 / +44 lines)
Lines 2887-2893 static void fbFetchTransformed(PicturePt Link Here
2887
    FbBits     *bits;
2887
    FbBits     *bits;
2888
    FbStride    stride;
2888
    FbStride    stride;
2889
    int         bpp;
2889
    int         bpp;
2890
    int         xoff, yoff;
2890
    int         xoff, yoff, dx, dy;
2891
    fetchPixelProc   fetch;
2891
    fetchPixelProc   fetch;
2892
    PictVector	v;
2892
    PictVector	v;
2893
    PictVector  unit;
2893
    PictVector  unit;
Lines 2902-2909 static void fbFetchTransformed(PicturePt Link Here
2902
    x += xoff;
2902
    x += xoff;
2903
    y += yoff;
2903
    y += yoff;
2904
2904
2905
    v.vector[0] = IntToxFixed(x);
2905
    dx = pict->pDrawable->x;
2906
    v.vector[1] = IntToxFixed(y);
2906
    dy = pict->pDrawable->y;
2907
2908
    v.vector[0] = IntToxFixed(x - dx);
2909
    v.vector[1] = IntToxFixed(y - dy);
2907
    v.vector[2] = xFixed1;
2910
    v.vector[2] = xFixed1;
2908
2911
2909
    /* when using convolution filters one might get here without a transform */
2912
    /* when using convolution filters one might get here without a transform */
Lines 2924-2930 static void fbFetchTransformed(PicturePt Link Here
2924
    {
2927
    {
2925
        if (pict->repeatType == RepeatNormal) {
2928
        if (pict->repeatType == RepeatNormal) {
2926
            if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
2929
            if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
2927
                box = pict->pCompositeClip->extents;
2928
                for (i = 0; i < width; ++i) {
2930
                for (i = 0; i < width; ++i) {
2929
                    if (!v.vector[2]) {
2931
                    if (!v.vector[2]) {
2930
                        buffer[i] = 0;
2932
                        buffer[i] = 0;
Lines 2936-2942 static void fbFetchTransformed(PicturePt Link Here
2936
                            y = MOD(v.vector[1]>>16, pict->pDrawable->height);
2938
                            y = MOD(v.vector[1]>>16, pict->pDrawable->height);
2937
                            x = MOD(v.vector[0]>>16, pict->pDrawable->width);
2939
                            x = MOD(v.vector[0]>>16, pict->pDrawable->width);
2938
                        }
2940
                        }
2939
                        buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
2941
                        buffer[i] = fetch(bits + (y + dy)*stride, x + dx, indexed);
2940
                    }
2942
                    }
2941
                    v.vector[0] += unit.vector[0];
2943
                    v.vector[0] += unit.vector[0];
2942
                    v.vector[1] += unit.vector[1];
2944
                    v.vector[1] += unit.vector[1];
Lines 2954-2961 static void fbFetchTransformed(PicturePt Link Here
2954
                            y = MOD(v.vector[1]>>16, pict->pDrawable->height);
2956
                            y = MOD(v.vector[1]>>16, pict->pDrawable->height);
2955
                            x = MOD(v.vector[0]>>16, pict->pDrawable->width);
2957
                            x = MOD(v.vector[0]>>16, pict->pDrawable->width);
2956
                        }
2958
                        }
2957
                        if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box))
2959
                        if (POINT_IN_REGION (0, pict->pCompositeClip, x + dx, y + dy, &box))
2958
                            buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
2960
                            buffer[i] = fetch(bits + (y + dy)*stride, x + dx, indexed);
2959
                        else
2961
                        else
2960
                            buffer[i] = 0;
2962
                            buffer[i] = 0;
2961
                    }
2963
                    }
Lines 2978-2985 static void fbFetchTransformed(PicturePt Link Here
2978
                            y = v.vector[1]>>16;
2980
                            y = v.vector[1]>>16;
2979
                            x = v.vector[0]>>16;
2981
                            x = v.vector[0]>>16;
2980
                        }
2982
                        }
2981
                        buffer[i] = ((x < box.x1) | (x >= box.x2) | (y < box.y1) | (y >= box.y2)) ?
2983
                        buffer[i] = ((x < box.x1-dx) | (x >= box.x2-dx) | (y < box.y1-dy) | (y >= box.y2-dy)) ?
2982
                                    0 : fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
2984
                                    0 : fetch(bits + (y + dy)*stride, x + dx, indexed);
2983
                    }
2985
                    }
2984
                    v.vector[0] += unit.vector[0];
2986
                    v.vector[0] += unit.vector[0];
2985
                    v.vector[1] += unit.vector[1];
2987
                    v.vector[1] += unit.vector[1];
Lines 2997-3004 static void fbFetchTransformed(PicturePt Link Here
2997
                            y = v.vector[1]>>16;
2999
                            y = v.vector[1]>>16;
2998
                            x = v.vector[0]>>16;
3000
                            x = v.vector[0]>>16;
2999
                        }
3001
                        }
3000
                        if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box))
3002
                        if (POINT_IN_REGION (0, pict->pCompositeClip, x + dx, y + dy, &box))
3001
                            buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
3003
                            buffer[i] = fetch(bits + (y + dy)*stride, x + dx, indexed);
3002
                        else
3004
                        else
3003
                            buffer[i] = 0;
3005
                            buffer[i] = 0;
3004
                    }
3006
                    }
Lines 3011-3017 static void fbFetchTransformed(PicturePt Link Here
3011
    } else if (pict->filter == PictFilterBilinear) {
3013
    } else if (pict->filter == PictFilterBilinear) {
3012
        if (pict->repeatType == RepeatNormal) {
3014
        if (pict->repeatType == RepeatNormal) {
3013
            if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
3015
            if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
3014
                box = pict->pCompositeClip->extents;
3015
                for (i = 0; i < width; ++i) {
3016
                for (i = 0; i < width; ++i) {
3016
                    if (!v.vector[2]) {
3017
                    if (!v.vector[2]) {
3017
                        buffer[i] = 0;
3018
                        buffer[i] = 0;
Lines 3046-3058 static void fbFetchTransformed(PicturePt Link Here
3046
                        y1 = MOD (y1, pict->pDrawable->height);
3047
                        y1 = MOD (y1, pict->pDrawable->height);
3047
                        y2 = MOD (y2, pict->pDrawable->height);
3048
                        y2 = MOD (y2, pict->pDrawable->height);
3048
3049
3049
                        b = bits + (y1 + pict->pDrawable->y)*stride;
3050
                        b = bits + (y1 + dy)*stride;
3050
3051
3051
                        tl = fetch(b, x1 + pict->pDrawable->x, indexed);
3052
                        tl = fetch(b, x1 + dx, indexed);
3052
                        tr = fetch(b, x2 + pict->pDrawable->x, indexed);
3053
                        tr = fetch(b, x2 + dx, indexed);
3053
                        b = bits + (y2 + pict->pDrawable->y)*stride;
3054
                        b = bits + (y2 + dy)*stride;
3054
                        bl = fetch(b, x1 + pict->pDrawable->x, indexed);
3055
                        bl = fetch(b, x1 + dx, indexed);
3055
                        br = fetch(b, x2 + pict->pDrawable->x, indexed);
3056
                        br = fetch(b, x2 + dx, indexed);
3056
3057
3057
                        ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
3058
                        ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
3058
                        fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
3059
                        fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
Lines 3107-3123 static void fbFetchTransformed(PicturePt Link Here
3107
                        y1 = MOD (y1, pict->pDrawable->height);
3108
                        y1 = MOD (y1, pict->pDrawable->height);
3108
                        y2 = MOD (y2, pict->pDrawable->height);
3109
                        y2 = MOD (y2, pict->pDrawable->height);
3109
3110
3110
                        b = bits + (y1 + pict->pDrawable->y)*stride;
3111
                        b = bits + (y1 + dy)*stride;
3111
3112
3112
                        tl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y1, &box)
3113
                        tl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y1 + dy, &box)
3113
                             ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0;
3114
                             ? fetch(b, x1 + dx, indexed) : 0;
3114
                        tr = POINT_IN_REGION(0, pict->pCompositeClip, x2, y1, &box)
3115
                        tr = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y1 + dy, &box)
3115
                             ? fetch(b, x2 + pict->pDrawable->x, indexed) : 0;
3116
                             ? fetch(b, x2 + dx, indexed) : 0;
3116
                        b = bits + (y2 + pict->pDrawable->y)*stride;
3117
                        b = bits + (y2 + dy)*stride;
3117
                        bl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y2, &box)
3118
                        bl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y2 + dy, &box)
3118
                             ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0;
3119
                             ? fetch(b, x1 + dx, indexed) : 0;
3119
                        br = POINT_IN_REGION(0, pict->pCompositeClip, x2, y2, &box)
3120
                        br = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y2 + dy, &box)
3120
                             ? fetch(b, x2 + pict->pDrawable->x, indexed) : 0;
3121
                             ? fetch(b, x2 + dx, indexed) : 0;
3121
3122
3122
                        ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
3123
                        ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
3123
                        fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
3124
                        fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
Lines 3171-3183 static void fbFetchTransformed(PicturePt Link Here
3171
                        idistx = 256 - distx;
3172
                        idistx = 256 - distx;
3172
                        idisty = 256 - disty;
3173
                        idisty = 256 - disty;
3173
3174
3174
                        b = bits + (y1 + pict->pDrawable->y)*stride;
3175
                        b = bits + (y1 + dy)*stride;
3175
                        x_off = x1 + pict->pDrawable->x;
3176
                        x_off = x1 + dx;
3176
3177
3177
                        x1_out = (x1 < box.x1) | (x1 >= box.x2);
3178
                        x1_out = (x1 < box.x1-dx) | (x1 >= box.x2-dx);
3178
                        x2_out = (x2 < box.x1) | (x2 >= box.x2);
3179
                        x2_out = (x2 < box.x1-dx) | (x2 >= box.x2-dx);
3179
                        y1_out = (y1 < box.y1) | (y1 >= box.y2);
3180
                        y1_out = (y1 < box.y1-dy) | (y1 >= box.y2-dy);
3180
                        y2_out = (y2 < box.y1) | (y2 >= box.y2);
3181
                        y2_out = (y2 < box.y1-dy) | (y2 >= box.y2-dy);
3181
3182
3182
                        tl = x1_out|y1_out ? 0 : fetch(b, x_off, indexed);
3183
                        tl = x1_out|y1_out ? 0 : fetch(b, x_off, indexed);
3183
                        tr = x2_out|y1_out ? 0 : fetch(b, x_off + 1, indexed);
3184
                        tr = x2_out|y1_out ? 0 : fetch(b, x_off + 1, indexed);
Lines 3233-3249 static void fbFetchTransformed(PicturePt Link Here
3233
                        idistx = 256 - distx;
3234
                        idistx = 256 - distx;
3234
                        idisty = 256 - disty;
3235
                        idisty = 256 - disty;
3235
3236
3236
                        b = bits + (y1 + pict->pDrawable->y)*stride;
3237
                        b = bits + (y1 + dy)*stride;
3237
                        x_off = x1 + pict->pDrawable->x;
3238
                        x_off = x1 + dx;
3238
3239
3239
                        tl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y1, &box)
3240
                        tl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y1 + dy, &box)
3240
                             ? fetch(b, x_off, indexed) : 0;
3241
                             ? fetch(b, x_off, indexed) : 0;
3241
                        tr = POINT_IN_REGION(0, pict->pCompositeClip, x2, y1, &box)
3242
                        tr = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y1 + dy, &box)
3242
                             ? fetch(b, x_off + 1, indexed) : 0;
3243
                             ? fetch(b, x_off + 1, indexed) : 0;
3243
                        b += stride;
3244
                        b += stride;
3244
                        bl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y2, &box)
3245
                        bl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y2 + dy, &box)
3245
                             ? fetch(b, x_off, indexed) : 0;
3246
                             ? fetch(b, x_off, indexed) : 0;
3246
                        br = POINT_IN_REGION(0, pict->pCompositeClip, x2, y2, &box)
3247
                        br = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y2 + dy, &box)
3247
                             ? fetch(b, x_off + 1, indexed) : 0;
3248
                             ? fetch(b, x_off + 1, indexed) : 0;
3248
3249
3249
                        ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
3250
                        ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
Lines 3301-3309 static void fbFetchTransformed(PicturePt Link Here
3301
                    for (x = x1; x < x2; x++) {
3302
                    for (x = x1; x < x2; x++) {
3302
                        if (*p) {
3303
                        if (*p) {
3303
                            int tx = (pict->repeatType == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x;
3304
                            int tx = (pict->repeatType == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x;
3304
                            if (POINT_IN_REGION (0, pict->pCompositeClip, tx, ty, &box)) {
3305
                            if (POINT_IN_REGION (0, pict->pCompositeClip, tx + dx, ty + dy, &box)) {
3305
                                FbBits *b = bits + (ty + pict->pDrawable->y)*stride;
3306
                                FbBits *b = bits + (ty + dy)*stride;
3306
                                CARD32 c = fetch(b, tx + pict->pDrawable->x, indexed);
3307
                                CARD32 c = fetch(b, tx + dx, indexed);
3307
3308
3308
                                srtot += Red(c) * *p;
3309
                                srtot += Red(c) * *p;
3309
                                sgtot += Green(c) * *p;
3310
                                sgtot += Green(c) * *p;

Return to bug 152730