Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/BLF_api.h3
-rw-r--r--source/blender/blenfont/CMakeLists.txt1
-rw-r--r--source/blender/blenfont/SConscript2
-rw-r--r--source/blender/blenfont/intern/blf.c5
-rw-r--r--source/blender/blenfont/intern/blf_font.c9
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h4
6 files changed, 14 insertions, 10 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index 0732e02b5fc..ce10951d6ff 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -33,6 +33,7 @@
#define __BLF_API_H__
struct rctf;
+struct ColorManagedDisplay;
int BLF_init(int points, int dpi);
void BLF_exit(void);
@@ -151,7 +152,7 @@ void BLF_shadow_offset(int fontid, int x, int y);
*
* BLF_buffer(NULL, NULL, 0, 0, 0, FALSE);
*/
-void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, int do_color_management);
+void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, struct ColorManagedDisplay *display);
/* Set the color to be used for text. */
void BLF_buffer_col(int fontid, float r, float g, float b, float a);
diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt
index ebf9ff4db39..da60710a137 100644
--- a/source/blender/blenfont/CMakeLists.txt
+++ b/source/blender/blenfont/CMakeLists.txt
@@ -27,6 +27,7 @@ set(INC
../blenlib
../editors/include
../makesdna
+ ../imbuf
../../../intern/guardedalloc
)
diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript
index c46960d2311..d3c7b1c2fcc 100644
--- a/source/blender/blenfont/SConscript
+++ b/source/blender/blenfont/SConscript
@@ -4,7 +4,7 @@ Import ('env')
sources = env.Glob('intern/*.c')
-incs = '. intern #/intern/guardedalloc ../blenkernel ../blenlib ../makesdna ../editors/include'
+incs = '. intern #/intern/guardedalloc ../blenkernel ../blenlib ../makesdna ../imbuf ../editors/include'
incs += ' #/extern/glew/include'
incs += ' ' + env['BF_FREETYPE_INC']
incs += ' ' + env['BF_GETTEXT_INC']
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index d4739b37f93..92fcb576e7d 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -50,7 +50,6 @@
#include "blf_internal_types.h"
#include "blf_internal.h"
-
/* Max number of font in memory.
* Take care that now every font have a glyph cache per size/dpi,
* so we don't need load the same font with different size, just
@@ -746,7 +745,7 @@ void BLF_shadow_offset(int fontid, int x, int y)
}
}
-void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, int do_color_management)
+void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, struct ColorManagedDisplay *display)
{
FontBLF *font = BLF_get(fontid);
@@ -756,7 +755,7 @@ void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int
font->buf_info.w = w;
font->buf_info.h = h;
font->buf_info.ch = nch;
- font->buf_info.do_color_management = do_color_management;
+ font->buf_info.display = display;
}
}
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index cb05c89921e..02b66993c0a 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -53,6 +53,8 @@
#include "BIF_gl.h"
#include "BLF_api.h"
+#include "IMB_colormanagement.h"
+
#include "blf_internal_types.h"
#include "blf_internal.h"
@@ -245,11 +247,12 @@ void blf_font_buffer(FontBLF *font, const char *str)
blf_font_ensure_ascii_table(font);
/* another buffer specific call for color conversion */
- if (buf_info->do_color_management) {
- srgb_to_linearrgb_v4(b_col_float, buf_info->col);
+ if (buf_info->display) {
+ copy_v4_v4(b_col_float, buf_info->col);
+ IMB_colormanagement_display_to_scene_linear_v3(b_col_float, buf_info->display);
}
else {
- copy_v4_v4(b_col_float, buf_info->col);
+ srgb_to_linearrgb_v4(b_col_float, buf_info->col);
}
while (str[i]) {
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 4c617da7583..1acc3dad4cf 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -145,8 +145,8 @@ typedef struct FontBufInfoBLF {
/* number of channels. */
int ch;
- /* is the float buffer linear */
- int do_color_management;
+ /* display device used for color management */
+ struct ColorManagedDisplay *display;
/* and the color, the alphas is get from the glyph!
* color is srgb space */