Commit 7d5863ae authored by Sebastian Ramacher's avatar Sebastian Ramacher
Browse files

Clean up includes


Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 08a87f67
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
#include <math.h> #include <math.h>
#include <girara/datastructures.h> #include <girara/datastructures.h>
#include <girara/utils.h> #include <girara/utils.h>
#include <girara/session.h>
#include <girara/settings.h>
#include "glib-compat.h" #include "glib-compat.h"
#include "render.h" #include "render.h"
#include "zathura.h" #include "zathura.h"
...@@ -264,13 +262,11 @@ zathura_renderer_get_recolor_colors(ZathuraRenderer* renderer, ...@@ -264,13 +262,11 @@ zathura_renderer_get_recolor_colors(ZathuraRenderer* renderer,
light->red = priv->recolor.light_gdk.red; light->red = priv->recolor.light_gdk.red;
light->blue = priv->recolor.light_gdk.blue; light->blue = priv->recolor.light_gdk.blue;
light->green = priv->recolor.light_gdk.green; light->green = priv->recolor.light_gdk.green;
color2double(light, priv->recolor.light);
} }
if (dark != NULL) { if (dark != NULL) {
dark->red = priv->recolor.dark_gdk.red; dark->red = priv->recolor.dark_gdk.red;
dark->blue = priv->recolor.dark_gdk.blue; dark->blue = priv->recolor.dark_gdk.blue;
dark->green = priv->recolor.dark_gdk.green; dark->green = priv->recolor.dark_gdk.green;
color2double(dark, priv->recolor.dark);
} }
} }
...@@ -504,6 +500,12 @@ render(ZathuraRenderRequest* request, ZathuraRenderer* renderer) ...@@ -504,6 +500,12 @@ render(ZathuraRenderRequest* request, ZathuraRenderer* renderer)
const double l1 = (a[0]*rgb1[0] + a[1]*rgb1[1] + a[2]*rgb1[2]); const double l1 = (a[0]*rgb1[0] + a[1]*rgb1[1] + a[2]*rgb1[2]);
const double l2 = (a[0]*rgb2[0] + a[1]*rgb2[1] + a[2]*rgb2[2]); const double l2 = (a[0]*rgb2[0] + a[1]*rgb2[1] + a[2]*rgb2[2]);
const double rgb_diff[] = {
rgb2[0] - rgb1[0],
rgb2[1] - rgb1[1],
rgb2[2] - rgb1[2]
};
for (unsigned int y = 0; y < page_height; y++) { for (unsigned int y = 0; y < page_height; y++) {
unsigned char* data = image + y * rowstride; unsigned char* data = image + y * rowstride;
...@@ -549,9 +551,9 @@ render(ZathuraRenderRequest* request, ZathuraRenderer* renderer) ...@@ -549,9 +551,9 @@ render(ZathuraRenderRequest* request, ZathuraRenderer* renderer)
} else { } else {
/* linear interpolation between dark and light with color ligtness as /* linear interpolation between dark and light with color ligtness as
* a parameter */ * a parameter */
data[2] = (unsigned char)round(255.*(t * (rgb2[0] - rgb1[0]) + rgb1[0])); data[2] = (unsigned char)round(255.*(t * rgb_diff[0] + rgb1[0]));
data[1] = (unsigned char)round(255.*(t * (rgb2[1] - rgb1[1]) + rgb1[1])); data[1] = (unsigned char)round(255.*(t * rgb_diff[1] + rgb1[1]));
data[0] = (unsigned char)round(255.*(t * (rgb2[2] - rgb1[2]) + rgb1[2])); data[0] = (unsigned char)round(255.*(t * rgb_diff[2] + rgb1[2]));
} }
} }
} }
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <glib-object.h>
#include <gdk/gdk.h>
#include <girara/types.h> #include <girara/types.h>
#include "types.h" #include "types.h"
......
...@@ -717,6 +717,7 @@ document_open(zathura_t* zathura, const char* path, const char* password, ...@@ -717,6 +717,7 @@ document_open(zathura_t* zathura, const char* path, const char* password,
goto error_free; goto error_free;
} }
/* set up recolor info in ZathuraRenderer */
char* recolor_dark = NULL; char* recolor_dark = NULL;
char* recolor_light = NULL; char* recolor_light = NULL;
girara_setting_get(zathura->ui.session, "recolor-darkcolor", &recolor_dark); girara_setting_get(zathura->ui.session, "recolor-darkcolor", &recolor_dark);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment