Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
librsvg
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
174
Issues
174
List
Boards
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
librsvg
Commits
ea8dd583
Commit
ea8dd583
authored
Oct 04, 2005
by
Caleb Michael Moore
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cairo obb fix
parent
f6b986d0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
8 deletions
+45
-8
rsvg-cairo-draw.c
rsvg-cairo-draw.c
+45
-8
No files found.
rsvg-cairo-draw.c
View file @
ea8dd583
...
...
@@ -38,6 +38,10 @@
#include <math.h>
#include <string.h>
typedef
struct
{
int
x
,
y
,
w
,
h
;
}
RsvgCairoBbox
;
static
void
_pattern_add_rsvg_color_stops
(
cairo_pattern_t
*
pattern
,
GPtrArray
*
stops
,
...
...
@@ -67,7 +71,8 @@ static void
_set_source_rsvg_linear_gradient
(
cairo_t
*
cr
,
RsvgLinearGradient
*
linear
,
guint32
current_color_rgb
,
guint8
opacity
)
guint8
opacity
,
RsvgCairoBbox
bbox
)
{
cairo_pattern_t
*
pattern
;
cairo_matrix_t
matrix
;
...
...
@@ -86,6 +91,12 @@ _set_source_rsvg_linear_gradient (cairo_t *cr,
linear
->
affine
[
0
],
linear
->
affine
[
1
],
linear
->
affine
[
2
],
linear
->
affine
[
3
],
linear
->
affine
[
4
],
linear
->
affine
[
5
]);
if
(
linear
->
obj_bbox
){
cairo_matrix_t
bboxmatrix
;
cairo_matrix_init
(
&
bboxmatrix
,
bbox
.
w
,
0
,
0
,
bbox
.
h
,
bbox
.
x
,
bbox
.
y
);
cairo_matrix_multiply
(
&
matrix
,
&
matrix
,
&
bboxmatrix
);
}
cairo_matrix_invert
(
&
matrix
);
cairo_pattern_set_matrix
(
pattern
,
&
matrix
);
...
...
@@ -100,7 +111,8 @@ static void
_set_source_rsvg_radial_gradient
(
cairo_t
*
cr
,
RsvgRadialGradient
*
radial
,
guint32
current_color_rgb
,
guint8
opacity
)
guint8
opacity
,
RsvgCairoBbox
bbox
)
{
cairo_pattern_t
*
pattern
;
cairo_matrix_t
matrix
;
...
...
@@ -120,6 +132,13 @@ _set_source_rsvg_radial_gradient (cairo_t *cr,
radial
->
affine
[
0
],
radial
->
affine
[
1
],
radial
->
affine
[
2
],
radial
->
affine
[
3
],
radial
->
affine
[
4
],
radial
->
affine
[
5
]);
if
(
radial
->
obj_bbox
){
cairo_matrix_t
bboxmatrix
;
cairo_matrix_init
(
&
bboxmatrix
,
bbox
.
w
,
0
,
0
,
bbox
.
h
,
bbox
.
x
,
bbox
.
y
);
cairo_matrix_multiply
(
&
matrix
,
&
matrix
,
&
bboxmatrix
);
}
cairo_matrix_invert
(
&
matrix
);
cairo_pattern_set_matrix
(
pattern
,
&
matrix
);
...
...
@@ -160,16 +179,19 @@ static void
_set_source_rsvg_paint_server
(
cairo_t
*
cr
,
guint32
current_color_rgb
,
RsvgPaintServer
*
ps
,
guint8
opacity
)
guint8
opacity
,
RsvgCairoBbox
bbox
)
{
switch
(
ps
->
type
)
{
case
RSVG_PAINT_SERVER_LIN_GRAD
:
_set_source_rsvg_linear_gradient
(
cr
,
ps
->
core
.
lingrad
,
current_color_rgb
,
opacity
);
current_color_rgb
,
opacity
,
bbox
);
break
;
case
RSVG_PAINT_SERVER_RAD_GRAD
:
_set_source_rsvg_radial_gradient
(
cr
,
ps
->
core
.
radgrad
,
current_color_rgb
,
opacity
);
current_color_rgb
,
opacity
,
bbox
);
break
;
case
RSVG_PAINT_SERVER_SOLID
:
_set_source_rsvg_solid_colour
(
cr
,
ps
->
core
.
colour
,
opacity
);
...
...
@@ -200,6 +222,8 @@ rsvg_cairo_render_path (RsvgDrawingCtx *ctx, const RsvgBpathDef *bpath_def)
cairo_t
*
cr
=
render
->
cr
;
RsvgBpath
*
bpath
;
int
i
;
int
xmin
=
0
,
ymin
=
0
,
xmax
=
0
,
ymax
=
0
,
virgin
=
1
;
RsvgCairoBbox
bbox
;
cairo_save
(
cr
);
...
...
@@ -213,6 +237,12 @@ rsvg_cairo_render_path (RsvgDrawingCtx *ctx, const RsvgBpathDef *bpath_def)
for
(
i
=
0
;
i
<
bpath_def
->
n_bpath
;
i
++
)
{
bpath
=
&
bpath_def
->
bpath
[
i
];
if
(
bpath
->
x3
<
xmin
||
virgin
)
xmin
=
bpath
->
x3
;
if
(
bpath
->
x3
>
xmax
||
virgin
)
xmax
=
bpath
->
x3
;
if
(
bpath
->
y3
<
ymin
||
virgin
)
ymin
=
bpath
->
y3
;
if
(
bpath
->
y3
>
ymax
||
virgin
)
ymax
=
bpath
->
y3
;
virgin
=
0
;
switch
(
bpath
->
code
)
{
case
RSVG_MOVETO
:
cairo_close_path
(
cr
);
...
...
@@ -234,6 +264,11 @@ rsvg_cairo_render_path (RsvgDrawingCtx *ctx, const RsvgBpathDef *bpath_def)
}
}
bbox
.
x
=
xmin
;
bbox
.
y
=
ymin
;
bbox
.
w
=
xmax
-
xmin
;
bbox
.
h
=
ymax
-
ymin
;
if
(
state
->
fill
!=
NULL
)
{
if
(
state
->
fill_rule
==
FILL_RULE_EVENODD
)
cairo_set_fill_rule
(
cr
,
CAIRO_FILL_RULE_EVEN_ODD
);
...
...
@@ -243,7 +278,8 @@ rsvg_cairo_render_path (RsvgDrawingCtx *ctx, const RsvgBpathDef *bpath_def)
_set_source_rsvg_paint_server
(
cr
,
state
->
current_color
,
state
->
fill
,
state
->
fill_opacity
);
state
->
fill_opacity
,
bbox
);
if
(
state
->
stroke
!=
NULL
)
cairo_fill_preserve
(
cr
);
...
...
@@ -255,7 +291,8 @@ rsvg_cairo_render_path (RsvgDrawingCtx *ctx, const RsvgBpathDef *bpath_def)
_set_source_rsvg_paint_server
(
cr
,
state
->
current_color
,
state
->
stroke
,
state
->
stroke_opacity
);
state
->
stroke_opacity
,
bbox
);
cairo_stroke
(
cr
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment