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

« back to all changes in this revision

Viewing changes to progs/openvg/trivial/radialgrad.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
 
 
5
 
#include <stdio.h>
6
 
#include <string.h>
7
 
 
8
 
static const VGfloat white_color[4] = {1.0, 1.0, 1.0, 1.0};
9
 
 
10
 
static VGPath path;
11
 
static VGPaint fill;
12
 
 
13
 
 
14
 
VGfloat centeredGradient[5] = {200.0f, 200.0f, 200.0f, 200.0f, 100};
15
 
VGfloat noncenteredGradient[5] = {200.0f, 200.0f, 250.0f, 250.0f, 100};
16
 
VGfloat *radialGradient = centeredGradient;
17
 
 
18
 
VGColorRampSpreadMode spread = VG_COLOR_RAMP_SPREAD_PAD;
19
 
 
20
 
static void
21
 
init(void)
22
 
{
23
 
   static const VGubyte sqrCmds[5] = {VG_MOVE_TO_ABS, VG_HLINE_TO_ABS, VG_VLINE_TO_ABS, VG_HLINE_TO_ABS, VG_CLOSE_PATH};
24
 
   static const VGfloat sqrCoords[5]   = {0.0f, 0.0f, 400.0f, 400.0f, 0.0f};
25
 
 
26
 
   VGfloat rampStop[] = {0.00f, 1.0f, 1.0f, 1.0f, 1.0f,
27
 
                         0.33f, 1.0f, 0.0f, 0.0f, 1.0f,
28
 
                         0.66f, 0.0f, 1.0f, 0.0f, 1.0f,
29
 
                         1.00f, 0.0f, 0.0f,  1.0f, 1.0f};
30
 
 
31
 
   path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 0,
32
 
                       VG_PATH_CAPABILITY_APPEND_TO);
33
 
   vgAppendPathData(path, 5, sqrCmds, sqrCoords);
34
 
 
35
 
   fill = vgCreatePaint();
36
 
   vgSetPaint(fill, VG_FILL_PATH);
37
 
 
38
 
   vgSetParameteri(fill, VG_PAINT_TYPE, VG_PAINT_TYPE_RADIAL_GRADIENT);
39
 
   vgSetParameteri(fill, VG_PAINT_COLOR_RAMP_SPREAD_MODE, spread);
40
 
   vgSetParameterfv(fill, VG_PAINT_RADIAL_GRADIENT, 5, radialGradient);
41
 
   vgSetParameterfv(fill, VG_PAINT_COLOR_RAMP_STOPS, 20, rampStop);
42
 
 
43
 
   vgSetfv(VG_CLEAR_COLOR, 4, white_color);
44
 
}
45
 
 
46
 
/* new window size or exposure */
47
 
static void
48
 
reshape(int w, int h)
49
 
{
50
 
   vgLoadIdentity();
51
 
}
52
 
 
53
 
static void
54
 
draw(void)
55
 
{
56
 
   vgClear(0, 0, window_width(), window_height());
57
 
 
58
 
   vgDrawPath(path, VG_FILL_PATH);
59
 
 
60
 
   vgFlush();
61
 
}
62
 
 
63
 
 
64
 
int main(int argc, char **argv)
65
 
{
66
 
   VGint i;
67
 
   for (i = 1; i < argc; ++i) {
68
 
      const char *arg = argv[i];
69
 
      if (!strcmp("-pad", arg))
70
 
         spread = VG_COLOR_RAMP_SPREAD_PAD;
71
 
      else if (!strcmp("-repeat", arg))
72
 
         spread = VG_COLOR_RAMP_SPREAD_REPEAT;
73
 
      else if (!strcmp("-reflect", arg))
74
 
         spread = VG_COLOR_RAMP_SPREAD_REFLECT;
75
 
      else if (!strcmp("-center", arg)) {
76
 
         printf("Centered radial gradient\n");
77
 
         radialGradient = centeredGradient;
78
 
      } else if (!strcmp("-noncenter", arg)) {
79
 
         printf("Non centered radial gradient\n");
80
 
         radialGradient = noncenteredGradient;
81
 
      }
82
 
   }
83
 
 
84
 
   switch(spread) {
85
 
   case VG_COLOR_RAMP_SPREAD_PAD:
86
 
      printf("Using spread mode: pad\n");
87
 
      break;
88
 
   case VG_COLOR_RAMP_SPREAD_REPEAT:
89
 
      printf("Using spread mode: repeat\n");
90
 
      break;
91
 
   case VG_COLOR_RAMP_SPREAD_REFLECT:
92
 
      printf("Using spread mode: reflect\n");
93
 
   }
94
 
 
95
 
   set_window_size(400, 400);
96
 
 
97
 
   return run(argc, argv, init, reshape,
98
 
              draw, 0);
99
 
}