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

« back to all changes in this revision

Viewing changes to progs/openvg/trivial/gradorigin.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
 
VGColorRampSpreadMode spread = VG_COLOR_RAMP_SPREAD_PAD;
14
 
 
15
 
static void
16
 
init(void)
17
 
{
18
 
   VGubyte commands[5] =  {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_CLOSE_PATH};
19
 
   VGfloat coords[8] =    {0.0f,0.0f, 32.0f,0.0f, 32.0f,32.0f, 0.0f,32.0f };
20
 
 
21
 
   VGfloat rampStop[20] = {-0.5f,  1.0f, 1.0f, 1.0f, 1.0f,
22
 
                           0.25f, 1.0f, 0.0f, 0.0f, 1.0f,
23
 
                           0.75f, 0.0f, 0.0f, 1.0f, 1.0f,
24
 
                           1.5f,  0.0f, 0.0f, 0.0f, 0.0f};
25
 
 
26
 
   VGfloat defaultColor[] = {1.0f, 1.0f, 1.0f, 1.0f};
27
 
   VGfloat linearGradient[4] = {0.0f, 0.0f, 0.0f, 32.0f};
28
 
 
29
 
   path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
30
 
                       1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
31
 
   if (path == VG_INVALID_HANDLE)
32
 
      return;
33
 
 
34
 
   fill = vgCreatePaint();
35
 
   if (fill == VG_INVALID_HANDLE) {
36
 
      vgDestroyPath(path);
37
 
      return;
38
 
   }
39
 
 
40
 
   vgSetfv(VG_CLEAR_COLOR, 4, defaultColor);
41
 
   vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_NONANTIALIASED);
42
 
 
43
 
   vgAppendPathData(path, 5, commands, coords);
44
 
 
45
 
   vgSetPaint(fill, VG_FILL_PATH);
46
 
   vgSetParameteri(fill, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT);
47
 
   vgSetParameteri(fill, VG_PAINT_COLOR_RAMP_SPREAD_MODE,
48
 
                   VG_COLOR_RAMP_SPREAD_REPEAT);
49
 
   vgSetParameterfv(fill, VG_PAINT_LINEAR_GRADIENT, 4, linearGradient);
50
 
   vgSetParameterfv(fill, VG_PAINT_COLOR_RAMP_STOPS, 20, rampStop);
51
 
}
52
 
 
53
 
/* new window size or exposure */
54
 
static void
55
 
reshape(int w, int h)
56
 
{
57
 
   vgLoadIdentity();
58
 
}
59
 
 
60
 
static void
61
 
draw(void)
62
 
{
63
 
   vgClear(0, 0, window_width(), window_height());
64
 
 
65
 
   vgDrawPath(path, VG_FILL_PATH);
66
 
 
67
 
   vgFlush();
68
 
}
69
 
 
70
 
 
71
 
int main(int argc, char **argv)
72
 
{
73
 
   if (argc > 1) {
74
 
      const char *arg = argv[1];
75
 
      if (!strcmp("-pad", arg))
76
 
         spread = VG_COLOR_RAMP_SPREAD_PAD;
77
 
      else if (!strcmp("-repeat", arg))
78
 
         spread = VG_COLOR_RAMP_SPREAD_REPEAT;
79
 
      else if (!strcmp("-reflect", arg))
80
 
         spread = VG_COLOR_RAMP_SPREAD_REFLECT;
81
 
   }
82
 
 
83
 
   switch(spread) {
84
 
   case VG_COLOR_RAMP_SPREAD_PAD:
85
 
      printf("Using spread mode: pad\n");
86
 
      break;
87
 
   case VG_COLOR_RAMP_SPREAD_REPEAT:
88
 
      printf("Using spread mode: repeat\n");
89
 
      break;
90
 
   case VG_COLOR_RAMP_SPREAD_REFLECT:
91
 
      printf("Using spread mode: reflect\n");
92
 
   }
93
 
 
94
 
   set_window_size(200, 200);
95
 
 
96
 
   return run(argc, argv, init, reshape,
97
 
              draw, 0);
98
 
}