Vulkan: Push constants #104880
|
@ -93,7 +93,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
|
|||
}
|
||||
|
||||
RECT win_rect = {left, top, long(left + width), long(top + height)};
|
||||
adjustWindowRectForClosestMonitor(&win_rect, style, extended_style);
|
||||
adjustWindowRectForDesktop(&win_rect, style, extended_style);
|
||||
|
||||
wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
|
||||
m_hWnd = ::CreateWindowExW(extended_style, /* window extended style */
|
||||
|
@ -298,24 +298,55 @@ GHOST_WindowWin32::~GHOST_WindowWin32()
|
|||
m_directManipulationHelper = NULL;
|
||||
}
|
||||
|
||||
void GHOST_WindowWin32::adjustWindowRectForClosestMonitor(LPRECT win_rect,
|
||||
DWORD dwStyle,
|
||||
DWORD dwExStyle)
|
||||
void GHOST_WindowWin32::adjustWindowRectForDesktop(LPRECT win_rect, DWORD dwStyle, DWORD dwExStyle)
|
||||
{
|
||||
/* Get Details of the closest monitor. */
|
||||
HMONITOR hmonitor = MonitorFromRect(win_rect, MONITOR_DEFAULTTONEAREST);
|
||||
/* Windows can span multiple monitors, but must be usable. The desktop can have a larger
|
||||
* surface than all monitors combined, for example when two monitors are aligned diagonally.
|
||||
* Therefore we ensure that all the window's corners are within some monitor's Work area. */
|
||||
|
||||
POINT pt;
|
||||
HMONITOR hmonitor;
|
||||
MONITORINFOEX monitor;
|
||||
monitor.cbSize = sizeof(MONITORINFOEX);
|
||||
monitor.dwFlags = 0;
|
||||
GetMonitorInfo(hmonitor, &monitor);
|
||||
|
||||
/* Constrain requested size and position to fit within this monitor. */
|
||||
LONG width = min(monitor.rcWork.right - monitor.rcWork.left, win_rect->right - win_rect->left);
|
||||
LONG height = min(monitor.rcWork.bottom - monitor.rcWork.top, win_rect->bottom - win_rect->top);
|
||||
win_rect->left = min(max(monitor.rcWork.left, win_rect->left), monitor.rcWork.right - width);
|
||||
win_rect->right = win_rect->left + width;
|
||||
win_rect->top = min(max(monitor.rcWork.top, win_rect->top), monitor.rcWork.bottom - height);
|
||||
win_rect->bottom = win_rect->top + height;
|
||||
/* We'll need this value before it is altered for checking later. */
|
||||
LONG requested_top = win_rect->top;
|
||||
|
||||
/* Note that with MonitorFromPoint using MONITOR_DEFAULTTONEAREST, it will return
|
||||
* the exact monitor if there is one at the location or the nearest monitor if not. */
|
||||
|
||||
/* Top-left. */
|
||||
pt.x = win_rect->left;
|
||||
pt.y = win_rect->top;
|
||||
hmonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
|
||||
GetMonitorInfo(hmonitor, &monitor);
|
||||
win_rect->top = max(win_rect->top, monitor.rcWork.top);
|
||||
win_rect->left = max(win_rect->left, monitor.rcWork.left);
|
||||
|
||||
/* Top-right. */
|
||||
pt.x = win_rect->right;
|
||||
pt.y = win_rect->top;
|
||||
hmonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
|
||||
GetMonitorInfo(hmonitor, &monitor);
|
||||
win_rect->top = max(win_rect->top, monitor.rcWork.top);
|
||||
win_rect->right = min(win_rect->right, monitor.rcWork.right);
|
||||
|
||||
/* Bottom-left. */
|
||||
pt.x = win_rect->left;
|
||||
pt.y = win_rect->bottom;
|
||||
hmonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
|
||||
GetMonitorInfo(hmonitor, &monitor);
|
||||
win_rect->bottom = min(win_rect->bottom, monitor.rcWork.bottom);
|
||||
win_rect->left = max(win_rect->left, monitor.rcWork.left);
|
||||
|
||||
/* Bottom-right. */
|
||||
pt.x = win_rect->right;
|
||||
pt.y = win_rect->bottom;
|
||||
hmonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
|
||||
GetMonitorInfo(hmonitor, &monitor);
|
||||
win_rect->bottom = min(win_rect->bottom, monitor.rcWork.bottom);
|
||||
win_rect->right = min(win_rect->right, monitor.rcWork.right);
|
||||
|
||||
/* With Windows 10 and newer we can adjust for chrome that differs with DPI and scale. */
|
||||
GHOST_WIN32_AdjustWindowRectExForDpi fpAdjustWindowRectExForDpi = nullptr;
|
||||
|
@ -327,6 +358,9 @@ void GHOST_WindowWin32::adjustWindowRectForClosestMonitor(LPRECT win_rect,
|
|||
/* Adjust to allow for caption, borders, shadows, scaling, etc. Resulting values can be
|
||||
* correctly outside of monitor bounds. NOTE: You cannot specify #WS_OVERLAPPED when calling. */
|
||||
if (fpAdjustWindowRectExForDpi) {
|
||||
/* Use the DPI of the monitor that is at the middle of the rect. */
|
||||
hmonitor = MonitorFromRect(win_rect, MONITOR_DEFAULTTONEAREST);
|
||||
GetMonitorInfo(hmonitor, &monitor);
|
||||
UINT dpiX, dpiY;
|
||||
GetDpiForMonitor(hmonitor, MDT_EFFECTIVE_DPI, &dpiX, &dpiY);
|
||||
fpAdjustWindowRectExForDpi(win_rect, dwStyle & ~WS_OVERLAPPED, FALSE, dwExStyle, dpiX);
|
||||
|
@ -335,7 +369,12 @@ void GHOST_WindowWin32::adjustWindowRectForClosestMonitor(LPRECT win_rect,
|
|||
AdjustWindowRectEx(win_rect, dwStyle & ~WS_OVERLAPPED, FALSE, dwExStyle);
|
||||
}
|
||||
|
||||
/* But never allow a top position that can hide part of the title bar. */
|
||||
/* Don't hide the title bar. Check the working area of the monitor at the top-left corner, using
|
||||
* the original top since the justWindowRects might have altered it to different monitor. */
|
||||
pt.x = win_rect->left;
|
||||
pt.y = requested_top;
|
||||
hmonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
|
||||
GetMonitorInfo(hmonitor, &monitor);
|
||||
win_rect->top = max(monitor.rcWork.top, win_rect->top);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,12 +87,12 @@ class GHOST_WindowWin32 : public GHOST_Window {
|
|||
~GHOST_WindowWin32();
|
||||
|
||||
/**
|
||||
* Adjusts a requested window rect to fit and position correctly in monitor.
|
||||
* Adjusts a requested window rect to fit and position within the desktop.
|
||||
* \param win_rect: pointer to rectangle that will be modified.
|
||||
* \param dwStyle: The Window Style of the window whose required size is to be calculated.
|
||||
* \param dwExStyle: The Extended Window Style of the window.
|
||||
*/
|
||||
void adjustWindowRectForClosestMonitor(LPRECT win_rect, DWORD dwStyle, DWORD dwExStyle);
|
||||
void adjustWindowRectForDesktop(LPRECT win_rect, DWORD dwStyle, DWORD dwExStyle);
|
||||
|
||||
/**
|
||||
* Returns indication as to whether the window is valid.
|
||||
|
|
|
@ -190,6 +190,9 @@ static int stroke_march_next_point(const bGPDstroke *gps,
|
|||
float *pressure,
|
||||
float *strength,
|
||||
float *vert_color,
|
||||
float *uv_fac,
|
||||
float *uv_fill,
|
||||
float *uv_rot,
|
||||
float *ratio_result,
|
||||
int *index_from,
|
||||
int *index_to)
|
||||
|
@ -271,6 +274,10 @@ static int stroke_march_next_point(const bGPDstroke *gps,
|
|||
gps->points[next_point_index].pressure, gps->points[*index_from].pressure, vratio);
|
||||
*strength = interpf(
|
||||
gps->points[next_point_index].strength, gps->points[*index_from].strength, vratio);
|
||||
*uv_fac = interpf(gps->points[next_point_index].uv_fac, gps->points[*index_from].uv_fac, vratio);
|
||||
*uv_rot = interpf(gps->points[next_point_index].uv_rot, gps->points[*index_from].uv_rot, vratio);
|
||||
interp_v2_v2v2(
|
||||
uv_fill, gps->points[*index_from].uv_fill, gps->points[next_point_index].uv_fill, vratio);
|
||||
interp_v4_v4v4(vert_color,
|
||||
gps->points[*index_from].vert_color,
|
||||
gps->points[next_point_index].vert_color,
|
||||
|
@ -474,6 +481,7 @@ bool BKE_gpencil_stroke_sample(bGPdata *gpd,
|
|||
int next_point_index = 1;
|
||||
int i = 0;
|
||||
float pressure, strength, ratio_result;
|
||||
float uv_fac, uv_rot, uv_fill[2];
|
||||
float vert_color[4];
|
||||
int index_from, index_to;
|
||||
float last_coord[3];
|
||||
|
@ -504,6 +512,9 @@ bool BKE_gpencil_stroke_sample(bGPdata *gpd,
|
|||
&pressure,
|
||||
&strength,
|
||||
vert_color,
|
||||
&uv_fac,
|
||||
uv_fill,
|
||||
&uv_rot,
|
||||
&ratio_result,
|
||||
&index_from,
|
||||
&index_to)) > -1) {
|
||||
|
@ -514,6 +525,10 @@ bool BKE_gpencil_stroke_sample(bGPdata *gpd,
|
|||
copy_v3_v3(&pt2->x, last_coord);
|
||||
new_pt[i].pressure = pressure;
|
||||
new_pt[i].strength = strength;
|
||||
new_pt[i].uv_fac = uv_fac;
|
||||
new_pt[i].uv_rot = uv_rot;
|
||||
copy_v2_v2(new_pt[i].uv_fill, uv_fill);
|
||||
|
||||
memcpy(new_pt[i].vert_color, vert_color, sizeof(float[4]));
|
||||
if (select) {
|
||||
new_pt[i].flag |= GP_SPOINT_SELECT;
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
.type = TEX_IMAGE, \
|
||||
.ima = NULL, \
|
||||
.stype = 0, \
|
||||
.flag = TEX_CHECKER_ODD, \
|
||||
.flag = TEX_CHECKER_ODD | TEX_NO_CLAMP, \
|
||||
.imaflag = TEX_INTERPOL | TEX_MIPMAP | TEX_USEALPHA, \
|
||||
.extend = TEX_REPEAT, \
|
||||
.cropxmin = 0.0, \
|
||||
|
|
Loading…
Reference in New Issue