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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-21 11:43:36 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-21 11:46:08 +0300
commit495c7463fc39b8bec1f678af28e94a207e0d1217 (patch)
treee2a03919bb8d1afb098c96a4c41705b40f2234f6 /source/blender/windowmanager/intern/wm_operators.c
parent87bbf4439db557decf8a62461056dd433d67e883 (diff)
UI: fractional DPI scaling of splash, instead of always 1x or 2x.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_operators.c')
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 7b231e6fd6b..928995ce248 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1416,7 +1416,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
#endif /* WITH_BUILDINFO */
#ifndef WITH_HEADLESS
- if (U.pixelsize == 2) {
+ if (U.dpi_fac > 1.0) {
ibuf = IMB_ibImageFromMemory((unsigned char *)datatoc_splash_2x_png,
datatoc_splash_2x_png_size, IB_rect, NULL, "<splash screen>");
}
@@ -1441,7 +1441,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
ibuf_template = IMB_loadiffname(splash_filepath, IB_rect, NULL);
if (ibuf_template) {
const int x_expect = ibuf->x;
- const int y_expect = 282 * (int)U.pixelsize;
+ const int y_expect = 282 * (int)U.dpi_fac;
/* don't cover the header text */
if (ibuf_template->x == x_expect && ibuf_template->y == y_expect) {
memcpy(ibuf->rect, ibuf_template->rect, ibuf_template->x * ibuf_template->y * sizeof(char[4]));
@@ -1465,8 +1465,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_KEEP_OPEN | UI_BLOCK_NO_WIN_CLIP);
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
- /* XXX splash scales with pixelsize, should become widget-units */
- but = uiDefBut(block, UI_BTYPE_IMAGE, 0, "", 0, 0.5f * U.widget_unit, U.pixelsize * 501, U.pixelsize * 282, ibuf, 0.0, 0.0, 0, 0, ""); /* button owns the imbuf now */
+ but = uiDefBut(block, UI_BTYPE_IMAGE, 0, "", 0, 0.5f * U.widget_unit, U.dpi_fac * 501, U.dpi_fac * 282, ibuf, 0.0, 0.0, 0, 0, ""); /* button owns the imbuf now */
UI_but_func_set(but, wm_block_splash_close, block, NULL);
UI_block_func_set(block, wm_block_splash_refreshmenu, block, NULL);
@@ -1487,9 +1486,9 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
if (version_suffix != NULL && version_suffix[0]) {
/* placed after the version number in the image,
* placing y is tricky to match baseline */
- int x = 236 * U.pixelsize - (2 * UI_DPI_FAC);
- int y = 231 * U.pixelsize + (4 * UI_DPI_FAC);
- int w = 240 * U.pixelsize;
+ int x = 234 * U.dpi_fac;
+ int y = 235 * U.dpi_fac;
+ int w = 240 * U.dpi_fac;
/* hack to have text draw 'text_sel' */
UI_block_emboss_set(block, UI_EMBOSS_NONE);
@@ -1503,7 +1502,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
if (build_commit_timestamp != 0) {
but = uiDefBut(
block, UI_BTYPE_LABEL, 0, date_buf,
- U.pixelsize * 502 - date_width, U.pixelsize * 267,
+ U.dpi_fac * 502 - date_width, U.dpi_fac * 267,
date_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
/* XXX, set internal flag - UI_SELECT */
UI_but_flag_enable(but, 1);
@@ -1511,7 +1510,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
}
but = uiDefBut(
block, UI_BTYPE_LABEL, 0, hash_buf,
- U.pixelsize * 502 - hash_width, U.pixelsize * (267 - label_delta),
+ U.dpi_fac * 502 - hash_width, U.dpi_fac * (267 - label_delta),
hash_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
/* XXX, set internal flag - UI_SELECT */
UI_but_flag_enable(but, 1);
@@ -1523,7 +1522,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
branch_width = (int)BLF_width(style->widgetlabel.uifont_id, branch_buf, sizeof(branch_buf)) + U.widget_unit;
but = uiDefBut(
block, UI_BTYPE_LABEL, 0, branch_buf,
- U.pixelsize * 502 - branch_width, U.pixelsize * (255 - label_delta),
+ U.dpi_fac * 502 - branch_width, U.dpi_fac * (255 - label_delta),
branch_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
/* XXX, set internal flag - UI_SELECT */
UI_but_flag_enable(but, 1);
@@ -1532,7 +1531,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiLayout *layout = UI_block_layout(
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2,
- U.pixelsize * 480, U.pixelsize * 110, 0, style);
+ U.dpi_fac * 480, U.dpi_fac * 110, 0, style);
MenuType *mt = WM_menutype_find("WM_MT_splash", true);
if (mt) {