From 7c99fa905e55f58bca9524a3e732bb36a044b4df Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Thu, 23 Jun 2016 09:51:56 +0200 Subject: [PATCH] Init and clear functions for annotation border --- .../annotation-square-and-circle.c | 1 + libzathura/annotations/border.c | 35 +++++++++++++++++++ libzathura/annotations/border.h | 4 +++ 3 files changed, 40 insertions(+) create mode 100644 libzathura/annotations/border.c diff --git a/libzathura/annotations/annotation-square-and-circle.c b/libzathura/annotations/annotation-square-and-circle.c index f66b6f0..9e99a3c 100644 --- a/libzathura/annotations/annotation-square-and-circle.c +++ b/libzathura/annotations/annotation-square-and-circle.c @@ -2,6 +2,7 @@ #include #include +#include #include "../annotations.h" #include "annotation-caret.h" diff --git a/libzathura/annotations/border.c b/libzathura/annotations/border.c new file mode 100644 index 0000000..083e559 --- /dev/null +++ b/libzathura/annotations/border.c @@ -0,0 +1,35 @@ +/* See LICENSE file for license and copyright information */ + +#include "border.h" + +zathura_error_t +zathura_annotation_border_init(zathura_annotation_border_t* annotation_border) +{ + if (annotation_border == NULL) { + return ZATHURA_ERROR_INVALID_ARGUMENTS; + } + + annotation_border->width = 1; + annotation_border->style = ZATHURA_ANNOTATION_BORDER_STYLE_SOLID; + annotation_border->dash_pattern.dash_array = NULL; + annotation_border->dash_pattern.dash_phase = 0; + annotation_border->effect = ZATHURA_ANNOTATION_BORDER_EFFECT_NONE; + annotation_border->intensity = 0; + + return ZATHURA_ERROR_OK; +} + +zathura_error_t +zathura_annotation_border_clear(zathura_annotation_border_t* annotation_border) +{ + if (annotation_border == NULL) { + return ZATHURA_ERROR_INVALID_ARGUMENTS; + } + + if (annotation_border->dash_pattern.dash_array != NULL) { + zathura_list_free(annotation_border->dash_pattern.dash_array); + annotation_border->dash_pattern.dash_array = NULL; + } + + return ZATHURA_ERROR_OK; +} diff --git a/libzathura/annotations/border.h b/libzathura/annotations/border.h index ffd84db..2803b7f 100644 --- a/libzathura/annotations/border.h +++ b/libzathura/annotations/border.h @@ -8,6 +8,7 @@ extern "C" { #endif #include "../list.h" +#include "../error.h" /** * The border style. @@ -107,6 +108,9 @@ typedef struct zathura_annotation_border_s { float intensity; } zathura_annotation_border_t; +zathura_error_t zathura_annotation_border_init(zathura_annotation_border_t* annotation_border); +zathura_error_t zathura_annotation_border_clear(zathura_annotation_border_t* annotation_border); + #ifdef __cplusplus } #endif -- 2.26.2