Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ankur Sinha
libzathura
Commits
19d36801
Commit
19d36801
authored
Jun 29, 2016
by
Moritz Lipp
Browse files
Just save a single border for a polygon/poly line
parent
7c99fa90
Changes
10
Hide whitespace changes
Inline
Side-by-side
libzathura/annotations/annotation-polygon.c
View file @
19d36801
...
...
@@ -91,31 +91,31 @@ zathura_annotation_polygon_get_vertices(zathura_annotation_t* annotation,
}
zathura_error_t
zathura_annotation_polygon_set_border
s
(
zathura_annotation_t
*
annotation
,
zathura_
list
_t
*
border
s
)
zathura_annotation_polygon_set_border
(
zathura_annotation_t
*
annotation
,
zathura_
annotation_border
_t
border
)
{
if
(
annotation
==
NULL
||
borders
==
NULL
)
{
if
(
annotation
==
NULL
)
{
return
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
ANNOTATION_POLYGON_CHECK_TYPE_AND_DATA
()
annotation
->
data
.
polygon
->
border
s
=
border
s
;
annotation
->
data
.
polygon
->
border
=
border
;
return
ZATHURA_ERROR_OK
;
}
zathura_error_t
zathura_annotation_polygon_get_border
s
(
zathura_annotation_t
*
annotation
,
zathura_
list
_t
*
*
border
s
)
zathura_annotation_polygon_get_border
(
zathura_annotation_t
*
annotation
,
zathura_
annotation_border
_t
*
border
)
{
if
(
annotation
==
NULL
||
border
s
==
NULL
)
{
if
(
annotation
==
NULL
||
border
==
NULL
)
{
return
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
ANNOTATION_POLYGON_CHECK_TYPE_AND_DATA
()
*
border
s
=
annotation
->
data
.
polygon
->
border
s
;
*
border
=
annotation
->
data
.
polygon
->
border
;
return
ZATHURA_ERROR_OK
;
}
...
...
libzathura/annotations/annotation-polygon.h
View file @
19d36801
...
...
@@ -40,32 +40,32 @@ zathura_error_t zathura_annotation_polygon_set_vertices(zathura_annotation_t* an
zathura_error_t
zathura_annotation_polygon_get_vertices
(
zathura_annotation_t
*
annotation
,
zathura_list_t
**
vertices
);
/**
* Sets a
list of
zathura_border_t borders specifying the width and dash pattern
*
to be
used in drawing the line.
* Sets a zathura_border_t borders specifying the width and dash pattern
to be
* used in drawing the line.
*
* @param[in] annotation The annotation
* @param[in] border
s
The
list of
border
s
* @param[in] border The border
*
* @return ZATHURA_ERROR_OK No error occurred
* @return ZATHURA_ERROR_INVALID_ARGUMENTS Invalid arguments have been passed
* @return ZATHURA_ERROR_ANNOTATION_INVALID_TYPE Mismatching type of annotation passed
* @return ZATHURA_ERROR_UNKNOWN An unspecified error occurred
*/
zathura_error_t
zathura_annotation_polygon_set_border
s
(
zathura_annotation_t
*
annotation
,
zathura_
list
_t
*
border
s
);
zathura_error_t
zathura_annotation_polygon_set_border
(
zathura_annotation_t
*
annotation
,
zathura_
annotation_border
_t
border
);
/**
* Returns
a list of
zathura_border_t border
s
specifying the width and dash pattern
*
to
be used in drawing the line.
* Returns
the
zathura_border_t border specifying the width and dash pattern
to
* be used in drawing the line.
*
* @param[in] annotation The annotation
* @param[out] border
s
The
list of
border
s
* @param[out] border The border
*
* @return ZATHURA_ERROR_OK No error occurred
* @return ZATHURA_ERROR_INVALID_ARGUMENTS Invalid arguments have been passed
* @return ZATHURA_ERROR_ANNOTATION_INVALID_TYPE Mismatching type of annotation passed
* @return ZATHURA_ERROR_UNKNOWN An unspecified error occurred
*/
zathura_error_t
zathura_annotation_polygon_get_border
s
(
zathura_annotation_t
*
annotation
,
zathura_
list
_t
*
*
border
s
);
zathura_error_t
zathura_annotation_polygon_get_border
(
zathura_annotation_t
*
annotation
,
zathura_
annotation_border
_t
*
border
);
/**
* Sets the interior color of the polygon annotation with which to fill the
...
...
libzathura/annotations/annotation-polyline.c
View file @
19d36801
...
...
@@ -123,31 +123,31 @@ zathura_annotation_poly_line_get_line_ending(zathura_annotation_t*
}
zathura_error_t
zathura_annotation_poly_line_set_border
s
(
zathura_annotation_t
*
annotation
,
zathura_
list
_t
*
border
s
)
zathura_annotation_poly_line_set_border
(
zathura_annotation_t
*
annotation
,
zathura_
annotation_border
_t
border
)
{
if
(
annotation
==
NULL
||
borders
==
NULL
)
{
if
(
annotation
==
NULL
)
{
return
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
ANNOTATION_POLY_LINE_CHECK_TYPE_AND_DATA
()
annotation
->
data
.
poly_line
->
border
s
=
border
s
;
annotation
->
data
.
poly_line
->
border
=
border
;
return
ZATHURA_ERROR_OK
;
}
zathura_error_t
zathura_annotation_poly_line_get_border
s
(
zathura_annotation_t
*
annotation
,
zathura_
list
_t
*
*
border
s
)
zathura_annotation_poly_line_get_border
(
zathura_annotation_t
*
annotation
,
zathura_
annotation_border
_t
*
border
)
{
if
(
annotation
==
NULL
||
border
s
==
NULL
)
{
if
(
annotation
==
NULL
||
border
==
NULL
)
{
return
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
ANNOTATION_POLY_LINE_CHECK_TYPE_AND_DATA
()
*
border
s
=
annotation
->
data
.
poly_line
->
border
s
;
*
border
=
annotation
->
data
.
poly_line
->
border
;
return
ZATHURA_ERROR_OK
;
}
...
...
libzathura/annotations/annotation-polyline.h
View file @
19d36801
...
...
@@ -68,32 +68,32 @@ zathura_error_t zathura_annotation_poly_line_get_line_ending(zathura_annotation_
annotation
,
zathura_annotation_line_ending_t
line_ending
[
2
]);
/**
* Sets a
list of
zathura_border_t borders specifying the width and dash pattern
*
to be
used in drawing the line.
* Sets a zathura_border_t borders specifying the width and dash pattern
to be
* used in drawing the line.
*
* @param[in] annotation The annotation
* @param[in] border
s
The
list of
border
s
* @param[in] border The border
*
* @return ZATHURA_ERROR_OK No error occurred
* @return ZATHURA_ERROR_INVALID_ARGUMENTS Invalid arguments have been passed
* @return ZATHURA_ERROR_ANNOTATION_INVALID_TYPE Mismatching type of annotation passed
* @return ZATHURA_ERROR_UNKNOWN An unspecified error occurred
*/
zathura_error_t
zathura_annotation_poly_line_set_border
s
(
zathura_annotation_t
*
annotation
,
zathura_
list
_t
*
border
s
);
zathura_error_t
zathura_annotation_poly_line_set_border
(
zathura_annotation_t
*
annotation
,
zathura_
annotation_border
_t
border
);
/**
* Returns
a list of
zathura_border_t border
s
specifying the width and dash pattern
*
to
be used in drawing the line.
* Returns
the
zathura_border_t border specifying the width and dash pattern
to
* be used in drawing the line.
*
* @param[in] annotation The annotation
* @param[out] border
s
The
list of
border
s
* @param[out] border The border
*
* @return ZATHURA_ERROR_OK No error occurred
* @return ZATHURA_ERROR_INVALID_ARGUMENTS Invalid arguments have been passed
* @return ZATHURA_ERROR_ANNOTATION_INVALID_TYPE Mismatching type of annotation passed
* @return ZATHURA_ERROR_UNKNOWN An unspecified error occurred
*/
zathura_error_t
zathura_annotation_poly_line_get_border
s
(
zathura_annotation_t
*
annotation
,
zathura_
list
_t
*
*
border
s
);
zathura_error_t
zathura_annotation_poly_line_get_border
(
zathura_annotation_t
*
annotation
,
zathura_
annotation_border
_t
*
border
);
/**
* Sets the interior color of the poly-line annotation with which to fill the
...
...
libzathura/annotations/annotation-square-and-circle.c
View file @
19d36801
...
...
@@ -194,4 +194,3 @@ zathura_annotation_square_get_border(zathura_annotation_t*
{
return
zathura_annotation_circle_get_border
(
annotation
,
border
);
}
libzathura/annotations/internal/annotation-polygon.h
View file @
19d36801
...
...
@@ -22,7 +22,7 @@ typedef struct zathura_annotation_polygon_s {
* A border style dictionary specifying the width and dash pattern to be used
* in drawing the line.
*/
zathura_
list
_t
*
border
s
;
zathura_
annotation_border
_t
border
;
/**
* An array of numbers in the range 0.0 to 1.0 specifying the interior color
...
...
libzathura/annotations/internal/annotation-polyline.h
View file @
19d36801
...
...
@@ -34,7 +34,7 @@ typedef struct zathura_annotation_poly_line_s {
* A border style dictionary specifying the width and dash pattern to be used
* in drawing the line.
*/
zathura_
list
_t
*
border
s
;
zathura_
annotation_border
_t
border
;
/**
* An array of numbers in the range 0.0 to 1.0 specifying the interior color
...
...
tests/annotations.c
View file @
19d36801
...
...
@@ -585,8 +585,8 @@ suite_annotations(void)
tcase_add_test
(
tcase
,
test_annotation_polygon_clear
);
tcase_add_test
(
tcase
,
test_annotation_polygon_set_vertices
);
tcase_add_test
(
tcase
,
test_annotation_polygon_get_vertices
);
tcase_add_test
(
tcase
,
test_annotation_polygon_set_border
s
);
tcase_add_test
(
tcase
,
test_annotation_polygon_get_border
s
);
tcase_add_test
(
tcase
,
test_annotation_polygon_set_border
);
tcase_add_test
(
tcase
,
test_annotation_polygon_get_border
);
tcase_add_test
(
tcase
,
test_annotation_polygon_set_interior_color
);
tcase_add_test
(
tcase
,
test_annotation_polygon_get_interior_color
);
tcase_add_test
(
tcase
,
test_annotation_polygon_set_intent
);
...
...
@@ -605,8 +605,8 @@ suite_annotations(void)
tcase_add_test
(
tcase
,
test_annotation_poly_line_get_vertices
);
tcase_add_test
(
tcase
,
test_annotation_poly_line_set_line_ending
);
tcase_add_test
(
tcase
,
test_annotation_poly_line_get_line_ending
);
tcase_add_test
(
tcase
,
test_annotation_poly_line_set_border
s
);
tcase_add_test
(
tcase
,
test_annotation_poly_line_get_border
s
);
tcase_add_test
(
tcase
,
test_annotation_poly_line_set_border
);
tcase_add_test
(
tcase
,
test_annotation_poly_line_get_border
);
tcase_add_test
(
tcase
,
test_annotation_poly_line_set_interior_color
);
tcase_add_test
(
tcase
,
test_annotation_poly_line_get_interior_color
);
tcase_add_test
(
tcase
,
test_annotation_poly_line_set_intent
);
...
...
tests/annotations/annotation-polygon.c
View file @
19d36801
...
...
@@ -71,30 +71,26 @@ START_TEST(test_annotation_polygon_get_vertices) {
fail_unless
(
zathura_annotation_polygon_get_vertices
(
annotation
,
&
vertices
)
==
ZATHURA_ERROR_OK
);
}
END_TEST
START_TEST
(
test_annotation_polygon_set_borders
)
{
zathura_list_t
*
borders
=
zathura_list_alloc
();
fail_unless
(
borders
!=
NULL
);
START_TEST
(
test_annotation_polygon_set_border
)
{
zathura_annotation_border_t
border
;
/* invalid arguments */
fail_unless
(
zathura_annotation_polygon_set_borders
(
NULL
,
NULL
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_polygon_set_borders
(
annotation
,
NULL
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_polygon_set_borders
(
NULL
,
borders
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_polygon_set_border
(
NULL
,
border
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
/* valid arguments */
fail_unless
(
zathura_annotation_polygon_set_borders
(
annotation
,
borders
)
==
ZATHURA_ERROR_OK
);
zathura_list_free
(
borders
);
fail_unless
(
zathura_annotation_polygon_set_border
(
annotation
,
border
)
==
ZATHURA_ERROR_OK
);
}
END_TEST
START_TEST
(
test_annotation_polygon_get_border
s
)
{
zathura_
list
_t
*
border
s
;
START_TEST
(
test_annotation_polygon_get_border
)
{
zathura_
annotation_border
_t
border
;
/* invalid arguments */
fail_unless
(
zathura_annotation_polygon_get_border
s
(
NULL
,
NULL
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_polygon_get_border
s
(
annotation
,
NULL
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_polygon_get_border
s
(
NULL
,
&
border
s
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_polygon_get_border
(
NULL
,
NULL
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_polygon_get_border
(
annotation
,
NULL
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_polygon_get_border
(
NULL
,
&
border
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
/* valid arguments */
fail_unless
(
zathura_annotation_polygon_get_border
s
(
annotation
,
&
border
s
)
==
ZATHURA_ERROR_OK
);
fail_unless
(
zathura_annotation_polygon_get_border
(
annotation
,
&
border
)
==
ZATHURA_ERROR_OK
);
}
END_TEST
START_TEST
(
test_annotation_polygon_set_interior_color
)
{
...
...
tests/annotations/annotation-polyline.c
View file @
19d36801
...
...
@@ -95,30 +95,26 @@ START_TEST(test_annotation_poly_line_get_line_ending) {
fail_unless
(
line_ending
[
1
]
==
ZATHURA_ANNOTATION_LINE_ENDING_CIRCLE
);
}
END_TEST
START_TEST
(
test_annotation_poly_line_set_borders
)
{
zathura_list_t
*
borders
=
zathura_list_alloc
();
fail_unless
(
borders
!=
NULL
);
START_TEST
(
test_annotation_poly_line_set_border
)
{
zathura_annotation_border_t
border
;
/* invalid arguments */
fail_unless
(
zathura_annotation_poly_line_set_borders
(
NULL
,
NULL
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_poly_line_set_borders
(
annotation
,
NULL
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_poly_line_set_borders
(
NULL
,
borders
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_poly_line_set_border
(
NULL
,
border
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
/* valid arguments */
fail_unless
(
zathura_annotation_poly_line_set_borders
(
annotation
,
borders
)
==
ZATHURA_ERROR_OK
);
zathura_list_free
(
borders
);
fail_unless
(
zathura_annotation_poly_line_set_border
(
annotation
,
border
)
==
ZATHURA_ERROR_OK
);
}
END_TEST
START_TEST
(
test_annotation_poly_line_get_border
s
)
{
zathura_
list
_t
*
border
s
;
START_TEST
(
test_annotation_poly_line_get_border
)
{
zathura_
annotation_border
_t
border
;
/* invalid arguments */
fail_unless
(
zathura_annotation_poly_line_get_border
s
(
NULL
,
NULL
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_poly_line_get_border
s
(
annotation
,
NULL
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_poly_line_get_border
s
(
NULL
,
&
border
s
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_poly_line_get_border
(
NULL
,
NULL
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_poly_line_get_border
(
annotation
,
NULL
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
fail_unless
(
zathura_annotation_poly_line_get_border
(
NULL
,
&
border
)
==
ZATHURA_ERROR_INVALID_ARGUMENTS
);
/* valid arguments */
fail_unless
(
zathura_annotation_poly_line_get_border
s
(
annotation
,
&
border
s
)
==
ZATHURA_ERROR_OK
);
fail_unless
(
zathura_annotation_poly_line_get_border
(
annotation
,
&
border
)
==
ZATHURA_ERROR_OK
);
}
END_TEST
START_TEST
(
test_annotation_poly_line_set_interior_color
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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