[Bf-blender-cvs] [e5e885d0ecb] master: Fix floating panel (HUD) applying DPI incorrectly
Julian Eisel
noreply at git.blender.org
Sun Dec 23 22:45:35 CET 2018
Commit: e5e885d0ecb9430a73e0a904cdb6035a2ef77e98
Author: Julian Eisel
Date: Sun Dec 23 22:31:04 2018 +0100
Branches: master
https://developer.blender.org/rBe5e885d0ecb9430a73e0a904cdb6035a2ef77e98
Fix floating panel (HUD) applying DPI incorrectly
ARegion.sizex/y should never have DPI factor applied. For regular panel
regions, DPI will be applied in region_rect_recursive already, causing
it to be applied twice when region size is set dynamically (= based on
content dimensions).
===================================================================
M source/blender/editors/interface/interface_region_hud.c
M source/blender/editors/screen/area.c
===================================================================
diff --git a/source/blender/editors/interface/interface_region_hud.c b/source/blender/editors/interface/interface_region_hud.c
index 0a5a88f2cb6..c30958a4d3a 100644
--- a/source/blender/editors/interface/interface_region_hud.c
+++ b/source/blender/editors/interface/interface_region_hud.c
@@ -188,8 +188,8 @@ static void hud_region_layout(const bContext *C, ARegion *ar)
if (ar->panels.first && (ar->sizey != size_y)) {
View2D *v2d = &ar->v2d;
- ar->winx = ar->sizex;
- ar->winy = ar->sizey;
+ ar->winx = ar->sizex * UI_DPI_FAC;
+ ar->winy = ar->sizey * UI_DPI_FAC;
ar->winrct.xmax = (ar->winrct.xmin + ar->winx) - 1;
ar->winrct.ymax = (ar->winrct.ymin + ar->winy) - 1;
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 43ff12540db..47c44468bc7 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1250,8 +1250,8 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, rct
max_ii(0, BLI_rcti_size_y(overlap_remainder) - UI_UNIT_Y / 2));
ar->winrct.xmin = overlap_remainder_margin.xmin;
ar->winrct.ymin = overlap_remainder_margin.ymin;
- ar->winrct.xmax = ar->winrct.xmin + ar->sizex - 1;
- ar->winrct.ymax = ar->winrct.ymin + ar->sizey - 1;
+ ar->winrct.xmax = ar->winrct.xmin + prefsizex - 1;
+ ar->winrct.ymax = ar->winrct.ymin + prefsizey - 1;
BLI_rcti_isect(&ar->winrct, &overlap_remainder_margin, &ar->winrct);
@@ -2308,8 +2308,8 @@ void ED_region_panels_layout_ex(
Panel *panel = ar->panels.last;
if (panel != NULL) {
int size_dyn[2] = {
- UI_UNIT_X * ((panel->flag & PNL_CLOSED) ? 8 : 14),
- UI_panel_size_y(panel),
+ UI_UNIT_X * ((panel->flag & PNL_CLOSED) ? 8 : 14) / UI_DPI_FAC,
+ UI_panel_size_y(panel) / UI_DPI_FAC,
};
/* region size is layout based and needs to be updated */
if ((ar->sizex != size_dyn[0]) ||
@@ -2319,7 +2319,7 @@ void ED_region_panels_layout_ex(
ar->sizey = size_dyn[1];
sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE;
}
- y = ABS(ar->sizey - 1);
+ y = ABS(ar->sizey * UI_DPI_FAC - 1);
}
}
else if (vertical) {
More information about the Bf-blender-cvs
mailing list