author | Jose Thachil<jose.thachil@cell-telecom.com> |
Wed, 12 May 2010 13:05:33 +0100 | |
branch | EGL_MERGE |
changeset 59 | 0fb7b31791c3 |
parent 57 | 2bf8a359aa2f |
child 88 | a5a3a8cb368e |
permissions | -rw-r--r-- |
57
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1 |
/*------------------------------------------------------------------------ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2 |
* |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
3 |
* OpenVG 1.1 Reference Implementation |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
4 |
* ----------------------------------- |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
5 |
* |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
6 |
* Copyright (c) 2007 The Khronos Group Inc. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
7 |
* |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
8 |
* Permission is hereby granted, free of charge, to any person obtaining a |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
9 |
* copy of this software and /or associated documentation files |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
10 |
* (the "Materials "), to deal in the Materials without restriction, |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
11 |
* including without limitation the rights to use, copy, modify, merge, |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
12 |
* publish, distribute, sublicense, and/or sell copies of the Materials, |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
13 |
* and to permit persons to whom the Materials are furnished to do so, |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
14 |
* subject to the following conditions: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
15 |
* |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
16 |
* The above copyright notice and this permission notice shall be included |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
17 |
* in all copies or substantial portions of the Materials. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
18 |
* |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
19 |
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
20 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
21 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
22 |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
23 |
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
24 |
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
25 |
* THE USE OR OTHER DEALINGS IN THE MATERIALS. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
26 |
* |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
27 |
*//** |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
28 |
* \file |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
29 |
* \brief Implementation of Path functions. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
30 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
31 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
32 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
33 |
#include "riPath.h" |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
34 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
35 |
using namespace OpenVGRI; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
36 |
//============================================================================================== |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
37 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
38 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
39 |
//============================================================================================== |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
40 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
41 |
namespace OpenVGRI |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
42 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
43 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
44 |
RIfloat inputFloat(VGfloat f); //defined in riApi.cpp |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
45 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
46 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
47 |
* \brief Form a reliable normalized average of the two unit input vectors. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
48 |
* The average always lies to the given direction from the first |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
49 |
* vector. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
50 |
* \param u0, u1 Unit input vectors. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
51 |
* \param cw True if the average should be clockwise from u0, false if |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
52 |
* counterclockwise. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
53 |
* \return Average of the two input vectors. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
54 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
55 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
56 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
57 |
static const Vector2 unitAverage(const Vector2& u0, const Vector2& u1, bool cw) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
58 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
59 |
Vector2 u = 0.5f * (u0 + u1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
60 |
Vector2 n0 = perpendicularCCW(u0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
61 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
62 |
if( dot(u, u) > 0.25f ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
63 |
{ //the average is long enough and thus reliable |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
64 |
if( dot(n0, u1) < 0.0f ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
65 |
u = -u; //choose the larger angle |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
66 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
67 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
68 |
{ // the average is too short, use the average of the normals to the vectors instead |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
69 |
Vector2 n1 = perpendicularCW(u1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
70 |
u = 0.5f * (n0 + n1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
71 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
72 |
if( cw ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
73 |
u = -u; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
74 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
75 |
return normalize(u); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
76 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
77 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
78 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
79 |
* \brief Form a reliable normalized average of the two unit input vectors. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
80 |
* The average lies on the side where the angle between the input |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
81 |
* vectors is less than 180 degrees. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
82 |
* \param u0, u1 Unit input vectors. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
83 |
* \return Average of the two input vectors. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
84 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
85 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
86 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
87 |
static const Vector2 unitAverage(const Vector2& u0, const Vector2& u1) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
88 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
89 |
Vector2 u = 0.5f * (u0 + u1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
90 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
91 |
if( dot(u, u) < 0.25f ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
92 |
{ // the average is unreliable, use the average of the normals to the vectors instead |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
93 |
Vector2 n0 = perpendicularCCW(u0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
94 |
Vector2 n1 = perpendicularCW(u1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
95 |
u = 0.5f * (n0 + n1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
96 |
if( dot(n1, u0) < 0.0f ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
97 |
u = -u; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
98 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
99 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
100 |
return normalize(u); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
101 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
102 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
103 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
104 |
* \brief Interpolate the given unit tangent vectors to the given |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
105 |
* direction on a unit circle. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
106 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
107 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
108 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
109 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
110 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
111 |
static const Vector2 circularLerp(const Vector2& t0, const Vector2& t1, RIfloat ratio, bool cw) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
112 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
113 |
Vector2 u0 = t0, u1 = t1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
114 |
RIfloat l0 = 0.0f, l1 = 1.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
115 |
for(int i=0;i<18;i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
116 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
117 |
Vector2 n = unitAverage(u0, u1, cw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
118 |
RIfloat l = 0.5f * (l0 + l1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
119 |
if( ratio < l ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
120 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
121 |
u1 = n; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
122 |
l1 = l; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
123 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
124 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
125 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
126 |
u0 = n; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
127 |
l0 = l; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
128 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
129 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
130 |
return u0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
131 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
132 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
133 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
134 |
* \brief Interpolate the given unit tangent vectors on a unit circle. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
135 |
* Smaller angle between the vectors is used. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
136 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
137 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
138 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
139 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
140 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
141 |
static const Vector2 circularLerp(const Vector2& t0, const Vector2& t1, RIfloat ratio) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
142 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
143 |
Vector2 u0 = t0, u1 = t1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
144 |
RIfloat l0 = 0.0f, l1 = 1.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
145 |
for(int i=0;i<18;i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
146 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
147 |
Vector2 n = unitAverage(u0, u1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
148 |
RIfloat l = 0.5f * (l0 + l1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
149 |
if( ratio < l ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
150 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
151 |
u1 = n; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
152 |
l1 = l; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
153 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
154 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
155 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
156 |
u0 = n; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
157 |
l0 = l; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
158 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
159 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
160 |
return u0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
161 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
162 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
163 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
164 |
* \brief Path constructor. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
165 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
166 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
167 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
168 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
169 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
170 |
Path::Path(VGint format, VGPathDatatype datatype, RIfloat scale, RIfloat bias, int segmentCapacityHint, int coordCapacityHint, VGbitfield caps) : |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
171 |
m_format(format), |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
172 |
m_datatype(datatype), |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
173 |
m_scale(scale), |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
174 |
m_bias(bias), |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
175 |
m_capabilities(caps), |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
176 |
m_referenceCount(0), |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
177 |
m_segments(), |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
178 |
m_data(), |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
179 |
m_vertices(), |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
180 |
m_segmentToVertex(), |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
181 |
m_userMinx(0.0f), |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
182 |
m_userMiny(0.0f), |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
183 |
m_userMaxx(0.0f), |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
184 |
m_userMaxy(0.0f) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
185 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
186 |
RI_ASSERT(format == VG_PATH_FORMAT_STANDARD); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
187 |
RI_ASSERT(datatype >= VG_PATH_DATATYPE_S_8 && datatype <= VG_PATH_DATATYPE_F); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
188 |
if(segmentCapacityHint > 0) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
189 |
m_segments.reserve(RI_INT_MIN(segmentCapacityHint, 65536)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
190 |
if(coordCapacityHint > 0) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
191 |
m_data.reserve(RI_INT_MIN(coordCapacityHint, 65536) * getBytesPerCoordinate(datatype)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
192 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
193 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
194 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
195 |
* \brief Path destructor. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
196 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
197 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
198 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
199 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
200 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
201 |
Path::~Path() |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
202 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
203 |
RI_ASSERT(m_referenceCount == 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
204 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
205 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
206 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
207 |
* \brief Reads a coordinate and applies scale and bias. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
208 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
209 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
210 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
211 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
212 |
RIfloat Path::getCoordinate(int i) const |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
213 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
214 |
RI_ASSERT(i >= 0 && i < m_data.size() / getBytesPerCoordinate(m_datatype)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
215 |
RI_ASSERT(m_scale != 0.0f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
216 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
217 |
const RIuint8* ptr = &m_data[0]; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
218 |
switch(m_datatype) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
219 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
220 |
case VG_PATH_DATATYPE_S_8: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
221 |
return (RIfloat)(((const RIint8*)ptr)[i]) * m_scale + m_bias; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
222 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
223 |
case VG_PATH_DATATYPE_S_16: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
224 |
return (RIfloat)(((const RIint16*)ptr)[i]) * m_scale + m_bias; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
225 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
226 |
case VG_PATH_DATATYPE_S_32: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
227 |
return (RIfloat)(((const RIint32*)ptr)[i]) * m_scale + m_bias; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
228 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
229 |
default: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
230 |
RI_ASSERT(m_datatype == VG_PATH_DATATYPE_F); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
231 |
return (RIfloat)(((const RIfloat32*)ptr)[i]) * m_scale + m_bias; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
232 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
233 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
234 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
235 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
236 |
* \brief Writes a coordinate, subtracting bias and dividing out scale. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
237 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
238 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
239 |
* \note If the coordinates do not fit into path datatype range, they |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
240 |
* will overflow silently. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
241 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
242 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
243 |
void Path::setCoordinate(Array<RIuint8>& data, VGPathDatatype datatype, RIfloat scale, RIfloat bias, int i, RIfloat c) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
244 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
245 |
RI_ASSERT(i >= 0 && i < data.size()/getBytesPerCoordinate(datatype)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
246 |
RI_ASSERT(scale != 0.0f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
247 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
248 |
c -= bias; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
249 |
c /= scale; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
250 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
251 |
RIuint8* ptr = &data[0]; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
252 |
switch(datatype) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
253 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
254 |
case VG_PATH_DATATYPE_S_8: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
255 |
((RIint8*)ptr)[i] = (RIint8)floor(c + 0.5f); //add 0.5 for correct rounding |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
256 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
257 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
258 |
case VG_PATH_DATATYPE_S_16: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
259 |
((RIint16*)ptr)[i] = (RIint16)floor(c + 0.5f); //add 0.5 for correct rounding |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
260 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
261 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
262 |
case VG_PATH_DATATYPE_S_32: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
263 |
((RIint32*)ptr)[i] = (RIint32)floor(c + 0.5f); //add 0.5 for correct rounding |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
264 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
265 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
266 |
default: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
267 |
RI_ASSERT(datatype == VG_PATH_DATATYPE_F); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
268 |
((RIfloat32*)ptr)[i] = (RIfloat32)c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
269 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
270 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
271 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
272 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
273 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
274 |
* \brief Given a datatype, returns the number of bytes per coordinate. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
275 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
276 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
277 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
278 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
279 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
280 |
int Path::getBytesPerCoordinate(VGPathDatatype datatype) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
281 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
282 |
if(datatype == VG_PATH_DATATYPE_S_8) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
283 |
return 1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
284 |
if(datatype == VG_PATH_DATATYPE_S_16) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
285 |
return 2; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
286 |
RI_ASSERT(datatype == VG_PATH_DATATYPE_S_32 || datatype == VG_PATH_DATATYPE_F); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
287 |
return 4; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
288 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
289 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
290 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
291 |
* \brief Given a path segment type, returns the number of coordinates |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
292 |
* it uses. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
293 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
294 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
295 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
296 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
297 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
298 |
int Path::segmentToNumCoordinates(VGPathSegment segment) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
299 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
300 |
RI_ASSERT(((int)segment >> 1) >= 0 && ((int)segment >> 1) <= 12); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
301 |
static const int coords[13] = {0,2,2,1,1,4,6,2,4,5,5,5,5}; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
302 |
return coords[(int)segment >> 1]; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
303 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
304 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
305 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
306 |
* \brief Computes the number of coordinates a segment sequence uses. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
307 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
308 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
309 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
310 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
311 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
312 |
int Path::countNumCoordinates(const RIuint8* segments, int numSegments) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
313 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
314 |
RI_ASSERT(segments); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
315 |
RI_ASSERT(numSegments >= 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
316 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
317 |
int coordinates = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
318 |
for(int i=0;i<numSegments;i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
319 |
coordinates += segmentToNumCoordinates(getPathSegment(segments[i])); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
320 |
return coordinates; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
321 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
322 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
323 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
324 |
* \brief Clears path segments and data, and resets capabilities. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
325 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
326 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
327 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
328 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
329 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
330 |
void Path::clear(VGbitfield capabilities) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
331 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
332 |
m_segments.clear(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
333 |
m_data.clear(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
334 |
m_capabilities = capabilities; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
335 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
336 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
337 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
338 |
* \brief Appends user segments and data. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
339 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
340 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
341 |
* \note if runs out of memory, throws bad_alloc and leaves the path as it was |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
342 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
343 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
344 |
void Path::appendData(const RIuint8* segments, int numSegments, const RIuint8* data) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
345 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
346 |
RI_ASSERT(numSegments > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
347 |
RI_ASSERT(segments && data); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
348 |
RI_ASSERT(m_referenceCount > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
349 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
350 |
//allocate new arrays |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
351 |
int oldSegmentsSize = m_segments.size(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
352 |
int newSegmentsSize = oldSegmentsSize + numSegments; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
353 |
Array<RIuint8> newSegments; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
354 |
newSegments.resize(newSegmentsSize); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
355 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
356 |
int newCoords = countNumCoordinates(segments, numSegments); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
357 |
int bytesPerCoordinate = getBytesPerCoordinate(m_datatype); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
358 |
int newDataSize = m_data.size() + newCoords * bytesPerCoordinate; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
359 |
Array<RIuint8> newData; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
360 |
newData.resize(newDataSize); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
361 |
//if we get here, the memory allocations have succeeded |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
362 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
363 |
//copy old segments and append new ones |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
364 |
if(m_segments.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
365 |
memcpy(&newSegments[0], &m_segments[0], m_segments.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
366 |
memcpy(&newSegments[0] + m_segments.size(), segments, numSegments); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
367 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
368 |
//copy old data and append new ones |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
369 |
if(newData.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
370 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
371 |
if(m_data.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
372 |
memcpy(&newData[0], &m_data[0], m_data.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
373 |
if(m_datatype == VG_PATH_DATATYPE_F) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
374 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
375 |
RIfloat32* d = (RIfloat32*)(&newData[0] + m_data.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
376 |
const RIfloat32* s = (const RIfloat32*)data; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
377 |
for(int i=0;i<newCoords;i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
378 |
*d++ = (RIfloat32)inputFloat(*s++); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
379 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
380 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
381 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
382 |
memcpy(&newData[0] + m_data.size(), data, newCoords * bytesPerCoordinate); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
383 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
384 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
385 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
386 |
RI_ASSERT(newData.size() == countNumCoordinates(&newSegments[0],newSegments.size()) * getBytesPerCoordinate(m_datatype)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
387 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
388 |
//replace old arrays |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
389 |
m_segments.swap(newSegments); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
390 |
m_data.swap(newData); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
391 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
392 |
int c = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
393 |
for(int i=0;i<m_segments.size();i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
394 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
395 |
VGPathSegment segment = getPathSegment(m_segments[i]); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
396 |
int coords = segmentToNumCoordinates(segment); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
397 |
c += coords; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
398 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
399 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
400 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
401 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
402 |
* \brief Appends a path. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
403 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
404 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
405 |
* \note if runs out of memory, throws bad_alloc and leaves the path as it was |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
406 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
407 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
408 |
void Path::append(const Path* srcPath) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
409 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
410 |
RI_ASSERT(srcPath); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
411 |
RI_ASSERT(m_referenceCount > 0 && srcPath->m_referenceCount > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
412 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
413 |
if(srcPath->m_segments.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
414 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
415 |
//allocate new arrays |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
416 |
int newSegmentsSize = m_segments.size() + srcPath->m_segments.size(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
417 |
Array<RIuint8> newSegments; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
418 |
newSegments.resize(newSegmentsSize); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
419 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
420 |
int newDataSize = m_data.size() + srcPath->getNumCoordinates() * getBytesPerCoordinate(m_datatype); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
421 |
Array<RIuint8> newData; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
422 |
newData.resize(newDataSize); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
423 |
//if we get here, the memory allocations have succeeded |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
424 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
425 |
//copy old segments and append new ones |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
426 |
if(m_segments.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
427 |
memcpy(&newSegments[0], &m_segments[0], m_segments.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
428 |
if(srcPath->m_segments.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
429 |
memcpy(&newSegments[0] + m_segments.size(), &srcPath->m_segments[0], srcPath->m_segments.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
430 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
431 |
//copy old data and append new ones |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
432 |
if(m_data.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
433 |
memcpy(&newData[0], &m_data[0], m_data.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
434 |
for(int i=0;i<srcPath->getNumCoordinates();i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
435 |
setCoordinate(newData, m_datatype, m_scale, m_bias, i + getNumCoordinates(), srcPath->getCoordinate(i)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
436 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
437 |
RI_ASSERT(newData.size() == countNumCoordinates(&newSegments[0],newSegments.size()) * getBytesPerCoordinate(m_datatype)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
438 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
439 |
//replace old arrays |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
440 |
m_segments.swap(newSegments); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
441 |
m_data.swap(newData); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
442 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
443 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
444 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
445 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
446 |
* \brief Modifies existing coordinate data. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
447 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
448 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
449 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
450 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
451 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
452 |
void Path::modifyCoords(int startIndex, int numSegments, const RIuint8* data) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
453 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
454 |
RI_ASSERT(numSegments > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
455 |
RI_ASSERT(startIndex >= 0 && startIndex + numSegments <= m_segments.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
456 |
RI_ASSERT(data); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
457 |
RI_ASSERT(m_referenceCount > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
458 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
459 |
int startCoord = countNumCoordinates(&m_segments[0], startIndex); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
460 |
int numCoords = countNumCoordinates(&m_segments[startIndex], numSegments); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
461 |
if(!numCoords) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
462 |
return; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
463 |
int bytesPerCoordinate = getBytesPerCoordinate(m_datatype); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
464 |
RIuint8* dst = &m_data[startCoord * bytesPerCoordinate]; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
465 |
if(m_datatype == VG_PATH_DATATYPE_F) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
466 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
467 |
RIfloat32* d = (RIfloat32*)dst; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
468 |
const RIfloat32* s = (const RIfloat32*)data; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
469 |
for(int i=0;i<numCoords;i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
470 |
*d++ = (RIfloat32)inputFloat(*s++); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
471 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
472 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
473 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
474 |
memcpy(dst, data, numCoords*bytesPerCoordinate); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
475 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
476 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
477 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
478 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
479 |
* \brief Appends a transformed copy of the source path. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
480 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
481 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
482 |
* \note if runs out of memory, throws bad_alloc and leaves the path as it was |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
483 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
484 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
485 |
void Path::transform(const Path* srcPath, const Matrix3x3& matrix) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
486 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
487 |
RI_ASSERT(srcPath); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
488 |
RI_ASSERT(m_referenceCount > 0 && srcPath->m_referenceCount > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
489 |
RI_ASSERT(matrix.isAffine()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
490 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
491 |
if(!srcPath->m_segments.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
492 |
return; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
493 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
494 |
//count the number of resulting coordinates |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
495 |
int numSrcCoords = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
496 |
int numDstCoords = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
497 |
for(int i=0;i<srcPath->m_segments.size();i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
498 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
499 |
VGPathSegment segment = getPathSegment(srcPath->m_segments[i]); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
500 |
int coords = segmentToNumCoordinates(segment); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
501 |
numSrcCoords += coords; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
502 |
if(segment == VG_HLINE_TO || segment == VG_VLINE_TO) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
503 |
coords = 2; //convert hline and vline to lines |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
504 |
numDstCoords += coords; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
505 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
506 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
507 |
//allocate new arrays |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
508 |
Array<RIuint8> newSegments; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
509 |
newSegments.resize(m_segments.size() + srcPath->m_segments.size()); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
510 |
Array<RIuint8> newData; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
511 |
newData.resize(m_data.size() + numDstCoords * getBytesPerCoordinate(m_datatype)); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
512 |
//if we get here, the memory allocations have succeeded |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
513 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
514 |
//copy old segments |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
515 |
if(m_segments.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
516 |
memcpy(&newSegments[0], &m_segments[0], m_segments.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
517 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
518 |
//copy old data |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
519 |
if(m_data.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
520 |
memcpy(&newData[0], &m_data[0], m_data.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
521 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
522 |
int srcCoord = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
523 |
int dstCoord = getNumCoordinates(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
524 |
Vector2 s(0,0); //the beginning of the current subpath |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
525 |
Vector2 o(0,0); //the last point of the previous segment |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
526 |
for(int i=0;i<srcPath->m_segments.size();i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
527 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
528 |
VGPathSegment segment = getPathSegment(srcPath->m_segments[i]); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
529 |
VGPathAbsRel absRel = getPathAbsRel(srcPath->m_segments[i]); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
530 |
int coords = segmentToNumCoordinates(segment); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
531 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
532 |
switch(segment) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
533 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
534 |
case VG_CLOSE_PATH: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
535 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
536 |
RI_ASSERT(coords == 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
537 |
o = s; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
538 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
539 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
540 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
541 |
case VG_MOVE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
542 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
543 |
RI_ASSERT(coords == 2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
544 |
Vector2 c(srcPath->getCoordinate(srcCoord+0), srcPath->getCoordinate(srcCoord+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
545 |
Vector2 tc; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
546 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
547 |
if (absRel == VG_ABSOLUTE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
548 |
tc = affineTransform(matrix, c); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
549 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
550 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
551 |
tc = affineTangentTransform(matrix, c); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
552 |
c += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
553 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
554 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
555 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
556 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
557 |
s = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
558 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
559 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
560 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
561 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
562 |
case VG_LINE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
563 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
564 |
RI_ASSERT(coords == 2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
565 |
Vector2 c(srcPath->getCoordinate(srcCoord+0), srcPath->getCoordinate(srcCoord+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
566 |
Vector2 tc; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
567 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
568 |
if (absRel == VG_ABSOLUTE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
569 |
tc = affineTransform(matrix, c); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
570 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
571 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
572 |
tc = affineTangentTransform(matrix, c); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
573 |
c += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
574 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
575 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
576 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
577 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
578 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
579 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
580 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
581 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
582 |
case VG_HLINE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
583 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
584 |
RI_ASSERT(coords == 1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
585 |
Vector2 c(srcPath->getCoordinate(srcCoord+0), 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
586 |
Vector2 tc; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
587 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
588 |
if (absRel == VG_ABSOLUTE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
589 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
590 |
c.y = o.y; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
591 |
tc = affineTransform(matrix, c); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
592 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
593 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
594 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
595 |
tc = affineTangentTransform(matrix, c); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
596 |
c += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
597 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
598 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
599 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
600 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
601 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
602 |
segment = VG_LINE_TO; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
603 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
604 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
605 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
606 |
case VG_VLINE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
607 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
608 |
RI_ASSERT(coords == 1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
609 |
Vector2 c(0, srcPath->getCoordinate(srcCoord+0)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
610 |
Vector2 tc; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
611 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
612 |
if (absRel == VG_ABSOLUTE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
613 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
614 |
c.x = o.x; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
615 |
tc = affineTransform(matrix, c); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
616 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
617 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
618 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
619 |
tc = affineTangentTransform(matrix, c); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
620 |
c += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
621 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
622 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
623 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
624 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
625 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
626 |
segment = VG_LINE_TO; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
627 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
628 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
629 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
630 |
case VG_QUAD_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
631 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
632 |
RI_ASSERT(coords == 4); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
633 |
Vector2 c0(srcPath->getCoordinate(srcCoord+0), srcPath->getCoordinate(srcCoord+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
634 |
Vector2 c1(srcPath->getCoordinate(srcCoord+2), srcPath->getCoordinate(srcCoord+3)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
635 |
Vector2 tc0, tc1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
636 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
637 |
if (absRel == VG_ABSOLUTE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
638 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
639 |
tc0 = affineTransform(matrix, c0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
640 |
tc1 = affineTransform(matrix, c1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
641 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
642 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
643 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
644 |
tc0 = affineTangentTransform(matrix, c0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
645 |
tc1 = affineTangentTransform(matrix, c1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
646 |
c1 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
647 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
648 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
649 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc0.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
650 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc0.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
651 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc1.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
652 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc1.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
653 |
o = c1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
654 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
655 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
656 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
657 |
case VG_CUBIC_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
658 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
659 |
RI_ASSERT(coords == 6); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
660 |
Vector2 c0(srcPath->getCoordinate(srcCoord+0), srcPath->getCoordinate(srcCoord+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
661 |
Vector2 c1(srcPath->getCoordinate(srcCoord+2), srcPath->getCoordinate(srcCoord+3)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
662 |
Vector2 c2(srcPath->getCoordinate(srcCoord+4), srcPath->getCoordinate(srcCoord+5)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
663 |
Vector2 tc0, tc1, tc2; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
664 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
665 |
if (absRel == VG_ABSOLUTE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
666 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
667 |
tc0 = affineTransform(matrix, c0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
668 |
tc1 = affineTransform(matrix, c1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
669 |
tc2 = affineTransform(matrix, c2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
670 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
671 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
672 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
673 |
tc0 = affineTangentTransform(matrix, c0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
674 |
tc1 = affineTangentTransform(matrix, c1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
675 |
tc2 = affineTangentTransform(matrix, c2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
676 |
c2 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
677 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
678 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
679 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc0.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
680 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc0.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
681 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc1.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
682 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc1.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
683 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc2.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
684 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc2.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
685 |
o = c2; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
686 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
687 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
688 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
689 |
case VG_SQUAD_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
690 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
691 |
RI_ASSERT(coords == 2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
692 |
Vector2 c1(srcPath->getCoordinate(srcCoord+0), srcPath->getCoordinate(srcCoord+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
693 |
Vector2 tc1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
694 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
695 |
if (absRel == VG_ABSOLUTE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
696 |
tc1 = affineTransform(matrix, c1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
697 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
698 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
699 |
tc1 = affineTangentTransform(matrix, c1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
700 |
c1 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
701 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
702 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
703 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc1.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
704 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc1.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
705 |
o = c1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
706 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
707 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
708 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
709 |
case VG_SCUBIC_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
710 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
711 |
RI_ASSERT(coords == 4); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
712 |
Vector2 c1(srcPath->getCoordinate(srcCoord+0), srcPath->getCoordinate(srcCoord+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
713 |
Vector2 c2(srcPath->getCoordinate(srcCoord+2), srcPath->getCoordinate(srcCoord+3)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
714 |
Vector2 tc1, tc2; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
715 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
716 |
if (absRel == VG_ABSOLUTE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
717 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
718 |
tc1 = affineTransform(matrix, c1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
719 |
tc2 = affineTransform(matrix, c2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
720 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
721 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
722 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
723 |
tc1 = affineTangentTransform(matrix, c1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
724 |
tc2 = affineTangentTransform(matrix, c2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
725 |
c2 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
726 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
727 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
728 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc1.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
729 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc1.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
730 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc2.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
731 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc2.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
732 |
o = c2; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
733 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
734 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
735 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
736 |
default: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
737 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
738 |
RI_ASSERT(segment == VG_SCCWARC_TO || segment == VG_SCWARC_TO || |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
739 |
segment == VG_LCCWARC_TO || segment == VG_LCWARC_TO); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
740 |
RI_ASSERT(coords == 5); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
741 |
RIfloat rh = srcPath->getCoordinate(srcCoord+0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
742 |
RIfloat rv = srcPath->getCoordinate(srcCoord+1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
743 |
RIfloat rot = srcPath->getCoordinate(srcCoord+2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
744 |
Vector2 c(srcPath->getCoordinate(srcCoord+3), srcPath->getCoordinate(srcCoord+4)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
745 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
746 |
rot = RI_DEG_TO_RAD(rot); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
747 |
Matrix3x3 u((RIfloat)cos(rot)*rh, -(RIfloat)sin(rot)*rv, 0, |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
748 |
(RIfloat)sin(rot)*rh, (RIfloat)cos(rot)*rv, 0, |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
749 |
0, 0, 1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
750 |
u = matrix * u; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
751 |
u[2].set(0,0,1); //force affinity |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
752 |
//u maps from the unit circle to transformed ellipse |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
753 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
754 |
//compute new rh, rv and rot |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
755 |
Vector2 p(u[0][0], u[1][0]); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
756 |
Vector2 q(u[1][1], -u[0][1]); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
757 |
bool swapped = false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
758 |
if(dot(p,p) < dot(q,q)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
759 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
760 |
RI_SWAP(p.x,q.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
761 |
RI_SWAP(p.y,q.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
762 |
swapped = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
763 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
764 |
Vector2 h = (p+q) * 0.5f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
765 |
Vector2 hp = (p-q) * 0.5f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
766 |
RIfloat hlen = h.length(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
767 |
RIfloat hplen = hp.length(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
768 |
rh = hlen + hplen; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
769 |
rv = hlen - hplen; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
770 |
h = hplen * h + hlen * hp; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
771 |
hlen = dot(h,h); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
772 |
if(hlen == 0.0f) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
773 |
rot = 0.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
774 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
775 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
776 |
h.normalize(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
777 |
rot = (RIfloat)acos(h.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
778 |
if(h.y < 0.0f) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
779 |
rot = 2.0f*PI - rot; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
780 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
781 |
if(swapped) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
782 |
rot += PI*0.5f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
783 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
784 |
Vector2 tc; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
785 |
if (absRel == VG_ABSOLUTE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
786 |
tc = affineTransform(matrix, c); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
787 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
788 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
789 |
tc = affineTangentTransform(matrix, c); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
790 |
c += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
791 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
792 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
793 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, rh); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
794 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, rv); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
795 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, RI_RAD_TO_DEG(rot)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
796 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
797 |
setCoordinate(newData, m_datatype, m_scale, m_bias, dstCoord++, tc.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
798 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
799 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
800 |
//flip winding if the determinant is negative |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
801 |
if (matrix.det() < 0) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
802 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
803 |
switch (segment) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
804 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
805 |
case VG_SCCWARC_TO: segment = VG_SCWARC_TO; break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
806 |
case VG_SCWARC_TO: segment = VG_SCCWARC_TO; break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
807 |
case VG_LCCWARC_TO: segment = VG_LCWARC_TO; break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
808 |
case VG_LCWARC_TO: segment = VG_LCCWARC_TO; break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
809 |
default: break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
810 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
811 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
812 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
813 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
814 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
815 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
816 |
newSegments[m_segments.size() + i] = (RIuint8)(segment | absRel); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
817 |
srcCoord += coords; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
818 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
819 |
RI_ASSERT(srcCoord == numSrcCoords); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
820 |
RI_ASSERT(dstCoord == getNumCoordinates() + numDstCoords); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
821 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
822 |
RI_ASSERT(newData.size() == countNumCoordinates(&newSegments[0],newSegments.size()) * getBytesPerCoordinate(m_datatype)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
823 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
824 |
//replace old arrays |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
825 |
m_segments.swap(newSegments); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
826 |
m_data.swap(newData); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
827 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
828 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
829 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
830 |
* \brief Normalizes a path for interpolation. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
831 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
832 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
833 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
834 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
835 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
836 |
void Path::normalizeForInterpolation(const Path* srcPath) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
837 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
838 |
RI_ASSERT(srcPath); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
839 |
RI_ASSERT(srcPath != this); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
840 |
RI_ASSERT(srcPath->m_referenceCount > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
841 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
842 |
//count the number of resulting coordinates |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
843 |
int numSrcCoords = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
844 |
int numDstCoords = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
845 |
for(int i=0;i<srcPath->m_segments.size();i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
846 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
847 |
VGPathSegment segment = getPathSegment(srcPath->m_segments[i]); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
848 |
int coords = segmentToNumCoordinates(segment); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
849 |
numSrcCoords += coords; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
850 |
switch(segment) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
851 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
852 |
case VG_CLOSE_PATH: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
853 |
case VG_MOVE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
854 |
case VG_LINE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
855 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
856 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
857 |
case VG_HLINE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
858 |
case VG_VLINE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
859 |
coords = 2; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
860 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
861 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
862 |
case VG_QUAD_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
863 |
case VG_CUBIC_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
864 |
case VG_SQUAD_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
865 |
case VG_SCUBIC_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
866 |
coords = 6; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
867 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
868 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
869 |
default: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
870 |
RI_ASSERT(segment == VG_SCCWARC_TO || segment == VG_SCWARC_TO || |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
871 |
segment == VG_LCCWARC_TO || segment == VG_LCWARC_TO); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
872 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
873 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
874 |
numDstCoords += coords; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
875 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
876 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
877 |
m_segments.resize(srcPath->m_segments.size()); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
878 |
m_data.resize(numDstCoords * getBytesPerCoordinate(VG_PATH_DATATYPE_F)); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
879 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
880 |
int srcCoord = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
881 |
int dstCoord = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
882 |
Vector2 s(0,0); //the beginning of the current subpath |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
883 |
Vector2 o(0,0); //the last point of the previous segment |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
884 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
885 |
// the last internal control point of the previous segment, if the |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
886 |
//segment was a (regular or smooth) quadratic or cubic |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
887 |
//Bezier, or else the last point of the previous segment |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
888 |
Vector2 p(0,0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
889 |
for(int i=0;i<srcPath->m_segments.size();i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
890 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
891 |
VGPathSegment segment = getPathSegment(srcPath->m_segments[i]); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
892 |
VGPathAbsRel absRel = getPathAbsRel(srcPath->m_segments[i]); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
893 |
int coords = segmentToNumCoordinates(segment); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
894 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
895 |
switch(segment) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
896 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
897 |
case VG_CLOSE_PATH: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
898 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
899 |
RI_ASSERT(coords == 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
900 |
p = s; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
901 |
o = s; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
902 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
903 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
904 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
905 |
case VG_MOVE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
906 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
907 |
RI_ASSERT(coords == 2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
908 |
Vector2 c(srcPath->getCoordinate(srcCoord+0), srcPath->getCoordinate(srcCoord+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
909 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
910 |
c += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
911 |
setCoordinate(dstCoord++, c.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
912 |
setCoordinate(dstCoord++, c.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
913 |
s = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
914 |
p = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
915 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
916 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
917 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
918 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
919 |
case VG_LINE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
920 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
921 |
RI_ASSERT(coords == 2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
922 |
Vector2 c(srcPath->getCoordinate(srcCoord+0), srcPath->getCoordinate(srcCoord+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
923 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
924 |
c += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
925 |
setCoordinate(dstCoord++, c.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
926 |
setCoordinate(dstCoord++, c.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
927 |
p = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
928 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
929 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
930 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
931 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
932 |
case VG_HLINE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
933 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
934 |
RI_ASSERT(coords == 1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
935 |
Vector2 c(srcPath->getCoordinate(srcCoord+0), o.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
936 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
937 |
c.x += o.x; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
938 |
setCoordinate(dstCoord++, c.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
939 |
setCoordinate(dstCoord++, c.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
940 |
p = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
941 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
942 |
segment = VG_LINE_TO; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
943 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
944 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
945 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
946 |
case VG_VLINE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
947 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
948 |
RI_ASSERT(coords == 1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
949 |
Vector2 c(o.x, srcPath->getCoordinate(srcCoord+0)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
950 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
951 |
c.y += o.y; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
952 |
setCoordinate(dstCoord++, c.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
953 |
setCoordinate(dstCoord++, c.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
954 |
p = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
955 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
956 |
segment = VG_LINE_TO; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
957 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
958 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
959 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
960 |
case VG_QUAD_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
961 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
962 |
RI_ASSERT(coords == 4); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
963 |
Vector2 c0(srcPath->getCoordinate(srcCoord+0), srcPath->getCoordinate(srcCoord+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
964 |
Vector2 c1(srcPath->getCoordinate(srcCoord+2), srcPath->getCoordinate(srcCoord+3)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
965 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
966 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
967 |
c0 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
968 |
c1 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
969 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
970 |
Vector2 d0 = (1.0f/3.0f) * (o + 2.0f * c0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
971 |
Vector2 d1 = (1.0f/3.0f) * (c1 + 2.0f * c0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
972 |
setCoordinate(dstCoord++, d0.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
973 |
setCoordinate(dstCoord++, d0.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
974 |
setCoordinate(dstCoord++, d1.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
975 |
setCoordinate(dstCoord++, d1.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
976 |
setCoordinate(dstCoord++, c1.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
977 |
setCoordinate(dstCoord++, c1.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
978 |
p = c0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
979 |
o = c1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
980 |
segment = VG_CUBIC_TO; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
981 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
982 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
983 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
984 |
case VG_CUBIC_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
985 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
986 |
RI_ASSERT(coords == 6); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
987 |
Vector2 c0(srcPath->getCoordinate(srcCoord+0), srcPath->getCoordinate(srcCoord+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
988 |
Vector2 c1(srcPath->getCoordinate(srcCoord+2), srcPath->getCoordinate(srcCoord+3)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
989 |
Vector2 c2(srcPath->getCoordinate(srcCoord+4), srcPath->getCoordinate(srcCoord+5)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
990 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
991 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
992 |
c0 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
993 |
c1 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
994 |
c2 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
995 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
996 |
setCoordinate(dstCoord++, c0.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
997 |
setCoordinate(dstCoord++, c0.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
998 |
setCoordinate(dstCoord++, c1.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
999 |
setCoordinate(dstCoord++, c1.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1000 |
setCoordinate(dstCoord++, c2.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1001 |
setCoordinate(dstCoord++, c2.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1002 |
p = c1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1003 |
o = c2; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1004 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1005 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1006 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1007 |
case VG_SQUAD_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1008 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1009 |
RI_ASSERT(coords == 2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1010 |
Vector2 c0 = 2.0f * o - p; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1011 |
Vector2 c1(srcPath->getCoordinate(srcCoord+0), srcPath->getCoordinate(srcCoord+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1012 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1013 |
c1 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1014 |
Vector2 d0 = (1.0f/3.0f) * (o + 2.0f * c0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1015 |
Vector2 d1 = (1.0f/3.0f) * (c1 + 2.0f * c0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1016 |
setCoordinate(dstCoord++, d0.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1017 |
setCoordinate(dstCoord++, d0.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1018 |
setCoordinate(dstCoord++, d1.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1019 |
setCoordinate(dstCoord++, d1.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1020 |
setCoordinate(dstCoord++, c1.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1021 |
setCoordinate(dstCoord++, c1.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1022 |
p = c0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1023 |
o = c1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1024 |
segment = VG_CUBIC_TO; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1025 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1026 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1027 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1028 |
case VG_SCUBIC_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1029 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1030 |
RI_ASSERT(coords == 4); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1031 |
Vector2 c0 = 2.0f * o - p; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1032 |
Vector2 c1(srcPath->getCoordinate(srcCoord+0), srcPath->getCoordinate(srcCoord+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1033 |
Vector2 c2(srcPath->getCoordinate(srcCoord+2), srcPath->getCoordinate(srcCoord+3)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1034 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1035 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1036 |
c1 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1037 |
c2 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1038 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1039 |
setCoordinate(dstCoord++, c0.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1040 |
setCoordinate(dstCoord++, c0.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1041 |
setCoordinate(dstCoord++, c1.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1042 |
setCoordinate(dstCoord++, c1.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1043 |
setCoordinate(dstCoord++, c2.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1044 |
setCoordinate(dstCoord++, c2.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1045 |
p = c1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1046 |
o = c2; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1047 |
segment = VG_CUBIC_TO; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1048 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1049 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1050 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1051 |
default: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1052 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1053 |
RI_ASSERT(segment == VG_SCCWARC_TO || segment == VG_SCWARC_TO || |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1054 |
segment == VG_LCCWARC_TO || segment == VG_LCWARC_TO); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1055 |
RI_ASSERT(coords == 5); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1056 |
RIfloat rh = srcPath->getCoordinate(srcCoord+0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1057 |
RIfloat rv = srcPath->getCoordinate(srcCoord+1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1058 |
RIfloat rot = srcPath->getCoordinate(srcCoord+2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1059 |
Vector2 c(srcPath->getCoordinate(srcCoord+3), srcPath->getCoordinate(srcCoord+4)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1060 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1061 |
c += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1062 |
setCoordinate(dstCoord++, rh); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1063 |
setCoordinate(dstCoord++, rv); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1064 |
setCoordinate(dstCoord++, rot); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1065 |
setCoordinate(dstCoord++, c.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1066 |
setCoordinate(dstCoord++, c.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1067 |
p = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1068 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1069 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1070 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1071 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1072 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1073 |
m_segments[i] = (RIuint8)(segment | VG_ABSOLUTE); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1074 |
srcCoord += coords; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1075 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1076 |
RI_ASSERT(srcCoord == numSrcCoords); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1077 |
RI_ASSERT(dstCoord == numDstCoords); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1078 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1079 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1080 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1081 |
* \brief Appends a linearly interpolated copy of the two source paths. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1082 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1083 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1084 |
* \note if runs out of memory, throws bad_alloc and leaves the path as it was |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1085 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1086 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1087 |
bool Path::interpolate(const Path* startPath, const Path* endPath, RIfloat amount) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1088 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1089 |
RI_ASSERT(startPath && endPath); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1090 |
RI_ASSERT(m_referenceCount > 0 && startPath->m_referenceCount > 0 && endPath->m_referenceCount > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1091 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1092 |
if(!startPath->m_segments.size() || startPath->m_segments.size() != endPath->m_segments.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1093 |
return false; //start and end paths are incompatible or zero length |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1094 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1095 |
Path start(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1096 |
start.normalizeForInterpolation(startPath); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1097 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1098 |
Path end(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1099 |
end.normalizeForInterpolation(endPath); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1100 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1101 |
//check that start and end paths are compatible |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1102 |
if(start.m_data.size() != end.m_data.size() || start.m_segments.size() != end.m_segments.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1103 |
return false; //start and end paths are incompatible |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1104 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1105 |
//allocate new arrays |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1106 |
Array<RIuint8> newSegments; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1107 |
newSegments.resize(m_segments.size() + start.m_segments.size()); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1108 |
Array<RIuint8> newData; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1109 |
newData.resize(m_data.size() + start.m_data.size() * getBytesPerCoordinate(m_datatype) / getBytesPerCoordinate(start.m_datatype)); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1110 |
//if we get here, the memory allocations have succeeded |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1111 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1112 |
//copy old segments |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1113 |
if(m_segments.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1114 |
memcpy(&newSegments[0], &m_segments[0], m_segments.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1115 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1116 |
//copy old data |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1117 |
if(m_data.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1118 |
memcpy(&newData[0], &m_data[0], m_data.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1119 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1120 |
//copy segments |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1121 |
for(int i=0;i<start.m_segments.size();i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1122 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1123 |
VGPathSegment s = getPathSegment(start.m_segments[i]); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1124 |
VGPathSegment e = getPathSegment(end.m_segments[i]); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1125 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1126 |
if(s == VG_SCCWARC_TO || s == VG_SCWARC_TO || s == VG_LCCWARC_TO || s == VG_LCWARC_TO) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1127 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1128 |
if(e != VG_SCCWARC_TO && e != VG_SCWARC_TO && e != VG_LCCWARC_TO && e != VG_LCWARC_TO) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1129 |
return false; //start and end paths are incompatible |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1130 |
if(amount < 0.5f) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1131 |
newSegments[m_segments.size() + i] = start.m_segments[i]; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1132 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1133 |
newSegments[m_segments.size() + i] = end.m_segments[i]; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1134 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1135 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1136 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1137 |
if(s != e) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1138 |
return false; //start and end paths are incompatible |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1139 |
newSegments[m_segments.size() + i] = start.m_segments[i]; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1140 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1141 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1142 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1143 |
//interpolate data |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1144 |
int oldNumCoords = getNumCoordinates(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1145 |
for(int i=0;i<start.getNumCoordinates();i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1146 |
setCoordinate(newData, m_datatype, m_scale, m_bias, oldNumCoords + i, start.getCoordinate(i) * (1.0f - amount) + end.getCoordinate(i) * amount); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1147 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1148 |
RI_ASSERT(newData.size() == countNumCoordinates(&newSegments[0],newSegments.size()) * getBytesPerCoordinate(m_datatype)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1149 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1150 |
//replace old arrays |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1151 |
m_segments.swap(newSegments); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1152 |
m_data.swap(newData); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1153 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1154 |
return true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1155 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1156 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1157 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1158 |
* \brief Tessellates a path for filling and appends resulting edges |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1159 |
* to a rasterizer. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1160 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1161 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1162 |
* \note if runs out of memory, throws bad_alloc and leaves the path as it was |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1163 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1164 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1165 |
void Path::fill(const Matrix3x3& pathToSurface, Rasterizer& rasterizer) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1166 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1167 |
RI_ASSERT(m_referenceCount > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1168 |
RI_ASSERT(pathToSurface.isAffine()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1169 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1170 |
tessellate(pathToSurface, 0.0f); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1171 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1172 |
try |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1173 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1174 |
Vector2 p0(0,0), p1(0,0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1175 |
for(int i=0;i<m_vertices.size();i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1176 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1177 |
p1 = affineTransform(pathToSurface, m_vertices[i].userPosition); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1178 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1179 |
if(!(m_vertices[i].flags & START_SEGMENT)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1180 |
{ //in the middle of a segment |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1181 |
rasterizer.addEdge(p0, p1); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1182 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1183 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1184 |
p0 = p1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1185 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1186 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1187 |
catch(std::bad_alloc) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1188 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1189 |
rasterizer.clear(); //remove the unfinished path |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1190 |
throw; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1191 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1192 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1193 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1194 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1195 |
* \brief Smoothly interpolates between two StrokeVertices. Positions |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1196 |
* are interpolated linearly, while tangents are interpolated |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1197 |
* on a unit circle. Stroking is implemented so that overlapping |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1198 |
* geometry doesnt cancel itself when filled with nonzero rule. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1199 |
* The resulting polygons are closed. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1200 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1201 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1202 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1203 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1204 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1205 |
void Path::interpolateStroke(const Matrix3x3& pathToSurface, Rasterizer& rasterizer, const StrokeVertex& v0, const StrokeVertex& v1, RIfloat strokeWidth) const |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1206 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1207 |
Vector2 pccw = affineTransform(pathToSurface, v0.ccw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1208 |
Vector2 pcw = affineTransform(pathToSurface, v0.cw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1209 |
Vector2 p = affineTransform(pathToSurface, v0.p); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1210 |
Vector2 endccw = affineTransform(pathToSurface, v1.ccw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1211 |
Vector2 endcw = affineTransform(pathToSurface, v1.cw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1212 |
Vector2 endp = affineTransform(pathToSurface, v1.p); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1213 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1214 |
const RIfloat tessellationAngle = 5.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1215 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1216 |
RIfloat angle = RI_RAD_TO_DEG((RIfloat)acos(RI_CLAMP(dot(v0.t, v1.t), -1.0f, 1.0f))) / tessellationAngle; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1217 |
int samples = RI_INT_MAX((int)ceil(angle), 1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1218 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1219 |
for(int j=0;j<samples-1;j++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1220 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1221 |
RIfloat t = (RIfloat)(j+1) / (RIfloat)samples; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1222 |
Vector2 position = v0.p * (1.0f - t) + v1.p * t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1223 |
Vector2 tangent = circularLerp(v0.t, v1.t, t); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1224 |
Vector2 normal = normalize(perpendicularCCW(tangent)) * strokeWidth * 0.5f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1225 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1226 |
Vector2 nccw = affineTransform(pathToSurface, position + normal); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1227 |
Vector2 ncw = affineTransform(pathToSurface, position - normal); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1228 |
Vector2 n = affineTransform(pathToSurface, position); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1229 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1230 |
rasterizer.clear(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1231 |
rasterizer.addEdge(p, pccw); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1232 |
rasterizer.addEdge(pccw, nccw); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1233 |
rasterizer.addEdge(nccw, n); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1234 |
rasterizer.addEdge(n, ncw); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1235 |
rasterizer.addEdge(ncw, pcw); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1236 |
rasterizer.addEdge(pcw, p); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1237 |
rasterizer.fill(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1238 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1239 |
pccw = nccw; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1240 |
pcw = ncw; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1241 |
p = n; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1242 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1243 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1244 |
//connect the last segment to the end coordinates |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1245 |
rasterizer.clear(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1246 |
rasterizer.addEdge(p, pccw); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1247 |
rasterizer.addEdge(pccw, endccw); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1248 |
rasterizer.addEdge(endccw, endp); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1249 |
rasterizer.addEdge(endp, endcw); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1250 |
rasterizer.addEdge(endcw, pcw); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1251 |
rasterizer.addEdge(pcw, p); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1252 |
rasterizer.fill(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1253 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1254 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1255 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1256 |
* \brief Generate edges for stroke caps. Resulting polygons are closed. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1257 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1258 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1259 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1260 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1261 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1262 |
void Path::doCap(const Matrix3x3& pathToSurface, Rasterizer& rasterizer, const StrokeVertex& v, RIfloat strokeWidth, VGCapStyle capStyle) const |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1263 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1264 |
Vector2 ccwt = affineTransform(pathToSurface, v.ccw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1265 |
Vector2 cwt = affineTransform(pathToSurface, v.cw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1266 |
Vector2 p = affineTransform(pathToSurface, v.p); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1267 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1268 |
rasterizer.clear(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1269 |
switch(capStyle) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1270 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1271 |
case VG_CAP_BUTT: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1272 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1273 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1274 |
case VG_CAP_ROUND: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1275 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1276 |
const RIfloat tessellationAngle = 5.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1277 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1278 |
RIfloat angle = 180.0f / tessellationAngle; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1279 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1280 |
int samples = (int)ceil(angle); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1281 |
RIfloat step = 1.0f / samples; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1282 |
RIfloat t = step; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1283 |
Vector2 u0 = normalize(v.ccw - v.p); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1284 |
Vector2 u1 = normalize(v.cw - v.p); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1285 |
Vector2 prev = ccwt; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1286 |
rasterizer.addEdge(p, ccwt); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1287 |
for(int j=1;j<samples;j++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1288 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1289 |
Vector2 next = v.p + circularLerp(u0, u1, t, true) * strokeWidth * 0.5f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1290 |
next = affineTransform(pathToSurface, next); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1291 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1292 |
rasterizer.addEdge(prev, next); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1293 |
prev = next; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1294 |
t += step; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1295 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1296 |
rasterizer.addEdge(prev, cwt); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1297 |
rasterizer.addEdge(cwt, p); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1298 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1299 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1300 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1301 |
default: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1302 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1303 |
RI_ASSERT(capStyle == VG_CAP_SQUARE); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1304 |
Vector2 t = v.t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1305 |
t.normalize(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1306 |
Vector2 ccws = affineTransform(pathToSurface, v.ccw + t * strokeWidth * 0.5f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1307 |
Vector2 cws = affineTransform(pathToSurface, v.cw + t * strokeWidth * 0.5f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1308 |
rasterizer.addEdge(p, ccwt); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1309 |
rasterizer.addEdge(ccwt, ccws); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1310 |
rasterizer.addEdge(ccws, cws); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1311 |
rasterizer.addEdge(cws, cwt); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1312 |
rasterizer.addEdge(cwt, p); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1313 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1314 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1315 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1316 |
rasterizer.fill(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1317 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1318 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1319 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1320 |
* \brief Generate edges for stroke joins. Resulting polygons are closed. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1321 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1322 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1323 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1324 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1325 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1326 |
void Path::doJoin(const Matrix3x3& pathToSurface, Rasterizer& rasterizer, const StrokeVertex& v0, const StrokeVertex& v1, RIfloat strokeWidth, VGJoinStyle joinStyle, RIfloat miterLimit) const |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1327 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1328 |
Vector2 ccw0t = affineTransform(pathToSurface, v0.ccw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1329 |
Vector2 cw0t = affineTransform(pathToSurface, v0.cw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1330 |
Vector2 m0t = affineTransform(pathToSurface, v0.p); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1331 |
Vector2 ccw1t = affineTransform(pathToSurface, v1.ccw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1332 |
Vector2 cw1t = affineTransform(pathToSurface, v1.cw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1333 |
Vector2 m1t = affineTransform(pathToSurface, v1.p); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1334 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1335 |
Vector2 tccw = v1.ccw - v0.ccw; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1336 |
Vector2 s, e, m, st, et; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1337 |
bool cw; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1338 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1339 |
rasterizer.clear(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1340 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1341 |
if( dot(tccw, v0.t) > 0.0f ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1342 |
{ //draw ccw miter (draw from point 0 to 1) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1343 |
s = ccw0t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1344 |
e = ccw1t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1345 |
st = v0.t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1346 |
et = v1.t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1347 |
m = v0.ccw; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1348 |
cw = false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1349 |
rasterizer.addEdge(m0t, ccw0t); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1350 |
rasterizer.addEdge(ccw1t, m1t); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1351 |
rasterizer.addEdge(m1t, m0t); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1352 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1353 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1354 |
{ //draw cw miter (draw from point 1 to 0) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1355 |
s = cw1t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1356 |
e = cw0t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1357 |
st = v1.t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1358 |
et = v0.t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1359 |
m = v0.cw; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1360 |
cw = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1361 |
rasterizer.addEdge(cw0t, m0t); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1362 |
rasterizer.addEdge(m1t, cw1t); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1363 |
rasterizer.addEdge(m0t, m1t); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1364 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1365 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1366 |
switch(joinStyle) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1367 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1368 |
case VG_JOIN_MITER: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1369 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1370 |
RIfloat theta = (RIfloat)acos(RI_CLAMP(dot(v0.t, -v1.t), -1.0f, 1.0f)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1371 |
RIfloat miterLengthPerStrokeWidth = 1.0f / (RIfloat)sin(theta*0.5f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1372 |
if( miterLengthPerStrokeWidth < miterLimit ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1373 |
{ //miter |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1374 |
RIfloat l = (RIfloat)cos(theta*0.5f) * miterLengthPerStrokeWidth * (strokeWidth * 0.5f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1375 |
l = RI_MIN(l, RI_FLOAT_MAX); //force finite |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1376 |
Vector2 c = m + v0.t * l; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1377 |
c = affineTransform(pathToSurface, c); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1378 |
rasterizer.addEdge(s, c); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1379 |
rasterizer.addEdge(c, e); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1380 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1381 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1382 |
{ //bevel |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1383 |
rasterizer.addEdge(s, e); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1384 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1385 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1386 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1387 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1388 |
case VG_JOIN_ROUND: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1389 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1390 |
const RIfloat tessellationAngle = 5.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1391 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1392 |
Vector2 prev = s; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1393 |
RIfloat angle = RI_RAD_TO_DEG((RIfloat)acos(RI_CLAMP(dot(st, et), -1.0f, 1.0f))) / tessellationAngle; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1394 |
int samples = (int)ceil(angle); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1395 |
if( samples ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1396 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1397 |
RIfloat step = 1.0f / samples; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1398 |
RIfloat t = step; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1399 |
for(int j=1;j<samples;j++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1400 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1401 |
Vector2 position = v0.p * (1.0f - t) + v1.p * t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1402 |
Vector2 tangent = circularLerp(st, et, t, true); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1403 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1404 |
Vector2 next = position + normalize(perpendicular(tangent, cw)) * strokeWidth * 0.5f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1405 |
next = affineTransform(pathToSurface, next); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1406 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1407 |
rasterizer.addEdge(prev, next); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1408 |
prev = next; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1409 |
t += step; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1410 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1411 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1412 |
rasterizer.addEdge(prev, e); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1413 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1414 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1415 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1416 |
default: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1417 |
RI_ASSERT(joinStyle == VG_JOIN_BEVEL); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1418 |
if(!cw) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1419 |
rasterizer.addEdge(ccw0t, ccw1t); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1420 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1421 |
rasterizer.addEdge(cw1t, cw0t); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1422 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1423 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1424 |
rasterizer.fill(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1425 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1426 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1427 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1428 |
* \brief Tessellate a path, apply stroking, dashing, caps and joins, and |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1429 |
* append resulting edges to a rasterizer. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1430 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1431 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1432 |
* \note if runs out of memory, throws bad_alloc and leaves the path as it was |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1433 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1434 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1435 |
void Path::stroke(const Matrix3x3& pathToSurface, Rasterizer& rasterizer, const Array<RIfloat>& dashPattern, RIfloat dashPhase, bool dashPhaseReset, RIfloat strokeWidth, VGCapStyle capStyle, VGJoinStyle joinStyle, RIfloat miterLimit) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1436 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1437 |
RI_ASSERT(pathToSurface.isAffine()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1438 |
RI_ASSERT(m_referenceCount > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1439 |
RI_ASSERT(strokeWidth >= 0.0f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1440 |
RI_ASSERT(miterLimit >= 1.0f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1441 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1442 |
tessellate(pathToSurface, strokeWidth); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1443 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1444 |
if(!m_vertices.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1445 |
return; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1446 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1447 |
bool dashing = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1448 |
int dashPatternSize = dashPattern.size(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1449 |
if( dashPattern.size() & 1 ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1450 |
dashPatternSize--; //odd number of dash pattern entries, discard the last one |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1451 |
RIfloat dashPatternLength = 0.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1452 |
for(int i=0;i<dashPatternSize;i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1453 |
dashPatternLength += RI_MAX(dashPattern[i], 0.0f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1454 |
if(!dashPatternSize || dashPatternLength == 0.0f ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1455 |
dashing = false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1456 |
dashPatternLength = RI_MIN(dashPatternLength, RI_FLOAT_MAX); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1457 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1458 |
//walk along the path |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1459 |
//stop at the next event which is either: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1460 |
//-path vertex |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1461 |
//-dash stop |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1462 |
//for robustness, decisions based on geometry are done only once. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1463 |
//inDash keeps track whether the last point was in dash or not |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1464 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1465 |
//loop vertex events |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1466 |
try |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1467 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1468 |
RIfloat nextDash = 0.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1469 |
int d = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1470 |
bool inDash = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1471 |
StrokeVertex v0, v1, vs; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1472 |
for(int i=0;i<m_vertices.size();i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1473 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1474 |
//read the next vertex |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1475 |
Vertex& v = m_vertices[i]; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1476 |
v1.p = v.userPosition; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1477 |
v1.t = v.userTangent; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1478 |
RI_ASSERT(!isZero(v1.t)); //don't allow zero tangents |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1479 |
v1.ccw = v1.p + normalize(perpendicularCCW(v1.t)) * strokeWidth * 0.5f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1480 |
v1.cw = v1.p + normalize(perpendicularCW(v1.t)) * strokeWidth * 0.5f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1481 |
v1.pathLength = v.pathLength; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1482 |
v1.flags = v.flags; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1483 |
v1.inDash = dashing ? inDash : true; //NOTE: for other than START_SEGMENT vertices inDash will be updated after dashing |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1484 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1485 |
//process the vertex event |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1486 |
if(v.flags & START_SEGMENT) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1487 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1488 |
if(v.flags & START_SUBPATH) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1489 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1490 |
if( dashing ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1491 |
{ //initialize dashing by finding which dash or gap the first point of the path lies in |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1492 |
if(dashPhaseReset || i == 0) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1493 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1494 |
d = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1495 |
inDash = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1496 |
nextDash = v1.pathLength - RI_MOD(dashPhase, dashPatternLength); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1497 |
for(;;) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1498 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1499 |
RIfloat prevDash = nextDash; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1500 |
nextDash = prevDash + RI_MAX(dashPattern[d], 0.0f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1501 |
if(nextDash >= v1.pathLength) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1502 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1503 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1504 |
if( d & 1 ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1505 |
inDash = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1506 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1507 |
inDash = false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1508 |
d = (d+1) % dashPatternSize; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1509 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1510 |
v1.inDash = inDash; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1511 |
//the first point of the path lies between prevDash and nextDash |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1512 |
//d in the index of the next dash stop |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1513 |
//inDash is true if the first point is in a dash |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1514 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1515 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1516 |
vs = v1; //save the subpath start point |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1517 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1518 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1519 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1520 |
if( v.flags & IMPLICIT_CLOSE_SUBPATH ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1521 |
{ //do caps for the start and end of the current subpath |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1522 |
if( v0.inDash ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1523 |
doCap(pathToSurface, rasterizer, v0, strokeWidth, capStyle); //end cap //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1524 |
if( vs.inDash ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1525 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1526 |
StrokeVertex vi = vs; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1527 |
vi.t = -vi.t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1528 |
RI_SWAP(vi.ccw.x, vi.cw.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1529 |
RI_SWAP(vi.ccw.y, vi.cw.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1530 |
doCap(pathToSurface, rasterizer, vi, strokeWidth, capStyle); //start cap //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1531 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1532 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1533 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1534 |
{ //join two segments |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1535 |
RI_ASSERT(v0.inDash == v1.inDash); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1536 |
if( v0.inDash ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1537 |
doJoin(pathToSurface, rasterizer, v0, v1, strokeWidth, joinStyle, miterLimit); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1538 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1539 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1540 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1541 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1542 |
{ //in the middle of a segment |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1543 |
if( !(v.flags & IMPLICIT_CLOSE_SUBPATH) ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1544 |
{ //normal segment, do stroking |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1545 |
if( dashing ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1546 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1547 |
StrokeVertex prevDashVertex = v0; //dashing of the segment starts from the previous vertex |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1548 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1549 |
if(nextDash + 10000.0f * dashPatternLength < v1.pathLength) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1550 |
throw std::bad_alloc(); //too many dashes, throw bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1551 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1552 |
//loop dash events until the next vertex event |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1553 |
//zero length dashes are handled as a special case since if they hit the vertex, |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1554 |
//we want to include their starting point to this segment already in order to generate a join |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1555 |
int numDashStops = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1556 |
while(nextDash < v1.pathLength || (nextDash <= v1.pathLength && dashPattern[(d+1) % dashPatternSize] == 0.0f)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1557 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1558 |
RIfloat edgeLength = v1.pathLength - v0.pathLength; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1559 |
RIfloat ratio = 0.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1560 |
if(edgeLength > 0.0f) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1561 |
ratio = (nextDash - v0.pathLength) / edgeLength; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1562 |
StrokeVertex nextDashVertex; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1563 |
nextDashVertex.p = v0.p * (1.0f - ratio) + v1.p * ratio; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1564 |
nextDashVertex.t = circularLerp(v0.t, v1.t, ratio); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1565 |
nextDashVertex.ccw = nextDashVertex.p + normalize(perpendicularCCW(nextDashVertex.t)) * strokeWidth * 0.5f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1566 |
nextDashVertex.cw = nextDashVertex.p + normalize(perpendicularCW(nextDashVertex.t)) * strokeWidth * 0.5f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1567 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1568 |
if( inDash ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1569 |
{ //stroke from prevDashVertex -> nextDashVertex |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1570 |
if( numDashStops ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1571 |
{ //prevDashVertex is not the start vertex of the segment, cap it (start vertex has already been joined or capped) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1572 |
StrokeVertex vi = prevDashVertex; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1573 |
vi.t = -vi.t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1574 |
RI_SWAP(vi.ccw.x, vi.cw.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1575 |
RI_SWAP(vi.ccw.y, vi.cw.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1576 |
doCap(pathToSurface, rasterizer, vi, strokeWidth, capStyle); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1577 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1578 |
interpolateStroke(pathToSurface, rasterizer, prevDashVertex, nextDashVertex, strokeWidth); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1579 |
doCap(pathToSurface, rasterizer, nextDashVertex, strokeWidth, capStyle); //end cap //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1580 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1581 |
prevDashVertex = nextDashVertex; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1582 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1583 |
if( d & 1 ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1584 |
{ //dash starts |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1585 |
RI_ASSERT(!inDash); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1586 |
inDash = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1587 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1588 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1589 |
{ //dash ends |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1590 |
RI_ASSERT(inDash); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1591 |
inDash = false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1592 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1593 |
d = (d+1) % dashPatternSize; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1594 |
nextDash += RI_MAX(dashPattern[d], 0.0f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1595 |
numDashStops++; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1596 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1597 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1598 |
if( inDash ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1599 |
{ //stroke prevDashVertex -> v1 |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1600 |
if( numDashStops ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1601 |
{ //prevDashVertex is not the start vertex of the segment, cap it (start vertex has already been joined or capped) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1602 |
StrokeVertex vi = prevDashVertex; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1603 |
vi.t = -vi.t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1604 |
RI_SWAP(vi.ccw.x, vi.cw.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1605 |
RI_SWAP(vi.ccw.y, vi.cw.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1606 |
doCap(pathToSurface, rasterizer, vi, strokeWidth, capStyle); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1607 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1608 |
interpolateStroke(pathToSurface, rasterizer, prevDashVertex, v1, strokeWidth); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1609 |
//no cap, leave path open |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1610 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1611 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1612 |
v1.inDash = inDash; //update inDash status of the segment end point |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1613 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1614 |
else //no dashing, just interpolate segment end points |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1615 |
interpolateStroke(pathToSurface, rasterizer, v0, v1, strokeWidth); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1616 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1617 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1618 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1619 |
if((v.flags & END_SEGMENT) && (v.flags & CLOSE_SUBPATH)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1620 |
{ //join start and end of the current subpath |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1621 |
if( v1.inDash && vs.inDash ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1622 |
doJoin(pathToSurface, rasterizer, v1, vs, strokeWidth, joinStyle, miterLimit); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1623 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1624 |
{ //both start and end are not in dash, cap them |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1625 |
if( v1.inDash ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1626 |
doCap(pathToSurface, rasterizer, v1, strokeWidth, capStyle); //end cap //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1627 |
if( vs.inDash ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1628 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1629 |
StrokeVertex vi = vs; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1630 |
vi.t = -vi.t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1631 |
RI_SWAP(vi.ccw.x, vi.cw.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1632 |
RI_SWAP(vi.ccw.y, vi.cw.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1633 |
doCap(pathToSurface, rasterizer, vi, strokeWidth, capStyle); //start cap //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1634 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1635 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1636 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1637 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1638 |
v0 = v1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1639 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1640 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1641 |
catch(std::bad_alloc) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1642 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1643 |
rasterizer.clear(); //remove the unfinished path |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1644 |
throw; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1645 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1646 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1647 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1648 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1649 |
* \brief Tessellates a path, and returns a position and a tangent on the path |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1650 |
* given a distance along the path. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1651 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1652 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1653 |
* \note if runs out of memory, throws bad_alloc and leaves the path as it was |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1654 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1655 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1656 |
void Path::getPointAlong(int startIndex, int numSegments, RIfloat distance, Vector2& p, Vector2& t) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1657 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1658 |
RI_ASSERT(m_referenceCount > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1659 |
RI_ASSERT(startIndex >= 0 && startIndex + numSegments <= m_segments.size() && numSegments > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1660 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1661 |
Matrix3x3 identity; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1662 |
identity.identity(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1663 |
tessellate(identity, 0.0f); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1664 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1665 |
RI_ASSERT(startIndex >= 0 && startIndex < m_segmentToVertex.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1666 |
RI_ASSERT(startIndex + numSegments >= 0 && startIndex + numSegments <= m_segmentToVertex.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1667 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1668 |
// ignore move segments at the start of the path |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1669 |
while (numSegments && (m_segments[startIndex] & ~VG_RELATIVE) == VG_MOVE_TO) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1670 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1671 |
startIndex++; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1672 |
numSegments--; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1673 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1674 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1675 |
// ignore move segments at the end of the path |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1676 |
while (numSegments && (m_segments[startIndex + numSegments - 1] & ~VG_RELATIVE) == VG_MOVE_TO) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1677 |
numSegments--; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1678 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1679 |
// empty path? |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1680 |
if (!m_vertices.size() || !numSegments) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1681 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1682 |
p.set(0,0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1683 |
t.set(1,0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1684 |
return; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1685 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1686 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1687 |
int startVertex = m_segmentToVertex[startIndex].start; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1688 |
int endVertex = m_segmentToVertex[startIndex + numSegments - 1].end; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1689 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1690 |
if(startVertex == -1) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1691 |
startVertex = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1692 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1693 |
// zero length? |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1694 |
if (startVertex >= endVertex) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1695 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1696 |
p = m_vertices[startVertex].userPosition; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1697 |
t.set(1,0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1698 |
return; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1699 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1700 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1701 |
RI_ASSERT(startVertex >= 0 && startVertex < m_vertices.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1702 |
RI_ASSERT(endVertex >= 0 && endVertex < m_vertices.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1703 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1704 |
distance += m_vertices[startVertex].pathLength; //map distance to the range of the whole path |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1705 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1706 |
if(distance <= m_vertices[startVertex].pathLength) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1707 |
{ //return the first point of the path |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1708 |
p = m_vertices[startVertex].userPosition; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1709 |
t = m_vertices[startVertex].userTangent; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1710 |
return; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1711 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1712 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1713 |
if(distance >= m_vertices[endVertex].pathLength) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1714 |
{ //return the last point of the path |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1715 |
p = m_vertices[endVertex].userPosition; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1716 |
t = m_vertices[endVertex].userTangent; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1717 |
return; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1718 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1719 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1720 |
//search for the segment containing the distance |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1721 |
for(int s=startIndex;s<startIndex+numSegments;s++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1722 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1723 |
int start = m_segmentToVertex[s].start; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1724 |
int end = m_segmentToVertex[s].end; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1725 |
if(start < 0) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1726 |
start = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1727 |
if(end < 0) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1728 |
end = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1729 |
RI_ASSERT(start >= 0 && start < m_vertices.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1730 |
RI_ASSERT(end >= 0 && end < m_vertices.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1731 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1732 |
if(distance >= m_vertices[start].pathLength && distance < m_vertices[end].pathLength) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1733 |
{ //segment contains the queried distance |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1734 |
for(int i=start;i<end;i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1735 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1736 |
const Vertex& v0 = m_vertices[i]; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1737 |
const Vertex& v1 = m_vertices[i+1]; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1738 |
if(distance >= v0.pathLength && distance < v1.pathLength) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1739 |
{ //segment found, interpolate linearly between its end points |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1740 |
RIfloat edgeLength = v1.pathLength - v0.pathLength; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1741 |
RI_ASSERT(edgeLength > 0.0f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1742 |
RIfloat r = (distance - v0.pathLength) / edgeLength; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1743 |
p = (1.0f - r) * v0.userPosition + r * v1.userPosition; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1744 |
t = (1.0f - r) * v0.userTangent + r * v1.userTangent; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1745 |
return; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1746 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1747 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1748 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1749 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1750 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1751 |
RI_ASSERT(0); //point not found (should never get here) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1752 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1753 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1754 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1755 |
* \brief Tessellates a path, and computes its length. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1756 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1757 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1758 |
* \note if runs out of memory, throws bad_alloc and leaves the path as it was |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1759 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1760 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1761 |
RIfloat Path::getPathLength(int startIndex, int numSegments) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1762 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1763 |
RI_ASSERT(m_referenceCount > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1764 |
RI_ASSERT(startIndex >= 0 && startIndex + numSegments <= m_segments.size() && numSegments > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1765 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1766 |
Matrix3x3 identity; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1767 |
identity.identity(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1768 |
tessellate(identity, 0.0f); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1769 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1770 |
RI_ASSERT(startIndex >= 0 && startIndex < m_segmentToVertex.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1771 |
RI_ASSERT(startIndex + numSegments >= 0 && startIndex + numSegments <= m_segmentToVertex.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1772 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1773 |
int startVertex = m_segmentToVertex[startIndex].start; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1774 |
int endVertex = m_segmentToVertex[startIndex + numSegments - 1].end; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1775 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1776 |
if(!m_vertices.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1777 |
return 0.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1778 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1779 |
RIfloat startPathLength = 0.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1780 |
if(startVertex >= 0) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1781 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1782 |
RI_ASSERT(startVertex >= 0 && startVertex < m_vertices.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1783 |
startPathLength = m_vertices[startVertex].pathLength; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1784 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1785 |
RIfloat endPathLength = 0.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1786 |
if(endVertex >= 0) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1787 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1788 |
RI_ASSERT(endVertex >= 0 && endVertex < m_vertices.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1789 |
endPathLength = m_vertices[endVertex].pathLength; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1790 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1791 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1792 |
return endPathLength - startPathLength; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1793 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1794 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1795 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1796 |
* \brief Tessellates a path, and computes its bounding box in user space. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1797 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1798 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1799 |
* \note if runs out of memory, throws bad_alloc and leaves the path as it was |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1800 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1801 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1802 |
void Path::getPathBounds(RIfloat& minx, RIfloat& miny, RIfloat& maxx, RIfloat& maxy) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1803 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1804 |
RI_ASSERT(m_referenceCount > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1805 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1806 |
Matrix3x3 identity; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1807 |
identity.identity(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1808 |
tessellate(identity, 0.0f); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1809 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1810 |
if(m_vertices.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1811 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1812 |
minx = m_userMinx; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1813 |
miny = m_userMiny; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1814 |
maxx = m_userMaxx; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1815 |
maxy = m_userMaxy; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1816 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1817 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1818 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1819 |
minx = miny = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1820 |
maxx = maxy = -1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1821 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1822 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1823 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1824 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1825 |
* \brief Tessellates a path, and computes its bounding box in surface space. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1826 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1827 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1828 |
* \note if runs out of memory, throws bad_alloc and leaves the path as it was |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1829 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1830 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1831 |
void Path::getPathTransformedBounds(const Matrix3x3& pathToSurface, RIfloat& minx, RIfloat& miny, RIfloat& maxx, RIfloat& maxy) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1832 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1833 |
RI_ASSERT(m_referenceCount > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1834 |
RI_ASSERT(pathToSurface.isAffine()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1835 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1836 |
Matrix3x3 identity; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1837 |
identity.identity(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1838 |
tessellate(identity, 0.0f); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1839 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1840 |
if(m_vertices.size()) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1841 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1842 |
Vector3 p0(m_userMinx, m_userMiny, 1.0f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1843 |
Vector3 p1(m_userMinx, m_userMaxy, 1.0f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1844 |
Vector3 p2(m_userMaxx, m_userMaxy, 1.0f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1845 |
Vector3 p3(m_userMaxx, m_userMiny, 1.0f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1846 |
p0 = pathToSurface * p0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1847 |
p1 = pathToSurface * p1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1848 |
p2 = pathToSurface * p2; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1849 |
p3 = pathToSurface * p3; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1850 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1851 |
minx = RI_MIN(RI_MIN(RI_MIN(p0.x, p1.x), p2.x), p3.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1852 |
miny = RI_MIN(RI_MIN(RI_MIN(p0.y, p1.y), p2.y), p3.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1853 |
maxx = RI_MAX(RI_MAX(RI_MAX(p0.x, p1.x), p2.x), p3.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1854 |
maxy = RI_MAX(RI_MAX(RI_MAX(p0.y, p1.y), p2.y), p3.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1855 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1856 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1857 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1858 |
minx = miny = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1859 |
maxx = maxy = -1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1860 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1861 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1862 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1863 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1864 |
* \brief Adds a vertex to a tessellated path. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1865 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1866 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1867 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1868 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1869 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1870 |
void Path::addVertex(const Vector2& p, const Vector2& t, RIfloat pathLength, unsigned int flags) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1871 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1872 |
RI_ASSERT(!isZero(t)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1873 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1874 |
Vertex v; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1875 |
v.pathLength = pathLength; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1876 |
v.userPosition = p; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1877 |
v.userTangent = t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1878 |
v.flags = flags; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1879 |
m_vertices.push_back(v); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1880 |
m_numTessVertices++; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1881 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1882 |
m_userMinx = RI_MIN(m_userMinx, v.userPosition.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1883 |
m_userMiny = RI_MIN(m_userMiny, v.userPosition.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1884 |
m_userMaxx = RI_MAX(m_userMaxx, v.userPosition.x); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1885 |
m_userMaxy = RI_MAX(m_userMaxy, v.userPosition.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1886 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1887 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1888 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1889 |
* \brief Adds an edge to a tessellated path. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1890 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1891 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1892 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1893 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1894 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1895 |
void Path::addEdge(const Vector2& p0, const Vector2& p1, const Vector2& t0, const Vector2& t1, unsigned int startFlags, unsigned int endFlags) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1896 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1897 |
Vertex v; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1898 |
RIfloat pathLength = 0.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1899 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1900 |
RI_ASSERT(!isZero(t0) && !isZero(t1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1901 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1902 |
//segment midpoints are shared between edges |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1903 |
if(!m_numTessVertices) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1904 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1905 |
if(m_vertices.size() > 0) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1906 |
pathLength = m_vertices[m_vertices.size()-1].pathLength; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1907 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1908 |
addVertex(p0, t0, pathLength, startFlags); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1909 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1910 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1911 |
//other than implicit close paths (caused by a MOVE_TO) add to path length |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1912 |
if( !(endFlags & IMPLICIT_CLOSE_SUBPATH) ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1913 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1914 |
//NOTE: with extremely large coordinates the floating point path length is infinite |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1915 |
RIfloat l = (p1 - p0).length(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1916 |
pathLength = m_vertices[m_vertices.size()-1].pathLength + l; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1917 |
pathLength = RI_MIN(pathLength, RI_FLOAT_MAX); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1918 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1919 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1920 |
addVertex(p1, t1, pathLength, endFlags); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1921 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1922 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1923 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1924 |
* \brief Tessellates a close-path segment. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1925 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1926 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1927 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1928 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1929 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1930 |
void Path::addEndPath(const Matrix3x3& pathToSurface, const Vector2& p0, const Vector2& p1, bool subpathHasGeometry, unsigned int flags) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1931 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1932 |
RI_UNREF(pathToSurface); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1933 |
m_numTessVertices = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1934 |
if(!subpathHasGeometry) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1935 |
{ //single vertex |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1936 |
Vector2 t(1.0f,0.0f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1937 |
addEdge(p0, p1, t, t, START_SEGMENT | START_SUBPATH, END_SEGMENT | END_SUBPATH); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1938 |
m_numTessVertices = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1939 |
addEdge(p0, p1, -t, -t, IMPLICIT_CLOSE_SUBPATH | START_SEGMENT, IMPLICIT_CLOSE_SUBPATH | END_SEGMENT); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1940 |
return; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1941 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1942 |
//the subpath contains segment commands that have generated geometry |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1943 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1944 |
//add a close path segment to the start point of the subpath |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1945 |
RI_ASSERT(m_vertices.size() > 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1946 |
m_vertices[m_vertices.size()-1].flags |= END_SUBPATH; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1947 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1948 |
Vector2 t = normalize(p1 - p0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1949 |
if(isZero(t)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1950 |
t = m_vertices[m_vertices.size()-1].userTangent; //if the segment is zero-length, use the tangent of the last segment end point so that proper join will be generated |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1951 |
RI_ASSERT(!isZero(t)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1952 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1953 |
addEdge(p0, p1, t, t, flags | START_SEGMENT, flags | END_SEGMENT); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1954 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1955 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1956 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1957 |
* \brief Tessellates a line-to segment. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1958 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1959 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1960 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1961 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1962 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1963 |
bool Path::addLineTo(const Matrix3x3& pathToSurface, const Vector2& p0, const Vector2& p1, bool subpathHasGeometry) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1964 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1965 |
RI_UNREF(pathToSurface); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1966 |
if(p0 == p1) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1967 |
return false; //discard zero-length segments |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1968 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1969 |
//compute end point tangents |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1970 |
Vector2 t = normalize(p1 - p0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1971 |
RI_ASSERT(!isZero(t)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1972 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1973 |
m_numTessVertices = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1974 |
unsigned int startFlags = START_SEGMENT; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1975 |
if(!subpathHasGeometry) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1976 |
startFlags |= START_SUBPATH; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1977 |
addEdge(p0, p1, t, t, startFlags, END_SEGMENT); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1978 |
return true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1979 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1980 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1981 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1982 |
* \brief Tessellates a quad-to segment. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1983 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1984 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1985 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1986 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1987 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1988 |
bool Path::addQuadTo(const Matrix3x3& pathToSurface, const Vector2& p0, const Vector2& p1, const Vector2& p2, bool subpathHasGeometry, float strokeWidth) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1989 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1990 |
RI_UNREF(pathToSurface); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1991 |
RI_UNREF(strokeWidth); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1992 |
if(p0 == p1 && p0 == p2) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1993 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1994 |
RI_ASSERT(p1 == p2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1995 |
return false; //discard zero-length segments |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1996 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1997 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1998 |
//compute end point tangents |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
1999 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2000 |
Vector2 incomingTangent = normalize(p1 - p0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2001 |
Vector2 outgoingTangent = normalize(p2 - p1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2002 |
if(p0 == p1) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2003 |
incomingTangent = normalize(p2 - p0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2004 |
if(p1 == p2) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2005 |
outgoingTangent = normalize(p2 - p0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2006 |
RI_ASSERT(!isZero(incomingTangent) && !isZero(outgoingTangent)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2007 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2008 |
m_numTessVertices = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2009 |
unsigned int startFlags = START_SEGMENT; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2010 |
if(!subpathHasGeometry) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2011 |
startFlags |= START_SUBPATH; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2012 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2013 |
const int segments = RI_NUM_TESSELLATED_SEGMENTS; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2014 |
Vector2 pp = p0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2015 |
Vector2 tp = incomingTangent; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2016 |
unsigned int prevFlags = startFlags; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2017 |
for(int i=1;i<segments;i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2018 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2019 |
RIfloat t = (RIfloat)i / (RIfloat)segments; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2020 |
RIfloat u = 1.0f-t; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2021 |
Vector2 pn = u*u * p0 + 2.0f*t*u * p1 + t*t * p2; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2022 |
Vector2 tn = (-1.0f+t) * p0 + (1.0f-2.0f*t) * p1 + t * p2; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2023 |
tn = normalize(tn); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2024 |
if(isZero(tn)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2025 |
tn = tp; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2026 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2027 |
addEdge(pp, pn, tp, tn, prevFlags, 0); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2028 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2029 |
pp = pn; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2030 |
tp = tn; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2031 |
prevFlags = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2032 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2033 |
addEdge(pp, p2, tp, outgoingTangent, prevFlags, END_SEGMENT); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2034 |
return true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2035 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2036 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2037 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2038 |
* \brief Tessellates a cubic-to segment. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2039 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2040 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2041 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2042 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2043 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2044 |
bool Path::addCubicTo(const Matrix3x3& pathToSurface, const Vector2& p0, const Vector2& p1, const Vector2& p2, const Vector2& p3, bool subpathHasGeometry, float strokeWidth) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2045 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2046 |
RI_UNREF(pathToSurface); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2047 |
RI_UNREF(strokeWidth); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2048 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2049 |
if(p0 == p1 && p0 == p2 && p0 == p3) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2050 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2051 |
RI_ASSERT(p1 == p2 && p1 == p3 && p2 == p3); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2052 |
return false; //discard zero-length segments |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2053 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2054 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2055 |
//compute end point tangents |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2056 |
Vector2 incomingTangent = normalize(p1 - p0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2057 |
Vector2 outgoingTangent = normalize(p3 - p2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2058 |
if(p0 == p1) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2059 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2060 |
incomingTangent = normalize(p2 - p0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2061 |
if(p1 == p2) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2062 |
incomingTangent = normalize(p3 - p0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2063 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2064 |
if(p2 == p3) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2065 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2066 |
outgoingTangent = normalize(p3 - p1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2067 |
if(p1 == p2) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2068 |
outgoingTangent = normalize(p3 - p0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2069 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2070 |
RI_ASSERT(!isZero(incomingTangent) && !isZero(outgoingTangent)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2071 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2072 |
m_numTessVertices = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2073 |
unsigned int startFlags = START_SEGMENT; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2074 |
if(!subpathHasGeometry) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2075 |
startFlags |= START_SUBPATH; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2076 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2077 |
const int segments = RI_NUM_TESSELLATED_SEGMENTS; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2078 |
Vector2 pp = p0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2079 |
Vector2 tp = incomingTangent; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2080 |
unsigned int prevFlags = startFlags; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2081 |
for(int i=1;i<segments;i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2082 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2083 |
RIfloat t = (RIfloat)i / (RIfloat)segments; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2084 |
Vector2 pn = (1.0f - 3.0f*t + 3.0f*t*t - t*t*t) * p0 + (3.0f*t - 6.0f*t*t + 3.0f*t*t*t) * p1 + (3.0f*t*t - 3.0f*t*t*t) * p2 + t*t*t * p3; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2085 |
Vector2 tn = (-3.0f + 6.0f*t - 3.0f*t*t) * p0 + (3.0f - 12.0f*t + 9.0f*t*t) * p1 + (6.0f*t - 9.0f*t*t) * p2 + 3.0f*t*t * p3; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2086 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2087 |
tn = normalize(tn); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2088 |
if(isZero(tn)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2089 |
tn = tp; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2090 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2091 |
addEdge(pp, pn, tp, tn, prevFlags, 0); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2092 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2093 |
pp = pn; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2094 |
tp = tn; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2095 |
prevFlags = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2096 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2097 |
addEdge(pp, p3, tp, outgoingTangent, prevFlags, END_SEGMENT); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2098 |
return true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2099 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2100 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2101 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2102 |
* \brief Finds an ellipse center and transformation from the unit circle to |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2103 |
* that ellipse. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2104 |
* \param rh Length of the horizontal axis |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2105 |
* rv Length of the vertical axis |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2106 |
* rot Rotation angle |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2107 |
* p0,p1 User space end points of the arc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2108 |
* c0,c1 (Return value) Unit circle space center points of the two ellipses |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2109 |
* u0,u1 (Return value) Unit circle space end points of the arc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2110 |
* unitCircleToEllipse (Return value) A matrix mapping from unit circle space to user space |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2111 |
* \return true if ellipse exists, false if doesn't |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2112 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2113 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2114 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2115 |
static bool findEllipses(RIfloat rh, RIfloat rv, RIfloat rot, const Vector2& p0, const Vector2& p1, VGPathSegment segment, Vector2& c0, Vector2& c1, Vector2& u0, Vector2& u1, Matrix3x3& unitCircleToEllipse, bool& cw) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2116 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2117 |
rh = RI_ABS(rh); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2118 |
rv = RI_ABS(rv); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2119 |
if(rh == 0.0f || rv == 0.0f || p0 == p1) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2120 |
return false; //degenerate ellipse |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2121 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2122 |
rot = RI_DEG_TO_RAD(rot); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2123 |
unitCircleToEllipse.set((RIfloat)cos(rot)*rh, -(RIfloat)sin(rot)*rv, 0, |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2124 |
(RIfloat)sin(rot)*rh, (RIfloat)cos(rot)*rv, 0, |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2125 |
0, 0, 1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2126 |
Matrix3x3 ellipseToUnitCircle = invert(unitCircleToEllipse); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2127 |
//force affinity |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2128 |
ellipseToUnitCircle[2][0] = 0.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2129 |
ellipseToUnitCircle[2][1] = 0.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2130 |
ellipseToUnitCircle[2][2] = 1.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2131 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2132 |
// Transform p0 and p1 into unit space |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2133 |
u0 = affineTransform(ellipseToUnitCircle, p0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2134 |
u1 = affineTransform(ellipseToUnitCircle, p1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2135 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2136 |
Vector2 m = 0.5f * (u0 + u1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2137 |
Vector2 d = u0 - u1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2138 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2139 |
RIfloat lsq = (RIfloat)dot(d,d); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2140 |
if(lsq <= 0.0f) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2141 |
return false; //the points are coincident |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2142 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2143 |
RIfloat disc = (1.0f / lsq) - 0.25f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2144 |
if(disc < 0.0f) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2145 |
{ //the points are too far apart for a solution to exist, scale the axes so that there is a solution |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2146 |
RIfloat l = (RIfloat)sqrt(lsq); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2147 |
rh *= 0.5f * l; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2148 |
rv *= 0.5f * l; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2149 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2150 |
//redo the computation with scaled axes |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2151 |
unitCircleToEllipse.set((RIfloat)cos(rot)*rh, -(RIfloat)sin(rot)*rv, 0, |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2152 |
(RIfloat)sin(rot)*rh, (RIfloat)cos(rot)*rv, 0, |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2153 |
0, 0, 1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2154 |
ellipseToUnitCircle = invert(unitCircleToEllipse); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2155 |
//force affinity |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2156 |
ellipseToUnitCircle[2][0] = 0.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2157 |
ellipseToUnitCircle[2][1] = 0.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2158 |
ellipseToUnitCircle[2][2] = 1.0f; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2159 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2160 |
// Transform p0 and p1 into unit space |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2161 |
u0 = affineTransform(ellipseToUnitCircle, p0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2162 |
u1 = affineTransform(ellipseToUnitCircle, p1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2163 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2164 |
// Solve for intersecting unit circles |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2165 |
d = u0 - u1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2166 |
m = 0.5f * (u0 + u1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2167 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2168 |
lsq = dot(d,d); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2169 |
if(lsq <= 0.0f) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2170 |
return false; //the points are coincident |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2171 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2172 |
disc = RI_MAX(0.0f, 1.0f / lsq - 0.25f); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2173 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2174 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2175 |
if(u0 == u1) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2176 |
return false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2177 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2178 |
Vector2 sd = d * (RIfloat)sqrt(disc); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2179 |
Vector2 sp = perpendicularCW(sd); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2180 |
c0 = m + sp; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2181 |
c1 = m - sp; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2182 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2183 |
//choose the center point and direction |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2184 |
Vector2 cp = c0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2185 |
if(segment == VG_SCWARC_TO || segment == VG_LCCWARC_TO) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2186 |
cp = c1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2187 |
cw = false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2188 |
if(segment == VG_SCWARC_TO || segment == VG_LCWARC_TO) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2189 |
cw = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2190 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2191 |
//move the unit circle origin to the chosen center point |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2192 |
u0 -= cp; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2193 |
u1 -= cp; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2194 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2195 |
if(u0 == u1 || isZero(u0) || isZero(u1)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2196 |
return false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2197 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2198 |
//transform back to the original coordinate space |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2199 |
cp = affineTransform(unitCircleToEllipse, cp); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2200 |
unitCircleToEllipse[0][2] = cp.x; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2201 |
unitCircleToEllipse[1][2] = cp.y; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2202 |
return true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2203 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2204 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2205 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2206 |
* \brief Tessellates an arc-to segment. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2207 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2208 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2209 |
* \note |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2210 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2211 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2212 |
bool Path::addArcTo(const Matrix3x3& pathToSurface, const Vector2& p0, RIfloat rh, RIfloat rv, RIfloat rot, const Vector2& p1, const Vector2& p1r, VGPathSegment segment, bool subpathHasGeometry, float strokeWidth) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2213 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2214 |
RI_UNREF(pathToSurface); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2215 |
RI_UNREF(strokeWidth); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2216 |
if(p0 == p1) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2217 |
return false; //discard zero-length segments |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2218 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2219 |
Vector2 c0, c1, u0, u1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2220 |
Matrix3x3 unitCircleToEllipse; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2221 |
bool cw; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2222 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2223 |
m_numTessVertices = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2224 |
unsigned int startFlags = START_SEGMENT; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2225 |
if(!subpathHasGeometry) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2226 |
startFlags |= START_SUBPATH; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2227 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2228 |
if(!findEllipses(rh, rv, rot, Vector2(), p1r, segment, c0, c1, u0, u1, unitCircleToEllipse, cw)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2229 |
{ //ellipses don't exist, add line instead |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2230 |
Vector2 t = normalize(p1r); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2231 |
RI_ASSERT(!isZero(t)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2232 |
addEdge(p0, p1, t, t, startFlags, END_SEGMENT); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2233 |
return true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2234 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2235 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2236 |
//compute end point tangents |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2237 |
Vector2 incomingTangent = perpendicular(u0, cw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2238 |
incomingTangent = affineTangentTransform(unitCircleToEllipse, incomingTangent); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2239 |
incomingTangent = normalize(incomingTangent); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2240 |
Vector2 outgoingTangent = perpendicular(u1, cw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2241 |
outgoingTangent = affineTangentTransform(unitCircleToEllipse, outgoingTangent); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2242 |
outgoingTangent = normalize(outgoingTangent); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2243 |
RI_ASSERT(!isZero(incomingTangent) && !isZero(outgoingTangent)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2244 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2245 |
const int segments = RI_NUM_TESSELLATED_SEGMENTS; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2246 |
Vector2 pp = p0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2247 |
Vector2 tp = incomingTangent; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2248 |
unsigned int prevFlags = startFlags; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2249 |
for(int i=1;i<segments;i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2250 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2251 |
RIfloat t = (RIfloat)i / (RIfloat)segments; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2252 |
Vector2 pn = circularLerp(u0, u1, t, cw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2253 |
Vector2 tn = perpendicular(pn, cw); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2254 |
tn = affineTangentTransform(unitCircleToEllipse, tn); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2255 |
pn = affineTransform(unitCircleToEllipse, pn) + p0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2256 |
tn = normalize(tn); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2257 |
if(isZero(tn)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2258 |
tn = tp; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2259 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2260 |
addEdge(pp, pn, tp, tn, prevFlags, 0); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2261 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2262 |
pp = pn; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2263 |
tp = tn; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2264 |
prevFlags = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2265 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2266 |
addEdge(pp, p1, tp, outgoingTangent, prevFlags, END_SEGMENT); //throws bad_alloc |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2267 |
return true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2268 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2269 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2270 |
/*-------------------------------------------------------------------*//*! |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2271 |
* \brief Tessellates a path. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2272 |
* \param |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2273 |
* \return |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2274 |
* \note tessellation output format: A list of vertices describing the |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2275 |
* path tessellated into line segments and relevant aspects of the |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2276 |
* input data. Each path segment has a start vertex, a number of |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2277 |
* internal vertices (possibly zero), and an end vertex. The start |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2278 |
* and end of segments and subpaths have been flagged, as well as |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2279 |
* implicit and explicit close subpath segments. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2280 |
*//*-------------------------------------------------------------------*/ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2281 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2282 |
void Path::tessellate(const Matrix3x3& pathToSurface, float strokeWidth) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2283 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2284 |
m_vertices.clear(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2285 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2286 |
m_userMinx = RI_FLOAT_MAX; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2287 |
m_userMiny = RI_FLOAT_MAX; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2288 |
m_userMaxx = -RI_FLOAT_MAX; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2289 |
m_userMaxy = -RI_FLOAT_MAX; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2290 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2291 |
try |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2292 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2293 |
m_segmentToVertex.resize(m_segments.size()); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2294 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2295 |
int coordIndex = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2296 |
Vector2 s(0,0); //the beginning of the current subpath |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2297 |
Vector2 o(0,0); //the last point of the previous segment |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2298 |
Vector2 p(0,0); //the last internal control point of the previous segment, if the segment was a (regular or smooth) quadratic or cubic Bezier, or else the last point of the previous segment |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2299 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2300 |
//tessellate the path segments |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2301 |
coordIndex = 0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2302 |
s.set(0,0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2303 |
o.set(0,0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2304 |
p.set(0,0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2305 |
bool subpathHasGeometry = false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2306 |
VGPathSegment prevSegment = VG_MOVE_TO; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2307 |
for(int i=0;i<m_segments.size();i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2308 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2309 |
VGPathSegment segment = getPathSegment(m_segments[i]); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2310 |
VGPathAbsRel absRel = getPathAbsRel(m_segments[i]); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2311 |
int coords = segmentToNumCoordinates(segment); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2312 |
m_segmentToVertex[i].start = m_vertices.size(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2313 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2314 |
switch(segment) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2315 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2316 |
case VG_CLOSE_PATH: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2317 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2318 |
RI_ASSERT(coords == 0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2319 |
addEndPath(pathToSurface, o, s, subpathHasGeometry, CLOSE_SUBPATH); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2320 |
p = s; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2321 |
o = s; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2322 |
subpathHasGeometry = false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2323 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2324 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2325 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2326 |
case VG_MOVE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2327 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2328 |
RI_ASSERT(coords == 2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2329 |
Vector2 c(getCoordinate(coordIndex+0), getCoordinate(coordIndex+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2330 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2331 |
c += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2332 |
if(prevSegment != VG_MOVE_TO && prevSegment != VG_CLOSE_PATH) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2333 |
addEndPath(pathToSurface, o, s, subpathHasGeometry, IMPLICIT_CLOSE_SUBPATH); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2334 |
s = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2335 |
p = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2336 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2337 |
subpathHasGeometry = false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2338 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2339 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2340 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2341 |
case VG_LINE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2342 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2343 |
RI_ASSERT(coords == 2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2344 |
Vector2 c(getCoordinate(coordIndex+0), getCoordinate(coordIndex+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2345 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2346 |
c += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2347 |
if(addLineTo(pathToSurface, o, c, subpathHasGeometry)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2348 |
subpathHasGeometry = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2349 |
p = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2350 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2351 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2352 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2353 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2354 |
case VG_HLINE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2355 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2356 |
RI_ASSERT(coords == 1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2357 |
Vector2 c(getCoordinate(coordIndex+0), o.y); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2358 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2359 |
c.x += o.x; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2360 |
if(addLineTo(pathToSurface, o, c, subpathHasGeometry)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2361 |
subpathHasGeometry = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2362 |
p = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2363 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2364 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2365 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2366 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2367 |
case VG_VLINE_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2368 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2369 |
RI_ASSERT(coords == 1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2370 |
Vector2 c(o.x, getCoordinate(coordIndex+0)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2371 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2372 |
c.y += o.y; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2373 |
if(addLineTo(pathToSurface, o, c, subpathHasGeometry)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2374 |
subpathHasGeometry = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2375 |
p = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2376 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2377 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2378 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2379 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2380 |
case VG_QUAD_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2381 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2382 |
RI_ASSERT(coords == 4); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2383 |
Vector2 c0(getCoordinate(coordIndex+0), getCoordinate(coordIndex+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2384 |
Vector2 c1(getCoordinate(coordIndex+2), getCoordinate(coordIndex+3)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2385 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2386 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2387 |
c0 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2388 |
c1 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2389 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2390 |
if(addQuadTo(pathToSurface, o, c0, c1, subpathHasGeometry, strokeWidth)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2391 |
subpathHasGeometry = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2392 |
p = c0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2393 |
o = c1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2394 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2395 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2396 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2397 |
case VG_SQUAD_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2398 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2399 |
RI_ASSERT(coords == 2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2400 |
Vector2 c0 = 2.0f * o - p; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2401 |
Vector2 c1(getCoordinate(coordIndex+0), getCoordinate(coordIndex+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2402 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2403 |
c1 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2404 |
if(addQuadTo(pathToSurface, o, c0, c1, subpathHasGeometry, strokeWidth)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2405 |
subpathHasGeometry = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2406 |
p = c0; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2407 |
o = c1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2408 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2409 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2410 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2411 |
case VG_CUBIC_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2412 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2413 |
RI_ASSERT(coords == 6); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2414 |
Vector2 c0(getCoordinate(coordIndex+0), getCoordinate(coordIndex+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2415 |
Vector2 c1(getCoordinate(coordIndex+2), getCoordinate(coordIndex+3)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2416 |
Vector2 c2(getCoordinate(coordIndex+4), getCoordinate(coordIndex+5)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2417 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2418 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2419 |
c0 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2420 |
c1 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2421 |
c2 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2422 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2423 |
if(addCubicTo(pathToSurface, o, c0, c1, c2, subpathHasGeometry, strokeWidth)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2424 |
subpathHasGeometry = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2425 |
p = c1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2426 |
o = c2; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2427 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2428 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2429 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2430 |
case VG_SCUBIC_TO: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2431 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2432 |
RI_ASSERT(coords == 4); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2433 |
Vector2 c0 = 2.0f * o - p; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2434 |
Vector2 c1(getCoordinate(coordIndex+0), getCoordinate(coordIndex+1)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2435 |
Vector2 c2(getCoordinate(coordIndex+2), getCoordinate(coordIndex+3)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2436 |
if(absRel == VG_RELATIVE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2437 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2438 |
c1 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2439 |
c2 += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2440 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2441 |
if(addCubicTo(pathToSurface, o, c0, c1, c2, subpathHasGeometry, strokeWidth)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2442 |
subpathHasGeometry = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2443 |
p = c1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2444 |
o = c2; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2445 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2446 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2447 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2448 |
default: |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2449 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2450 |
RI_ASSERT(segment == VG_SCCWARC_TO || segment == VG_SCWARC_TO || |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2451 |
segment == VG_LCCWARC_TO || segment == VG_LCWARC_TO); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2452 |
RI_ASSERT(coords == 5); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2453 |
RIfloat rh = getCoordinate(coordIndex+0); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2454 |
RIfloat rv = getCoordinate(coordIndex+1); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2455 |
RIfloat rot = getCoordinate(coordIndex+2); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2456 |
Vector2 c(getCoordinate(coordIndex+3), getCoordinate(coordIndex+4)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2457 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2458 |
Vector2 cr = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2459 |
if(absRel == VG_ABSOLUTE) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2460 |
cr -= o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2461 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2462 |
c += o; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2463 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2464 |
if(addArcTo(pathToSurface, o, rh, rv, rot, c, cr, segment, subpathHasGeometry, strokeWidth)) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2465 |
subpathHasGeometry = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2466 |
p = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2467 |
o = c; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2468 |
break; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2469 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2470 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2471 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2472 |
if(m_vertices.size() > m_segmentToVertex[i].start) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2473 |
{ //segment produced vertices |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2474 |
m_segmentToVertex[i].end = m_vertices.size() - 1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2475 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2476 |
else |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2477 |
{ //segment didn't produce vertices (zero-length segment). Ignore it. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2478 |
m_segmentToVertex[i].start = m_segmentToVertex[i].end = m_vertices.size()-1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2479 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2480 |
prevSegment = segment; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2481 |
coordIndex += coords; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2482 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2483 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2484 |
//add an implicit MOVE_TO to the end to close the last subpath. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2485 |
//if the subpath contained only zero-length segments, this produces the necessary geometry to get it stroked |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2486 |
// and included in path bounds. The geometry won't be included in the pointAlongPath query. |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2487 |
if(prevSegment != VG_MOVE_TO && prevSegment != VG_CLOSE_PATH) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2488 |
addEndPath(pathToSurface, o, s, subpathHasGeometry, IMPLICIT_CLOSE_SUBPATH); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2489 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2490 |
//check that the flags are correct |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2491 |
#ifdef RI_DEBUG |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2492 |
int prev = -1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2493 |
bool subpathStarted = false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2494 |
bool segmentStarted = false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2495 |
for(int i=0;i<m_vertices.size();i++) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2496 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2497 |
Vertex& v = m_vertices[i]; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2498 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2499 |
if(v.flags & START_SUBPATH) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2500 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2501 |
RI_ASSERT(!subpathStarted); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2502 |
RI_ASSERT(v.flags & START_SEGMENT); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2503 |
RI_ASSERT(!(v.flags & END_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2504 |
RI_ASSERT(!(v.flags & END_SEGMENT)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2505 |
RI_ASSERT(!(v.flags & CLOSE_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2506 |
RI_ASSERT(!(v.flags & IMPLICIT_CLOSE_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2507 |
subpathStarted = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2508 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2509 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2510 |
if(v.flags & START_SEGMENT) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2511 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2512 |
RI_ASSERT(subpathStarted || (v.flags & CLOSE_SUBPATH) || (v.flags & IMPLICIT_CLOSE_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2513 |
RI_ASSERT(!segmentStarted); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2514 |
RI_ASSERT(!(v.flags & END_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2515 |
RI_ASSERT(!(v.flags & END_SEGMENT)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2516 |
segmentStarted = true; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2517 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2518 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2519 |
if( v.flags & CLOSE_SUBPATH ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2520 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2521 |
RI_ASSERT(segmentStarted); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2522 |
RI_ASSERT(!subpathStarted); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2523 |
RI_ASSERT((v.flags & START_SEGMENT) || (v.flags & END_SEGMENT)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2524 |
RI_ASSERT(!(v.flags & IMPLICIT_CLOSE_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2525 |
RI_ASSERT(!(v.flags & START_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2526 |
RI_ASSERT(!(v.flags & END_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2527 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2528 |
if( v.flags & IMPLICIT_CLOSE_SUBPATH ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2529 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2530 |
RI_ASSERT(segmentStarted); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2531 |
RI_ASSERT(!subpathStarted); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2532 |
RI_ASSERT((v.flags & START_SEGMENT) || (v.flags & END_SEGMENT)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2533 |
RI_ASSERT(!(v.flags & CLOSE_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2534 |
RI_ASSERT(!(v.flags & START_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2535 |
RI_ASSERT(!(v.flags & END_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2536 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2537 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2538 |
if( prev >= 0 ) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2539 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2540 |
RI_ASSERT(segmentStarted); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2541 |
RI_ASSERT(subpathStarted || ((m_vertices[prev].flags & CLOSE_SUBPATH) && (m_vertices[i].flags & CLOSE_SUBPATH)) || |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2542 |
((m_vertices[prev].flags & IMPLICIT_CLOSE_SUBPATH) && (m_vertices[i].flags & IMPLICIT_CLOSE_SUBPATH))); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2543 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2544 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2545 |
prev = i; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2546 |
if(v.flags & END_SEGMENT) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2547 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2548 |
RI_ASSERT(subpathStarted || (v.flags & CLOSE_SUBPATH) || (v.flags & IMPLICIT_CLOSE_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2549 |
RI_ASSERT(segmentStarted); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2550 |
RI_ASSERT(!(v.flags & START_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2551 |
RI_ASSERT(!(v.flags & START_SEGMENT)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2552 |
segmentStarted = false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2553 |
prev = -1; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2554 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2555 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2556 |
if(v.flags & END_SUBPATH) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2557 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2558 |
RI_ASSERT(subpathStarted); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2559 |
RI_ASSERT(v.flags & END_SEGMENT); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2560 |
RI_ASSERT(!(v.flags & START_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2561 |
RI_ASSERT(!(v.flags & START_SEGMENT)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2562 |
RI_ASSERT(!(v.flags & CLOSE_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2563 |
RI_ASSERT(!(v.flags & IMPLICIT_CLOSE_SUBPATH)); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2564 |
subpathStarted = false; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2565 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2566 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2567 |
#endif //RI_DEBUG |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2568 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2569 |
catch(std::bad_alloc) |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2570 |
{ |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2571 |
m_vertices.clear(); |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2572 |
throw; |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2573 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2574 |
} |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2575 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2576 |
//============================================================================================== |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2577 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2578 |
} //namespace OpenVGRI |
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2579 |
|
2bf8a359aa2f
Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff
changeset
|
2580 |
//============================================================================================== |