~ubuntu-branches/debian/jessie/xserver-xorg-video-intel/jessie

« back to all changes in this revision

Viewing changes to src/sna/sna_gradient.c

  • Committer: Package Import Robot
  • Author(s): Julien Cristau
  • Date: 2012-05-26 12:38:07 UTC
  • mfrom: (26.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20120526123807-esybcmtb8h417v2r
Tags: 2:2.19.0-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
{
45
45
        int n, width;
46
46
 
47
 
        width = 2;
 
47
        width = 0;
48
48
        for (n = 1; n < gradient->nstops; n++) {
49
49
                xFixed dx = gradient->stops[n].x - gradient->stops[n-1].x;
50
 
                uint16_t delta, max;
51
 
                int ramp;
 
50
                int delta, max, ramp;
52
51
 
53
52
                if (dx == 0)
54
53
                        return 1024;
55
54
 
56
55
                max = gradient->stops[n].color.red -
57
56
                        gradient->stops[n-1].color.red;
 
57
                if (max < 0)
 
58
                        max = -max;
58
59
 
59
60
                delta = gradient->stops[n].color.green -
60
61
                        gradient->stops[n-1].color.green;
 
62
                if (delta < 0)
 
63
                        delta = -delta;
61
64
                if (delta > max)
62
65
                        max = delta;
63
66
 
64
67
                delta = gradient->stops[n].color.blue -
65
68
                        gradient->stops[n-1].color.blue;
 
69
                if (delta < 0)
 
70
                        delta = -delta;
66
71
                if (delta > max)
67
72
                        max = delta;
68
73
 
69
74
                delta = gradient->stops[n].color.alpha -
70
75
                        gradient->stops[n-1].color.alpha;
 
76
                if (delta < 0)
 
77
                        delta = -delta;
71
78
                if (delta > max)
72
79
                        max = delta;
73
80
 
74
 
                ramp = 128 * max / dx;
 
81
                ramp = 256 * max / dx;
75
82
                if (ramp > width)
76
83
                        width = ramp;
77
84
        }
78
85
 
79
 
        width *= gradient->nstops-1;
 
86
        if (width == 0)
 
87
                return 1;
 
88
 
80
89
        width = (width + 7) & -8;
81
90
        return min(width, 1024);
82
91
}
168
177
             width/2, pixman_image_get_data(image)[width/2],
169
178
             width-1, pixman_image_get_data(image)[width-1]));
170
179
 
171
 
        bo = kgem_create_linear(&sna->kgem, width*4);
 
180
        bo = kgem_create_linear(&sna->kgem, width*4, 0);
172
181
        if (!bo) {
173
182
                pixman_image_unref(image);
174
183
                return NULL;
248
257
 
249
258
        DBG(("sna_render_finish_solid reset\n"));
250
259
 
251
 
        cache->cache_bo = kgem_create_linear(&sna->kgem, sizeof(cache->color));
 
260
        cache->cache_bo = kgem_create_linear(&sna->kgem, sizeof(cache->color), 0);
252
261
        cache->bo[0] = kgem_create_proxy(cache->cache_bo, 0, sizeof(uint32_t));
253
262
        cache->bo[0]->pitch = 4;
254
263
        if (force)
316
325
 
317
326
        DBG(("%s\n", __FUNCTION__));
318
327
 
319
 
        cache->cache_bo = kgem_create_linear(&sna->kgem, sizeof(color));
 
328
        cache->cache_bo = kgem_create_linear(&sna->kgem, sizeof(color), 0);
320
329
        if (!cache->cache_bo)
321
330
                return FALSE;
322
331
 
338
347
        DBG(("%s\n", __FUNCTION__));
339
348
 
340
349
        cache->cache_bo =
341
 
                kgem_create_linear(&sna->kgem, sizeof(cache->color));
 
350
                kgem_create_linear(&sna->kgem, sizeof(cache->color), 0);
342
351
        if (!cache->cache_bo)
343
352
                return FALSE;
344
353