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

(-)fbcompose.c (-36 / +47 lines)
Lines 2860-2866 static void fbFetchTransformed(PicturePt Link Here
2860
    FbBits     *bits;
2860
    FbBits     *bits;
2861
    FbStride    stride;
2861
    FbStride    stride;
2862
    int         bpp;
2862
    int         bpp;
2863
    int         xoff, yoff;
2863
    int         xoff, yoff, dx, dy;
2864
    fetchPixelProc   fetch;
2864
    fetchPixelProc   fetch;
2865
    PictVector	v;
2865
    PictVector	v;
2866
    PictVector  unit;
2866
    PictVector  unit;
Lines 2875-2882 static void fbFetchTransformed(PicturePt Link Here
2875
    x += xoff;
2875
    x += xoff;
2876
    y += yoff;
2876
    y += yoff;
2877
2877
2878
    v.vector[0] = IntToxFixed(x);
2878
    dx = pict->pDrawable->x;
2879
    v.vector[1] = IntToxFixed(y);
2879
    dy = pict->pDrawable->y;
2880
2881
    v.vector[0] = IntToxFixed(x - dx);
2882
    v.vector[1] = IntToxFixed(y - dy);
2880
    v.vector[2] = xFixed1;
2883
    v.vector[2] = xFixed1;
2881
2884
2882
    /* when using convolution filters one might get here without a transform */
2885
    /* when using convolution filters one might get here without a transform */
Lines 2909-2915 static void fbFetchTransformed(PicturePt Link Here
2909
                            y = MOD(v.vector[1]>>16, pict->pDrawable->height);
2912
                            y = MOD(v.vector[1]>>16, pict->pDrawable->height);
2910
                            x = MOD(v.vector[0]>>16, pict->pDrawable->width);
2913
                            x = MOD(v.vector[0]>>16, pict->pDrawable->width);
2911
                        }
2914
                        }
2912
                        buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
2915
                        buffer[i] = fetch(bits + (y + dy)*stride, x + dx, indexed);
2913
                    }
2916
                    }
2914
                    v.vector[0] += unit.vector[0];
2917
                    v.vector[0] += unit.vector[0];
2915
                    v.vector[1] += unit.vector[1];
2918
                    v.vector[1] += unit.vector[1];
Lines 2927-2934 static void fbFetchTransformed(PicturePt Link Here
2927
                            y = MOD(v.vector[1]>>16, pict->pDrawable->height);
2930
                            y = MOD(v.vector[1]>>16, pict->pDrawable->height);
2928
                            x = MOD(v.vector[0]>>16, pict->pDrawable->width);
2931
                            x = MOD(v.vector[0]>>16, pict->pDrawable->width);
2929
                        }
2932
                        }
2930
                        if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box))
2933
                        if (POINT_IN_REGION (0, pict->pCompositeClip, x + dx, y + dy, &box))
2931
                            buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
2934
                            buffer[i] = fetch(bits + (y + dy)*stride, x + dx, indexed);
2932
                        else
2935
                        else
2933
                            buffer[i] = 0;
2936
                            buffer[i] = 0;
2934
                    }
2937
                    }
Lines 2940-2945 static void fbFetchTransformed(PicturePt Link Here
2940
        } else {
2943
        } else {
2941
            if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
2944
            if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
2942
                box = pict->pCompositeClip->extents;
2945
                box = pict->pCompositeClip->extents;
2946
		box.x1 -= dx;
2947
		box.x2 -= dx;
2948
		box.y1 -= dy;
2949
		box.y2 -= dy;
2943
                for (i = 0; i < width; ++i) {
2950
                for (i = 0; i < width; ++i) {
2944
                    if (!v.vector[2]) {
2951
                    if (!v.vector[2]) {
2945
                        buffer[i] = 0;
2952
                        buffer[i] = 0;
Lines 2952-2958 static void fbFetchTransformed(PicturePt Link Here
2952
                            x = v.vector[0]>>16;
2959
                            x = v.vector[0]>>16;
2953
                        }
2960
                        }
2954
                        buffer[i] = ((x < box.x1) | (x >= box.x2) | (y < box.y1) | (y >= box.y2)) ?
2961
                        buffer[i] = ((x < box.x1) | (x >= box.x2) | (y < box.y1) | (y >= box.y2)) ?
2955
                                    0 : fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
2962
                                    0 : fetch(bits + (y + dy)*stride, x + dx, indexed);
2956
                    }
2963
                    }
2957
                    v.vector[0] += unit.vector[0];
2964
                    v.vector[0] += unit.vector[0];
2958
                    v.vector[1] += unit.vector[1];
2965
                    v.vector[1] += unit.vector[1];
Lines 2970-2977 static void fbFetchTransformed(PicturePt Link Here
2970
                            y = v.vector[1]>>16;
2977
                            y = v.vector[1]>>16;
2971
                            x = v.vector[0]>>16;
2978
                            x = v.vector[0]>>16;
2972
                        }
2979
                        }
2973
                        if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box))
2980
                        if (POINT_IN_REGION (0, pict->pCompositeClip, x + dx, y + dy, &box))
2974
                            buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed);
2981
                            buffer[i] = fetch(bits + (y + dy)*stride, x + dx, indexed);
2975
                        else
2982
                        else
2976
                            buffer[i] = 0;
2983
                            buffer[i] = 0;
2977
                    }
2984
                    }
Lines 3019-3031 static void fbFetchTransformed(PicturePt Link Here
3019
                        y1 = MOD (y1, pict->pDrawable->height);
3026
                        y1 = MOD (y1, pict->pDrawable->height);
3020
                        y2 = MOD (y2, pict->pDrawable->height);
3027
                        y2 = MOD (y2, pict->pDrawable->height);
3021
3028
3022
                        b = bits + (y1 + pict->pDrawable->y)*stride;
3029
                        b = bits + (y1 + dy)*stride;
3023
3030
3024
                        tl = fetch(b, x1 + pict->pDrawable->x, indexed);
3031
                        tl = fetch(b, x1 + dx, indexed);
3025
                        tr = fetch(b, x2 + pict->pDrawable->x, indexed);
3032
                        tr = fetch(b, x2 + dx, indexed);
3026
                        b = bits + (y2 + pict->pDrawable->y)*stride;
3033
                        b = bits + (y2 + dy)*stride;
3027
                        bl = fetch(b, x1 + pict->pDrawable->x, indexed);
3034
                        bl = fetch(b, x1 + dx, indexed);
3028
                        br = fetch(b, x2 + pict->pDrawable->x, indexed);
3035
                        br = fetch(b, x2 + dx, indexed);
3029
3036
3030
                        ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
3037
                        ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
3031
                        fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
3038
                        fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
Lines 3080-3096 static void fbFetchTransformed(PicturePt Link Here
3080
                        y1 = MOD (y1, pict->pDrawable->height);
3087
                        y1 = MOD (y1, pict->pDrawable->height);
3081
                        y2 = MOD (y2, pict->pDrawable->height);
3088
                        y2 = MOD (y2, pict->pDrawable->height);
3082
3089
3083
                        b = bits + (y1 + pict->pDrawable->y)*stride;
3090
                        b = bits + (y1 + dy)*stride;
3084
3091
3085
                        tl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y1, &box)
3092
                        tl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y1 + dy, &box)
3086
                             ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0;
3093
                             ? fetch(b, x1 + dx, indexed) : 0;
3087
                        tr = POINT_IN_REGION(0, pict->pCompositeClip, x2, y1, &box)
3094
                        tr = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y1 + dy, &box)
3088
                             ? fetch(b, x2 + pict->pDrawable->x, indexed) : 0;
3095
                             ? fetch(b, x2 + dx, indexed) : 0;
3089
                        b = bits + (y2 + pict->pDrawable->y)*stride;
3096
                        b = bits + (y2 + dy)*stride;
3090
                        bl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y2, &box)
3097
                        bl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y2 + dy, &box)
3091
                             ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0;
3098
                             ? fetch(b, x1 + dx, indexed) : 0;
3092
                        br = POINT_IN_REGION(0, pict->pCompositeClip, x2, y2, &box)
3099
                        br = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y2 + dy, &box)
3093
                             ? fetch(b, x2 + pict->pDrawable->x, indexed) : 0;
3100
                             ? fetch(b, x2 + dx, indexed) : 0;
3094
3101
3095
                        ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
3102
                        ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
3096
                        fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
3103
                        fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
Lines 3114-3119 static void fbFetchTransformed(PicturePt Link Here
3114
        } else {
3121
        } else {
3115
            if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
3122
            if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
3116
                box = pict->pCompositeClip->extents;
3123
                box = pict->pCompositeClip->extents;
3124
		box.x1 -= dx;
3125
		box.x2 -= dx;
3126
		box.y1 -= dy;
3127
		box.y2 -= dy;
3117
                for (i = 0; i < width; ++i) {
3128
                for (i = 0; i < width; ++i) {
3118
                    if (!v.vector[2]) {
3129
                    if (!v.vector[2]) {
3119
                        buffer[i] = 0;
3130
                        buffer[i] = 0;
Lines 3144-3151 static void fbFetchTransformed(PicturePt Link Here
3144
                        idistx = 256 - distx;
3155
                        idistx = 256 - distx;
3145
                        idisty = 256 - disty;
3156
                        idisty = 256 - disty;
3146
3157
3147
                        b = bits + (y1 + pict->pDrawable->y)*stride;
3158
                        b = bits + (y1 + dy)*stride;
3148
                        x_off = x1 + pict->pDrawable->x;
3159
                        x_off = x1 + dx;
3149
3160
3150
                        x1_out = (x1 < box.x1) | (x1 >= box.x2);
3161
                        x1_out = (x1 < box.x1) | (x1 >= box.x2);
3151
                        x2_out = (x2 < box.x1) | (x2 >= box.x2);
3162
                        x2_out = (x2 < box.x1) | (x2 >= box.x2);
Lines 3206-3222 static void fbFetchTransformed(PicturePt Link Here
3206
                        idistx = 256 - distx;
3217
                        idistx = 256 - distx;
3207
                        idisty = 256 - disty;
3218
                        idisty = 256 - disty;
3208
3219
3209
                        b = bits + (y1 + pict->pDrawable->y)*stride;
3220
                        b = bits + (y1 + dy)*stride;
3210
                        x_off = x1 + pict->pDrawable->x;
3221
                        x_off = x1 + dx;
3211
3222
3212
                        tl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y1, &box)
3223
                        tl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y1 + dy, &box)
3213
                             ? fetch(b, x_off, indexed) : 0;
3224
                             ? fetch(b, x_off, indexed) : 0;
3214
                        tr = POINT_IN_REGION(0, pict->pCompositeClip, x2, y1, &box)
3225
                        tr = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y1 + dy, &box)
3215
                             ? fetch(b, x_off + 1, indexed) : 0;
3226
                             ? fetch(b, x_off + 1, indexed) : 0;
3216
                        b += stride;
3227
                        b += stride;
3217
                        bl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y2, &box)
3228
                        bl = POINT_IN_REGION(0, pict->pCompositeClip, x1 + dx, y2 + dy, &box)
3218
                             ? fetch(b, x_off, indexed) : 0;
3229
                             ? fetch(b, x_off, indexed) : 0;
3219
                        br = POINT_IN_REGION(0, pict->pCompositeClip, x2, y2, &box)
3230
                        br = POINT_IN_REGION(0, pict->pCompositeClip, x2 + dx, y2 + dy, &box)
3220
                             ? fetch(b, x_off + 1, indexed) : 0;
3231
                             ? fetch(b, x_off + 1, indexed) : 0;
3221
3232
3222
                        ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
3233
                        ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
Lines 3274-3282 static void fbFetchTransformed(PicturePt Link Here
3274
                    for (x = x1; x < x2; x++) {
3285
                    for (x = x1; x < x2; x++) {
3275
                        if (*p) {
3286
                        if (*p) {
3276
                            int tx = (pict->repeatType == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x;
3287
                            int tx = (pict->repeatType == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x;
3277
                            if (POINT_IN_REGION (0, pict->pCompositeClip, tx, ty, &box)) {
3288
                            if (POINT_IN_REGION (0, pict->pCompositeClip, tx + dx, ty + dy, &box)) {
3278
                                FbBits *b = bits + (ty + pict->pDrawable->y)*stride;
3289
                                FbBits *b = bits + (ty + dy)*stride;
3279
                                CARD32 c = fetch(b, tx + pict->pDrawable->x, indexed);
3290
                                CARD32 c = fetch(b, tx + dx, indexed);
3280
3291
3281
                                srtot += Red(c) * *p;
3292
                                srtot += Red(c) * *p;
3282
                                sgtot += Green(c) * *p;
3293
                                sgtot += Green(c) * *p;

Return to bug 152730