2 // Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "gnashconfig.h"
30 #include <boost/assign/list_of.hpp>
37 # include "agg/Renderer_agg.h"
39 #ifdef RENDERER_OPENGL
40 # include "opengl/Renderer_ogl.h"
42 #ifdef RENDERER_OPENVG
44 # ifdef OPENVG_VERSION_1_1
47 # include <VG/vgext.h>
49 # include <VG/openvg.h>
52 # include "opengles1/Renderer_gles1.h"
54 # ifdef RENDERER_GLES2
55 # include "opengles2/Renderer_gles2.h"
58 # include "cairo/Renderer_cairo.h"
61 #ifdef BUILD_EGL_DEVICE
62 # include <egl/eglDevice.h>
64 #ifdef BUILD_DIRECTFB_DEVICE
65 # include <directfb/directfb.h>
67 #ifdef BUILD_X11_DEVICE
68 # include <x11/X11Device.h>
72 #include "SWFMatrix.h"
74 #include "Transform.h"
75 #include "GnashVaapiImage.h"
76 #include "GnashVaapiImageProxy.h"
78 using namespace gnash
;
81 const VGfloat white_color
[4] = {1.0, 1.0, 1.0, 1.0};
82 const VGfloat color
[4] = {0.4, 0.1, 1.0, 1.0};
88 // The debug log used by all the gnash libraries.
89 static LogFile
& dbglogfile
= LogFile::getDefaultInstance();
95 VGfloat clearColor
[] = {0.0f
, 0.0f
, 0.0f
, 1.0f
};/* black color */
96 VGfloat greenColor
[] = {0.0f
, 1.0f
, 0.0f
, 1.0f
};/* green color */
97 VGint arcType
= VGU_ARC_OPEN
;
98 VGfloat x
, y
, w
, h
, startAngle
, angleExtent
;
105 startAngle
= -540.0f
;
106 angleExtent
= 270.0f
;
111 paint
= vgCreatePaint();
113 vgSetPaint(paint
, VG_STROKE_PATH
);
114 vgSetParameterfv(paint
, VG_PAINT_COLOR
, 4, greenColor
);
115 vgSetParameteri( paint
, VG_PAINT_TYPE
, VG_PAINT_TYPE_COLOR
);
116 vgSetf(VG_STROKE_LINE_WIDTH
, 6.0f
);
117 vgSeti(VG_RENDERING_QUALITY
, VG_RENDERING_QUALITY_NONANTIALIASED
);
118 vgSetfv(VG_CLEAR_COLOR
, 4, clearColor
);
120 path
= vgCreatePath(VG_PATH_FORMAT_STANDARD
, VG_PATH_DATATYPE_F
,
121 1.0f
, 0.0f
, 0, 0, VG_PATH_CAPABILITY_ALL
);
123 vguArc(path
, x
, y
, w
, h
, startAngle
, angleExtent
, (VGUArcType
)arcType
);
125 vgSeti(VG_STROKE_CAP_STYLE
, VG_CAP_BUTT
);
126 vgSeti(VG_STROKE_JOIN_STYLE
, VG_JOIN_BEVEL
);
127 vgSetf(VG_STROKE_MITER_LIMIT
, 4.0f
);
130 /* new window size or exposure */
134 static const VGubyte sqrCmds
[5] = {VG_MOVE_TO_ABS
, VG_HLINE_TO_ABS
,
135 VG_VLINE_TO_ABS
, VG_HLINE_TO_ABS
, VG_CLOSE_PATH
};
136 static const VGfloat sqrCoords
[5] = {50.0f
, 50.0f
, 250.0f
, 250.0f
, 50.0f
};
137 path
= vgCreatePath(VG_PATH_FORMAT_STANDARD
, VG_PATH_DATATYPE_F
, 1, 0, 0, 0,
138 VG_PATH_CAPABILITY_APPEND_TO
);
139 vgAppendPathData(path
, 5, sqrCmds
, sqrCoords
);
141 VGPaint fill
= vgCreatePaint();
142 vgSetParameterfv(fill
, VG_PAINT_COLOR
, 4, color
);
143 vgSetPaint(fill
, VG_FILL_PATH
);
145 vgSetfv(VG_CLEAR_COLOR
, 4, white_color
);
146 vgSetf(VG_STROKE_LINE_WIDTH
, 10);
147 vgSeti(VG_STROKE_CAP_STYLE
, VG_CAP_BUTT
);
148 vgSeti(VG_STROKE_JOIN_STYLE
, VG_JOIN_ROUND
);
149 vgSetf(VG_STROKE_MITER_LIMIT
, 4.0f
);
155 reshape(int w
, int h
)
163 vgClear(0, 0, 640, 480);
164 vgSeti(VG_MATRIX_MODE
, VG_MATRIX_STROKE_PAINT_TO_USER
);
167 vgDrawPath(path
, VG_STROKE_PATH
);
174 // indent-tabs-mode: nil