~ubuntu-branches/ubuntu/natty/mesa/natty-proposed

« back to all changes in this revision

Viewing changes to progs/openvg/trivial/arc.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Hooker, Robert Hooker, Christopher James Halse Rogers
  • Date: 2010-09-14 08:55:40 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100914085540-m4fpl0hdjlfd4jgz
Tags: 7.9~git20100909-0ubuntu1
[ Robert Hooker ]
* New upstream git snapshot up to commit 94118fe2d4b1e5 (LP: #631413)
* New features include ATI HD5xxx series support in r600, and a vastly
  improved glsl compiler.
* Remove pre-generated .pc's, use the ones generated at build time
  instead.
* Remove all references to mesa-utils now that its no longer shipped
  with the mesa source.
* Disable the experimental ARB_fragment_shader option by default on
  i915, it exposes incomplete functionality that breaks KDE compositing
  among other things. It can be enabled via driconf still. (LP: #628930).

[ Christopher James Halse Rogers ]
* debian/patches/04_osmesa_version.diff:
  - Refresh for new upstream
* Bugs fixed in this release:
  - Fixes severe rendering corruption in Unity on radeon (LP: #628727,
    LP: #596292, LP: #599741, LP: #630315, LP: #613694, LP: #599741).
  - Also fixes rendering in gnome-shell (LP: #578619).
  - Flickering in OpenGL apps on radeon (LP: #626943, LP: #610541).
  - Provides preliminary support for new intel chips (LP: #601052).
* debian/rules:
  - Update configure flags to match upstream reshuffling.
  - Explicitly remove gallium DRI drivers that we don't want to ship.
* Update debian/gbp.conf for this Maverick-specific packaging
* libegl1-mesa-dri-x11,kms: There are no longer separate kms or x11 drivers
  for EGL, libegl1-mesa-drivers now contains a single driver that provides
  both backends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "eglcommon.h"
2
 
 
3
 
#include <VG/openvg.h>
4
 
#include <math.h>
5
 
 
6
 
const VGfloat clear_color[4] = {1.0, 1.0, 1.0, 1.0};
7
 
const VGfloat color[4] = {1.0, 1.0, 1.0, 0.5};
8
 
 
9
 
VGPath vgPath;
10
 
 
11
 
static void ellipse(VGPath vgPath, VGfloat rx, VGfloat ry, VGfloat angle)
12
 
{
13
 
    static const VGubyte cmd[] =
14
 
    { VG_MOVE_TO_ABS, VG_SCCWARC_TO_REL, VG_SCCWARC_TO_REL, VG_CLOSE_PATH };
15
 
 
16
 
    VGfloat val[12];
17
 
    VGfloat c = cos(angle) * rx;
18
 
    VGfloat s = sin(angle) * rx;
19
 
 
20
 
    val[0] = c;
21
 
    val[1] = s;
22
 
    val[2] = rx;
23
 
    val[3] = ry;
24
 
    val[4] = angle;
25
 
    val[5] = -2.0f * c;
26
 
    val[6] = -2.0f * s;
27
 
    val[7] = rx;
28
 
    val[8] = ry;
29
 
    val[9] = angle;
30
 
    val[10] = 2.0f * c;
31
 
    val[11] = 2.0f * s;
32
 
 
33
 
    vgClearPath(vgPath, VG_PATH_CAPABILITY_ALL);
34
 
    vgAppendPathData(vgPath, sizeof(cmd), cmd, val);
35
 
    vgDrawPath(vgPath, VG_FILL_PATH | VG_STROKE_PATH);
36
 
}
37
 
 
38
 
static void
39
 
init(void)
40
 
{
41
 
    VGPaint vgPaint;
42
 
 
43
 
    vgSetfv(VG_CLEAR_COLOR, 4, clear_color);
44
 
    vgPath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
45
 
                          VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0,
46
 
                          VG_PATH_CAPABILITY_ALL);
47
 
 
48
 
    vgPaint = vgCreatePaint();
49
 
    vgSetParameteri(vgPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
50
 
    vgSetColor(vgPaint, 0x00ff00ff);
51
 
    vgSetPaint(vgPaint, VG_FILL_PATH);
52
 
 
53
 
    vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED);
54
 
    vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER);
55
 
    vgSetf(VG_STROKE_LINE_WIDTH, 2.0f);
56
 
    vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_SQUARE);
57
 
    vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_MITER);
58
 
    vgSetf(VG_STROKE_MITER_LIMIT, 4.0f);
59
 
    vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
60
 
}
61
 
 
62
 
/* new window size or exposure */
63
 
static void
64
 
reshape(int w, int h)
65
 
{
66
 
}
67
 
 
68
 
static void
69
 
draw(void)
70
 
{
71
 
    vgClear(0, 0, window_width(), window_height());
72
 
 
73
 
#if 0
74
 
    vgLoadIdentity();
75
 
    vgTranslate(40.0f, 24.0f);
76
 
    vgScale(0.61804f, 0.61804f);
77
 
    vgShear(-1.0f, 0.0f);
78
 
    vgDrawPath(vgPath, VG_FILL_PATH | VG_STROKE_PATH);
79
 
#else
80
 
 
81
 
    /* row 1, col 1: Identity transform. */
82
 
 
83
 
    vgLoadIdentity();
84
 
    vgTranslate(8.0f, 8.0f);
85
 
    ellipse(vgPath, 4.0f, 4.0f, 0.0f);
86
 
 
87
 
    /* row 1, col 2: 10^3 horizontal squeeze. */
88
 
 
89
 
    vgLoadIdentity();
90
 
    vgTranslate(24.0f, 8.0f);
91
 
    vgScale(1.0e-3f, 1.0f);
92
 
    ellipse(vgPath, 4.0e3f, 4.0f, 0.0f);
93
 
 
94
 
    /* row 1, col 3: 10^6 horizontal squeeze. */
95
 
 
96
 
    vgLoadIdentity();
97
 
    vgTranslate(40.0f, 8.0f);
98
 
    vgScale(1.0e-6f, 1.0f);
99
 
    ellipse(vgPath, 4.0e6f, 4.0f, 0.0f);
100
 
 
101
 
    /* row 1, col 4: 10^9 horizontal squeeze. */
102
 
 
103
 
    vgLoadIdentity();
104
 
    vgTranslate(56.0f, 8.0f);
105
 
    vgScale(1.0e-9f, 1.0f);
106
 
    ellipse(vgPath, 4.0e9f, 4.0f, 0.0f);
107
 
 
108
 
    /* row 2, col 1: 10^3 vertical squeeze. */
109
 
 
110
 
    vgLoadIdentity();
111
 
    vgTranslate(8.0f, 24.0f);
112
 
    vgScale(1.0f, 1.0e-3f);
113
 
    ellipse(vgPath, 4.0f, 4.0e3f, 0.0f);
114
 
 
115
 
    /* row 2, col 2: Shear 0. */
116
 
 
117
 
    vgLoadIdentity();
118
 
    vgTranslate(24.0f, 24.0f);
119
 
    vgShear(0.0f, 0.0f);
120
 
    ellipse(vgPath, 4.0f, 4.0f, 0.0f);
121
 
 
122
 
    /* row 2, col 3: Horizontal shear -1. */
123
 
 
124
 
    vgLoadIdentity();
125
 
    vgTranslate(40.0f, 24.0f);
126
 
    vgScale(0.61804f, 0.61804f);
127
 
    vgShear(-1.0f, 0.0f);
128
 
    ellipse(vgPath, 10.47213f, 4.0f, 31.717f);
129
 
#endif
130
 
    vgFlush();
131
 
}
132
 
 
133
 
 
134
 
int main(int argc, char **argv)
135
 
{
136
 
    set_window_size(64, 64);
137
 
   return run(argc, argv, init, reshape,
138
 
              draw, 0);
139
 
}