rendercheck: 2 commits - t_gradient.c
Lars Knoll
lars at kemper.freedesktop.org
Fri Apr 21 11:01:53 EEST 2006
t_gradient.c | 50 +++++++++++++++++++++++++++++++++++++-------------
1 files changed, 37 insertions(+), 13 deletions(-)
New commits:
diff-tree 9d46f6e9528040416356602688d717a2bb0dd2a5 (from parents)
Merge: edb11cfdda3d4d14fc1ba5f0c4bc9ce925bf970b 6cfab618fabcc5c4fc86aaeadcd8e6d9255cb6eb
Author: Lars Knoll <lars at pramoda.localdomain>
Date: Fri Apr 21 10:01:40 2006 +0200
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/app/rendercheck
diff-tree edb11cfdda3d4d14fc1ba5f0c4bc9ce925bf970b (from 00f788fc2785db30ee294281c027f82d09256be6)
Author: Lars Knoll <lars at trolltech.com>
Date: Thu Apr 20 08:56:37 2006 +0200
add license header
diff --git a/t_gradient.c b/t_gradient.c
index da02724..6f39dee 100644
--- a/t_gradient.c
+++ b/t_gradient.c
@@ -1,3 +1,27 @@
+/*
+ * $Id$
+ *
+ * Copyright © 2006 Lars Knoll
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the copyright holders not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The copyright holders makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
#include <stdio.h>
#include <assert.h>
#include "rendercheck.h"
@@ -12,18 +36,18 @@ static const stop stop_list[][10] = {
{ 0., {0, 0, 1.0, 1.0} },
{ 1., {1.0, 0, 0, 1.0} },
{ -1, {0, 0, 0, 0} }
- },
+ },
{
{ 0., {0, 0, 1.0, 1.0} },
{ .5, {0, 1.0, 0, 1.0} },
{ 1., {1.0, 0, 0, 1.0} },
{ -1, {0, 0, 0, 0} }
- },
+ },
{
{ 0., {0, 0, 1.0, 0} },
{ 1., {1.0, 0, 0, 1.0} },
{ -1, {0, 0, 0, 0} }
- },
+ },
{
{ 0., {0, 0, 1.0, 0} },
{ .5, {0, 1.0, 0, .75} },
@@ -105,7 +129,7 @@ static void gradientPixel(const stop *st
*result = stops[0].color;
return;
}
-
+
for (i = 0; i < 10; ++i) {
if (stops[i].x >= pos)
break;
@@ -128,7 +152,7 @@ static void gradientPixel(const stop *st
result->r *= result->a;
result->g *= result->a;
result->b *= result->a;
-
+
return;
}
@@ -141,7 +165,7 @@ static void calculate_linear_gradient_co
dx = points[1].x - points[0].x;
dy = points[1].y - points[0].y;
l = dx*dx + dy*dy;
-
+
xrel = x - points[0].x;
yrel = y - points[0].y;
@@ -186,7 +210,7 @@ Bool linear_gradient_test(Display *dpy,
XRenderPictureAttributes pa;
pa.repeat = repeat;
XRenderChangePicture(dpy, gradient, CPRepeat, &pa);
-
+
XRenderComposite(dpy, PictOpSrc, dst_color->pict, 0, dst->pict, 0, 0,
0, 0, 0, 0, win_width, win_height);
XRenderComposite(dpy, ops[op].op, gradient, 0,
@@ -199,12 +223,12 @@ Bool linear_gradient_test(Display *dpy,
pix = test_pixels;
while (pix->x >= 0) {
-
+
get_pixel(dpy, dst, pix->x, pix->y, &tested);
calculate_linear_gradient_color(pix->x, pix->y, &linear_gradient_points[p],
stps, &tgradient, repeat);
-
+
tdst = dst_color->color;
color_correct(dst, &tdst);
do_composite(ops[op].op, &tgradient, 0, &tdst,
@@ -216,8 +240,8 @@ Bool linear_gradient_test(Display *dpy,
printf("gradient: %d stops: %d repeat: %d pos: %d/%d\n"
"src color: %.2f %.2f %.2f %.2f\n"
"dst color: %.2f %.2f %.2f %.2f\n",
- p/2, s,
- repeat, pix->x, pix->y,
+ p/2, s,
+ repeat, pix->x, pix->y,
tgradient.r, tgradient.g,
tgradient.b, tgradient.a,
dst_color->color.r, dst_color->color.g,
@@ -228,11 +252,11 @@ Bool linear_gradient_test(Display *dpy,
}
++pix;
}
- }
+ }
XRenderFreePicture(dpy, gradient);
}
}
- return success;
+ return success;
}
More information about the xorg-commit
mailing list