[warnings] fix float/double warnings
This commit is contained in:
parent
7c537d681f
commit
fe4cb6de65
@ -777,10 +777,7 @@ BOOL wlf_copy_image(const void* src, size_t srcStride, size_t srcWidth, size_t s
|
||||
BOOL wlf_scale_coordinates(rdpContext* context, UINT32* px, UINT32* py, BOOL fromLocalToRDP)
|
||||
{
|
||||
wlfContext* wlf = (wlfContext*)context;
|
||||
rdpGdi* gdi = NULL;
|
||||
UwacSize geometry;
|
||||
double sx = NAN;
|
||||
double sy = NAN;
|
||||
UwacSize geometry = { 0 };
|
||||
|
||||
if (!context || !px || !py || !context->gdi)
|
||||
return FALSE;
|
||||
@ -788,23 +785,23 @@ BOOL wlf_scale_coordinates(rdpContext* context, UINT32* px, UINT32* py, BOOL fro
|
||||
if (!freerdp_settings_get_bool(context->settings, FreeRDP_SmartSizing))
|
||||
return TRUE;
|
||||
|
||||
gdi = context->gdi;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
|
||||
if (UwacWindowGetDrawingBufferGeometry(wlf->window, &geometry, NULL) != UWAC_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
sx = geometry.width / (double)gdi->width;
|
||||
sy = geometry.height / (double)gdi->height;
|
||||
const double sx = 1.0 * geometry.width / (double)gdi->width;
|
||||
const double sy = 1.0 * geometry.height / (double)gdi->height;
|
||||
|
||||
if (!fromLocalToRDP)
|
||||
{
|
||||
*px *= sx;
|
||||
*py *= sy;
|
||||
*px *= (UINT32)lround(sx);
|
||||
*py *= (UINT32)lround(sy);
|
||||
}
|
||||
else
|
||||
{
|
||||
*px /= sx;
|
||||
*py /= sy;
|
||||
*px /= (UINT32)lround(sx);
|
||||
*py /= (UINT32)lround(sy);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -168,20 +168,17 @@ static BOOL xf_get_pixmap_info(xfContext* xfc);
|
||||
#ifdef WITH_XRENDER
|
||||
static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
|
||||
{
|
||||
XTransform transform;
|
||||
XTransform transform = { 0 };
|
||||
Picture windowPicture = 0;
|
||||
Picture primaryPicture = 0;
|
||||
XRenderPictureAttributes pa;
|
||||
XRenderPictFormat* picFormat = NULL;
|
||||
double xScalingFactor = NAN;
|
||||
double yScalingFactor = NAN;
|
||||
int x2 = 0;
|
||||
int y2 = 0;
|
||||
const char* filter = NULL;
|
||||
rdpSettings* settings = NULL;
|
||||
WINPR_ASSERT(xfc);
|
||||
|
||||
settings = xfc->common.context.settings;
|
||||
rdpSettings* settings = xfc->common.context.settings;
|
||||
WINPR_ASSERT(settings);
|
||||
|
||||
if (xfc->scaledWidth <= 0 || xfc->scaledHeight <= 0)
|
||||
@ -197,10 +194,12 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
|
||||
return;
|
||||
}
|
||||
|
||||
xScalingFactor =
|
||||
freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth) / (double)xfc->scaledWidth;
|
||||
yScalingFactor =
|
||||
freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight) / (double)xfc->scaledHeight;
|
||||
const double xScalingFactor = 1.0 *
|
||||
freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth) /
|
||||
(double)xfc->scaledWidth;
|
||||
const double yScalingFactor = 1.0 *
|
||||
freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight) /
|
||||
(double)xfc->scaledHeight;
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetForeground(xfc->display, xfc->gc, 0);
|
||||
/* Black out possible space between desktop and window borders */
|
||||
@ -254,10 +253,15 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
|
||||
/* calculate and fix up scaled coordinates */
|
||||
x2 = x + w;
|
||||
y2 = y + h;
|
||||
x = ((int)floor(x / xScalingFactor)) - 1;
|
||||
y = ((int)floor(y / yScalingFactor)) - 1;
|
||||
w = ((int)ceil(x2 / xScalingFactor)) + 1 - x;
|
||||
h = ((int)ceil(y2 / yScalingFactor)) + 1 - y;
|
||||
|
||||
const double dx1 = floor(x / xScalingFactor);
|
||||
const double dy1 = floor(y / yScalingFactor);
|
||||
const double dx2 = ceil(x2 / xScalingFactor);
|
||||
const double dy2 = ceil(y2 / yScalingFactor);
|
||||
x = ((int)dx1) - 1;
|
||||
y = ((int)dy1) - 1;
|
||||
w = ((int)dx2) + 1 - x;
|
||||
h = ((int)dy2) + 1 - y;
|
||||
XRenderSetPictureTransform(xfc->display, primaryPicture, &transform);
|
||||
XRenderComposite(xfc->display, PictOpSrc, primaryPicture, 0, windowPicture, x, y, 0, 0,
|
||||
xfc->offset_x + x, xfc->offset_y + y, w, h);
|
||||
|
@ -17,6 +17,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <winpr/assert.h>
|
||||
#include <winpr/sysinfo.h>
|
||||
#include <X11/Xutil.h>
|
||||
@ -163,8 +164,11 @@ static BOOL xf_disp_sendResize(xfDispContext* xfDisp)
|
||||
layout.DesktopScaleFactor =
|
||||
freerdp_settings_get_uint32(settings, FreeRDP_DesktopScaleFactor);
|
||||
layout.DeviceScaleFactor = freerdp_settings_get_uint32(settings, FreeRDP_DeviceScaleFactor);
|
||||
layout.PhysicalWidth = xfDisp->targetWidth / 75.0 * 25.4;
|
||||
layout.PhysicalHeight = xfDisp->targetHeight / 75.0 * 25.4;
|
||||
|
||||
const double dw = xfDisp->targetWidth / 75.0 * 25.4;
|
||||
const double dh = xfDisp->targetHeight / 75.0 * 25.4;
|
||||
layout.PhysicalWidth = (UINT32)lround(dw);
|
||||
layout.PhysicalHeight = (UINT32)lround(dh);
|
||||
|
||||
if (IFCALLRESULT(CHANNEL_RC_OK, xfDisp->disp->SendMonitorLayout, xfDisp->disp, 1,
|
||||
&layout) != CHANNEL_RC_OK)
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <winpr/assert.h>
|
||||
#include <winpr/path.h>
|
||||
@ -314,36 +315,32 @@ static BOOL xf_event_execute_action_script(xfContext* xfc, const XEvent* event)
|
||||
|
||||
void xf_adjust_coordinates_to_screen(xfContext* xfc, UINT32* x, UINT32* y)
|
||||
{
|
||||
rdpSettings* settings = NULL;
|
||||
INT64 tx = 0;
|
||||
INT64 ty = 0;
|
||||
|
||||
if (!xfc || !xfc->common.context.settings || !y || !x)
|
||||
return;
|
||||
|
||||
settings = xfc->common.context.settings;
|
||||
tx = *x;
|
||||
ty = *y;
|
||||
rdpSettings* settings = xfc->common.context.settings;
|
||||
INT64 tx = *x;
|
||||
INT64 ty = *y;
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
#ifdef WITH_XRENDER
|
||||
|
||||
if (xf_picture_transform_required(xfc))
|
||||
{
|
||||
double xScalingFactor = xfc->scaledWidth / (double)freerdp_settings_get_uint32(
|
||||
settings, FreeRDP_DesktopWidth);
|
||||
double yScalingFactor = xfc->scaledHeight / (double)freerdp_settings_get_uint32(
|
||||
settings, FreeRDP_DesktopHeight);
|
||||
tx = ((tx + xfc->offset_x) * xScalingFactor);
|
||||
ty = ((ty + xfc->offset_y) * yScalingFactor);
|
||||
const double dw = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth);
|
||||
const double dh = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight);
|
||||
double xScalingFactor = xfc->scaledWidth / dw;
|
||||
double yScalingFactor = xfc->scaledHeight / dh;
|
||||
tx = (INT64)lround((1.0 * (*x) + xfc->offset_x) * xScalingFactor);
|
||||
ty = (INT64)lround((1.0 * (*y) + xfc->offset_y) * yScalingFactor);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
CLAMP_COORDINATES(tx, ty);
|
||||
*x = tx;
|
||||
*y = ty;
|
||||
*x = (UINT32)tx;
|
||||
*y = (UINT32)ty;
|
||||
}
|
||||
|
||||
void xf_event_adjust_coordinates(xfContext* xfc, int* x, int* y)
|
||||
|
@ -36,21 +36,17 @@ static UINT xf_OutputUpdate(xfContext* xfc, xfGfxSurface* surface)
|
||||
UINT rc = ERROR_INTERNAL_ERROR;
|
||||
UINT32 surfaceX = 0;
|
||||
UINT32 surfaceY = 0;
|
||||
RECTANGLE_16 surfaceRect;
|
||||
rdpGdi* gdi = NULL;
|
||||
const rdpSettings* settings = NULL;
|
||||
RECTANGLE_16 surfaceRect = { 0 };
|
||||
UINT32 nbRects = 0;
|
||||
double sx = NAN;
|
||||
double sy = NAN;
|
||||
const RECTANGLE_16* rects = NULL;
|
||||
|
||||
WINPR_ASSERT(xfc);
|
||||
WINPR_ASSERT(surface);
|
||||
|
||||
gdi = xfc->common.context.gdi;
|
||||
rdpGdi* gdi = xfc->common.context.gdi;
|
||||
WINPR_ASSERT(gdi);
|
||||
|
||||
settings = xfc->common.context.settings;
|
||||
rdpSettings* settings = xfc->common.context.settings;
|
||||
WINPR_ASSERT(settings);
|
||||
|
||||
surfaceX = surface->gdi.outputOriginX;
|
||||
@ -64,8 +60,8 @@ static UINT xf_OutputUpdate(xfContext* xfc, xfGfxSurface* surface)
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
region16_intersect_rect(&(surface->gdi.invalidRegion), &(surface->gdi.invalidRegion),
|
||||
&surfaceRect);
|
||||
sx = surface->gdi.outputTargetWidth / (double)surface->gdi.mappedWidth;
|
||||
sy = surface->gdi.outputTargetHeight / (double)surface->gdi.mappedHeight;
|
||||
const double sx = 1.0 * surface->gdi.outputTargetWidth / (double)surface->gdi.mappedWidth;
|
||||
const double sy = 1.0 * surface->gdi.outputTargetHeight / (double)surface->gdi.mappedHeight;
|
||||
|
||||
if (!(rects = region16_rects(&surface->gdi.invalidRegion, &nbRects)))
|
||||
return CHANNEL_RC_OK;
|
||||
@ -77,10 +73,10 @@ static UINT xf_OutputUpdate(xfContext* xfc, xfGfxSurface* surface)
|
||||
const UINT32 nYSrc = rect->top;
|
||||
const UINT32 swidth = rect->right - nXSrc;
|
||||
const UINT32 sheight = rect->bottom - nYSrc;
|
||||
const UINT32 nXDst = surfaceX + nXSrc * sx;
|
||||
const UINT32 nYDst = surfaceY + nYSrc * sy;
|
||||
const UINT32 dwidth = swidth * sx;
|
||||
const UINT32 dheight = sheight * sy;
|
||||
const UINT32 nXDst = (UINT32)lround(1.0 * surfaceX + nXSrc * sx);
|
||||
const UINT32 nYDst = (UINT32)lround(1.0 * surfaceY + nYSrc * sy);
|
||||
const UINT32 dwidth = (UINT32)lround(1.0 * swidth * sx);
|
||||
const UINT32 dheight = (UINT32)lround(1.0 * sheight * sy);
|
||||
|
||||
if (surface->stage)
|
||||
{
|
||||
|
@ -118,16 +118,16 @@ static BOOL xf_Pointer_GetCursorForCurrentScale(rdpContext* context, rdpPointer*
|
||||
if (!settings)
|
||||
return FALSE;
|
||||
|
||||
const double xscale = (freerdp_settings_get_bool(settings, FreeRDP_SmartSizing)
|
||||
? xfc->scaledWidth / (double)freerdp_settings_get_uint32(
|
||||
settings, FreeRDP_DesktopWidth)
|
||||
: 1);
|
||||
const double yscale = (freerdp_settings_get_bool(settings, FreeRDP_SmartSizing)
|
||||
? xfc->scaledHeight / (double)freerdp_settings_get_uint32(
|
||||
settings, FreeRDP_DesktopHeight)
|
||||
: 1);
|
||||
const UINT32 xTargetSize = MAX(1, pointer->width * xscale);
|
||||
const UINT32 yTargetSize = MAX(1, pointer->height * yscale);
|
||||
const double dw = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth);
|
||||
const double xscale =
|
||||
(freerdp_settings_get_bool(settings, FreeRDP_SmartSizing) ? 1.0 * xfc->scaledWidth / dw
|
||||
: 1);
|
||||
const double dh = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight);
|
||||
const double yscale =
|
||||
(freerdp_settings_get_bool(settings, FreeRDP_SmartSizing) ? 1.0 * xfc->scaledHeight / dh
|
||||
: 1);
|
||||
const UINT32 xTargetSize = MAX(1, (UINT32)lround(1.0 * pointer->width * xscale));
|
||||
const UINT32 yTargetSize = MAX(1, (UINT32)lround(1.0 * pointer->height * yscale));
|
||||
|
||||
WLog_DBG(TAG, "scaled: %" PRIu32 "x%" PRIu32 ", desktop: %" PRIu32 "x%" PRIu32,
|
||||
xfc->scaledWidth, xfc->scaledHeight,
|
||||
@ -186,8 +186,8 @@ static BOOL xf_Pointer_GetCursorForCurrentScale(rdpContext* context, rdpPointer*
|
||||
ci.size = sizeof(ci);
|
||||
ci.width = xTargetSize;
|
||||
ci.height = yTargetSize;
|
||||
ci.xhot = pointer->xPos * xscale;
|
||||
ci.yhot = pointer->yPos * yscale;
|
||||
ci.xhot = (XcursorDim)lround(1.0 * pointer->xPos * xscale);
|
||||
ci.yhot = (XcursorDim)lround(1.0 * pointer->yPos * yscale);
|
||||
const size_t size = 1ull * ci.height * ci.width * FreeRDPGetBytesPerPixel(CursorFormat);
|
||||
|
||||
void* tmp = winpr_aligned_malloc(size, 16);
|
||||
|
@ -333,16 +333,8 @@ static void xf_input_save_last_event(xfContext* xfc, const XGenericEventCookie*
|
||||
|
||||
static void xf_input_detect_pan(xfContext* xfc)
|
||||
{
|
||||
double dx[2];
|
||||
double dy[2];
|
||||
double px = NAN;
|
||||
double py = NAN;
|
||||
double dist_x = NAN;
|
||||
double dist_y = NAN;
|
||||
rdpContext* ctx = NULL;
|
||||
|
||||
WINPR_ASSERT(xfc);
|
||||
ctx = &xfc->common.context;
|
||||
rdpContext* ctx = &xfc->common.context;
|
||||
WINPR_ASSERT(ctx);
|
||||
|
||||
if (xfc->active_contacts != 2)
|
||||
@ -350,16 +342,16 @@ static void xf_input_detect_pan(xfContext* xfc)
|
||||
return;
|
||||
}
|
||||
|
||||
dx[0] = xfc->contacts[0].pos_x - xfc->contacts[0].last_x;
|
||||
dx[1] = xfc->contacts[1].pos_x - xfc->contacts[1].last_x;
|
||||
dy[0] = xfc->contacts[0].pos_y - xfc->contacts[0].last_y;
|
||||
dy[1] = xfc->contacts[1].pos_y - xfc->contacts[1].last_y;
|
||||
px = fabs(dx[0]) < fabs(dx[1]) ? dx[0] : dx[1];
|
||||
py = fabs(dy[0]) < fabs(dy[1]) ? dy[0] : dy[1];
|
||||
const double dx[] = { xfc->contacts[0].pos_x - xfc->contacts[0].last_x,
|
||||
xfc->contacts[1].pos_x - xfc->contacts[1].last_x };
|
||||
const double dy[] = { xfc->contacts[0].pos_y - xfc->contacts[0].last_y,
|
||||
xfc->contacts[1].pos_y - xfc->contacts[1].last_y };
|
||||
const double px = fabs(dx[0]) < fabs(dx[1]) ? dx[0] : dx[1];
|
||||
const double py = fabs(dy[0]) < fabs(dy[1]) ? dy[0] : dy[1];
|
||||
xfc->px_vector += px;
|
||||
xfc->py_vector += py;
|
||||
dist_x = fabs(xfc->contacts[0].pos_x - xfc->contacts[1].pos_x);
|
||||
dist_y = fabs(xfc->contacts[0].pos_y - xfc->contacts[1].pos_y);
|
||||
const double dist_x = fabs(xfc->contacts[0].pos_x - xfc->contacts[1].pos_x);
|
||||
const double dist_y = fabs(xfc->contacts[0].pos_y - xfc->contacts[1].pos_y);
|
||||
|
||||
if (dist_y > MIN_FINGER_DIST)
|
||||
{
|
||||
@ -424,13 +416,10 @@ static void xf_input_detect_pan(xfContext* xfc)
|
||||
|
||||
static void xf_input_detect_pinch(xfContext* xfc)
|
||||
{
|
||||
double dist = NAN;
|
||||
double delta = NAN;
|
||||
ZoomingChangeEventArgs e;
|
||||
rdpContext* ctx = NULL;
|
||||
ZoomingChangeEventArgs e = { 0 };
|
||||
|
||||
WINPR_ASSERT(xfc);
|
||||
ctx = &xfc->common.context;
|
||||
rdpContext* ctx = &xfc->common.context;
|
||||
WINPR_ASSERT(ctx);
|
||||
|
||||
if (xfc->active_contacts != 2)
|
||||
@ -440,8 +429,8 @@ static void xf_input_detect_pinch(xfContext* xfc)
|
||||
}
|
||||
|
||||
/* first calculate the distance */
|
||||
dist = sqrt(pow(xfc->contacts[1].pos_x - xfc->contacts[0].last_x, 2.0) +
|
||||
pow(xfc->contacts[1].pos_y - xfc->contacts[0].last_y, 2.0));
|
||||
const double dist = sqrt(pow(xfc->contacts[1].pos_x - xfc->contacts[0].last_x, 2.0) +
|
||||
pow(xfc->contacts[1].pos_y - xfc->contacts[0].last_y, 2.0));
|
||||
|
||||
/* if this is the first 2pt touch */
|
||||
if (xfc->firstDist <= 0)
|
||||
@ -454,7 +443,7 @@ static void xf_input_detect_pinch(xfContext* xfc)
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = xfc->lastDist - dist;
|
||||
double delta = xfc->lastDist - dist;
|
||||
|
||||
if (delta > 1.0)
|
||||
delta = 1.0;
|
||||
|
@ -523,22 +523,17 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
|
||||
if (vB != destB)
|
||||
xfc->fullscreenMonitors.bottom = monitor->orig_screen;
|
||||
|
||||
vX = destX / ((freerdp_settings_get_bool(settings, FreeRDP_PercentScreenUseWidth)
|
||||
? freerdp_settings_get_uint32(settings, FreeRDP_PercentScreen)
|
||||
: 100) /
|
||||
100.);
|
||||
vY = destY / ((freerdp_settings_get_bool(settings, FreeRDP_PercentScreenUseHeight)
|
||||
? freerdp_settings_get_uint32(settings, FreeRDP_PercentScreen)
|
||||
: 100) /
|
||||
100.);
|
||||
vR = destR / ((freerdp_settings_get_bool(settings, FreeRDP_PercentScreenUseWidth)
|
||||
? freerdp_settings_get_uint32(settings, FreeRDP_PercentScreen)
|
||||
: 100) /
|
||||
100.);
|
||||
vB = destB / ((freerdp_settings_get_bool(settings, FreeRDP_PercentScreenUseHeight)
|
||||
? freerdp_settings_get_uint32(settings, FreeRDP_PercentScreen)
|
||||
: 100) /
|
||||
100.);
|
||||
const UINT32 ps = freerdp_settings_get_uint32(settings, FreeRDP_PercentScreen);
|
||||
WINPR_ASSERT(ps <= 100);
|
||||
|
||||
const int psuw =
|
||||
freerdp_settings_get_bool(settings, FreeRDP_PercentScreenUseWidth) ? (int)ps : 100;
|
||||
const int psuh =
|
||||
freerdp_settings_get_bool(settings, FreeRDP_PercentScreenUseHeight) ? (int)ps : 100;
|
||||
vX = (destX * psuw) / 100;
|
||||
vY = (destY * psuh) / 100;
|
||||
vR = (destR * psuw) / 100;
|
||||
vB = (destB * psuh) / 100;
|
||||
}
|
||||
|
||||
vscreen->area.left = 0;
|
||||
|
@ -64,6 +64,12 @@ AddTargetWithResourceFile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" SRCS)
|
||||
|
||||
list(APPEND LIBS freerdp winpr)
|
||||
|
||||
include(CheckLibraryExists)
|
||||
CHECK_LIBRARY_EXISTS(m lround "" HAVE_LIB_M)
|
||||
if(HAVE_LIB_M)
|
||||
list(APPEND LIBS m)
|
||||
endif()
|
||||
|
||||
target_include_directories(${MODULE_NAME} INTERFACE $<INSTALL_INTERFACE:include>)
|
||||
target_link_libraries(${MODULE_NAME} PRIVATE ${FREERDP_CHANNELS_CLIENT_LIBS})
|
||||
target_link_libraries(${MODULE_NAME} PUBLIC ${LIBS})
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
|
||||
@ -2012,7 +2013,8 @@ BOOL freerdp_client_handle_pen(rdpClientContext* cctx, UINT32 flags, INT32 devic
|
||||
if ((flags & FREERDP_PEN_HAS_PRESSURE) != 0)
|
||||
{
|
||||
const double pressure = va_arg(args, double);
|
||||
normalizedpressure = (pressure * 1024) / pen->max_pressure;
|
||||
const double np = (pressure * 1024.0) / pen->max_pressure;
|
||||
normalizedpressure = (UINT32)lround(np);
|
||||
WLog_DBG(TAG, "pen pressure %lf -> %" PRIu32, pressure, normalizedpressure);
|
||||
fieldFlags |= RDPINPUT_PEN_CONTACT_PRESSURE_PRESENT;
|
||||
}
|
||||
|
@ -150,12 +150,7 @@ int bulk_decompress(rdpBulk* WINPR_RESTRICT bulk, const BYTE* WINPR_RESTRICT pSr
|
||||
UINT32 SrcSize, const BYTE** WINPR_RESTRICT ppDstData,
|
||||
UINT32* WINPR_RESTRICT pDstSize, UINT32 flags)
|
||||
{
|
||||
UINT32 type = 0;
|
||||
int status = -1;
|
||||
rdpMetrics* metrics = NULL;
|
||||
UINT32 CompressedBytes = 0;
|
||||
UINT32 UncompressedBytes = 0;
|
||||
double CompressionRatio = NAN;
|
||||
|
||||
WINPR_ASSERT(bulk);
|
||||
WINPR_ASSERT(bulk->context);
|
||||
@ -163,11 +158,11 @@ int bulk_decompress(rdpBulk* WINPR_RESTRICT bulk, const BYTE* WINPR_RESTRICT pSr
|
||||
WINPR_ASSERT(ppDstData);
|
||||
WINPR_ASSERT(pDstSize);
|
||||
|
||||
metrics = bulk->context->metrics;
|
||||
rdpMetrics* metrics = bulk->context->metrics;
|
||||
WINPR_ASSERT(metrics);
|
||||
|
||||
bulk_compression_max_size(bulk);
|
||||
type = flags & BULK_COMPRESSION_TYPE_MASK;
|
||||
const UINT32 type = flags & BULK_COMPRESSION_TYPE_MASK;
|
||||
|
||||
if (flags & BULK_COMPRESSION_FLAGS_MASK)
|
||||
{
|
||||
@ -215,9 +210,10 @@ int bulk_decompress(rdpBulk* WINPR_RESTRICT bulk, const BYTE* WINPR_RESTRICT pSr
|
||||
|
||||
if (status >= 0)
|
||||
{
|
||||
CompressedBytes = SrcSize;
|
||||
UncompressedBytes = *pDstSize;
|
||||
CompressionRatio = metrics_write_bytes(metrics, UncompressedBytes, CompressedBytes);
|
||||
const UINT32 CompressedBytes = SrcSize;
|
||||
const UINT32 UncompressedBytes = *pDstSize;
|
||||
const double CompressionRatio =
|
||||
metrics_write_bytes(metrics, UncompressedBytes, CompressedBytes);
|
||||
#ifdef WITH_BULK_DEBUG
|
||||
{
|
||||
WLog_DBG(TAG,
|
||||
@ -245,10 +241,6 @@ int bulk_compress(rdpBulk* WINPR_RESTRICT bulk, const BYTE* WINPR_RESTRICT pSrcD
|
||||
UINT32* WINPR_RESTRICT pFlags)
|
||||
{
|
||||
int status = -1;
|
||||
rdpMetrics* metrics = NULL;
|
||||
UINT32 CompressedBytes = 0;
|
||||
UINT32 UncompressedBytes = 0;
|
||||
double CompressionRatio = NAN;
|
||||
|
||||
WINPR_ASSERT(bulk);
|
||||
WINPR_ASSERT(bulk->context);
|
||||
@ -256,7 +248,7 @@ int bulk_compress(rdpBulk* WINPR_RESTRICT bulk, const BYTE* WINPR_RESTRICT pSrcD
|
||||
WINPR_ASSERT(ppDstData);
|
||||
WINPR_ASSERT(pDstSize);
|
||||
|
||||
metrics = bulk->context->metrics;
|
||||
rdpMetrics* metrics = bulk->context->metrics;
|
||||
WINPR_ASSERT(metrics);
|
||||
|
||||
if ((SrcSize <= 50) || (SrcSize >= 16384))
|
||||
@ -298,9 +290,10 @@ int bulk_compress(rdpBulk* WINPR_RESTRICT bulk, const BYTE* WINPR_RESTRICT pSrcD
|
||||
|
||||
if (status >= 0)
|
||||
{
|
||||
CompressedBytes = *pDstSize;
|
||||
UncompressedBytes = SrcSize;
|
||||
CompressionRatio = metrics_write_bytes(metrics, UncompressedBytes, CompressedBytes);
|
||||
const UINT32 CompressedBytes = *pDstSize;
|
||||
const UINT32 UncompressedBytes = SrcSize;
|
||||
const double CompressionRatio =
|
||||
metrics_write_bytes(metrics, UncompressedBytes, CompressedBytes);
|
||||
#ifdef WITH_BULK_DEBUG
|
||||
{
|
||||
WLog_DBG(TAG,
|
||||
|
@ -915,11 +915,11 @@ static BOOL rdp_write_info_packet(rdpRdp* rdp, wStream* s)
|
||||
|
||||
Stream_Write_UINT32(s, settings->KeyboardCodePage); /* CodePage (4 bytes) */
|
||||
Stream_Write_UINT32(s, flags); /* flags (4 bytes) */
|
||||
Stream_Write_UINT16(s, (UINT32)cbDomain); /* cbDomain (2 bytes) */
|
||||
Stream_Write_UINT16(s, (UINT32)cbUserName); /* cbUserName (2 bytes) */
|
||||
Stream_Write_UINT16(s, (UINT32)cbPassword); /* cbPassword (2 bytes) */
|
||||
Stream_Write_UINT16(s, (UINT32)cbAlternateShell); /* cbAlternateShell (2 bytes) */
|
||||
Stream_Write_UINT16(s, (UINT32)cbWorkingDir); /* cbWorkingDir (2 bytes) */
|
||||
Stream_Write_UINT16(s, (UINT16)cbDomain); /* cbDomain (2 bytes) */
|
||||
Stream_Write_UINT16(s, (UINT16)cbUserName); /* cbUserName (2 bytes) */
|
||||
Stream_Write_UINT16(s, (UINT16)cbPassword); /* cbPassword (2 bytes) */
|
||||
Stream_Write_UINT16(s, (UINT16)cbAlternateShell); /* cbAlternateShell (2 bytes) */
|
||||
Stream_Write_UINT16(s, (UINT16)cbWorkingDir); /* cbWorkingDir (2 bytes) */
|
||||
|
||||
Stream_Write(s, domainW, cbDomain);
|
||||
|
||||
|
@ -168,8 +168,6 @@ static UINT gdi_OutputUpdate(rdpGdi* gdi, gdiGfxSurface* surface)
|
||||
RECTANGLE_16 surfaceRect;
|
||||
const RECTANGLE_16* rects = NULL;
|
||||
UINT32 nbRects = 0;
|
||||
double sx = NAN;
|
||||
double sy = NAN;
|
||||
rdpUpdate* update = NULL;
|
||||
|
||||
WINPR_ASSERT(gdi);
|
||||
@ -189,8 +187,8 @@ static UINT gdi_OutputUpdate(rdpGdi* gdi, gdiGfxSurface* surface)
|
||||
surfaceRect.right = (UINT16)MIN(UINT16_MAX, surface->mappedWidth);
|
||||
surfaceRect.bottom = (UINT16)MIN(UINT16_MAX, surface->mappedHeight);
|
||||
region16_intersect_rect(&(surface->invalidRegion), &(surface->invalidRegion), &surfaceRect);
|
||||
sx = surface->outputTargetWidth / (double)surface->mappedWidth;
|
||||
sy = surface->outputTargetHeight / (double)surface->mappedHeight;
|
||||
const double sx = surface->outputTargetWidth / (double)surface->mappedWidth;
|
||||
const double sy = surface->outputTargetHeight / (double)surface->mappedHeight;
|
||||
|
||||
if (!(rects = region16_rects(&surface->invalidRegion, &nbRects)) || !nbRects)
|
||||
return CHANNEL_RC_OK;
|
||||
|
@ -318,7 +318,7 @@ BOOL freerdp_write_four_byte_float(wStream* s, double value)
|
||||
exp = 7;
|
||||
}
|
||||
|
||||
UINT64 base = aval;
|
||||
UINT64 base = (UINT64)llround(aval);
|
||||
while (exp >= 0)
|
||||
{
|
||||
const double div = pow(10.0, exp);
|
||||
|
@ -68,7 +68,8 @@ void stopwatch_reset(STOPWATCH* stopwatch)
|
||||
|
||||
double stopwatch_get_elapsed_time_in_seconds(STOPWATCH* stopwatch)
|
||||
{
|
||||
return (stopwatch->elapsed / 1000000.0);
|
||||
const long double ld = stopwatch->elapsed / 1000000.0L;
|
||||
return (double)ld;
|
||||
}
|
||||
|
||||
void stopwatch_get_elapsed_time_in_useconds(STOPWATCH* stopwatch, UINT32* sec, UINT32* usec)
|
||||
|
@ -534,11 +534,11 @@ static void touch_handle_down(void* data, struct wl_touch* wl_touch, uint32_t se
|
||||
tdata->seat = seat;
|
||||
tdata->id = id;
|
||||
|
||||
float sx = wl_fixed_to_double(x_w);
|
||||
float sy = wl_fixed_to_double(y_w);
|
||||
double sx = wl_fixed_to_double(x_w);
|
||||
double sy = wl_fixed_to_double(y_w);
|
||||
|
||||
tdata->x = sx;
|
||||
tdata->y = sy;
|
||||
tdata->x = (wl_fixed_t)lround(sx);
|
||||
tdata->y = (wl_fixed_t)lround(sy);
|
||||
|
||||
#if 0
|
||||
struct widget *widget;
|
||||
@ -644,11 +644,11 @@ static void touch_handle_motion(void* data, struct wl_touch* wl_touch, uint32_t
|
||||
tdata->seat = seat;
|
||||
tdata->id = id;
|
||||
|
||||
float sx = wl_fixed_to_double(x_w);
|
||||
float sy = wl_fixed_to_double(y_w);
|
||||
double sx = wl_fixed_to_double(x_w);
|
||||
double sy = wl_fixed_to_double(y_w);
|
||||
|
||||
tdata->x = sx;
|
||||
tdata->y = sy;
|
||||
tdata->x = (wl_fixed_t)lround(sx);
|
||||
tdata->y = (wl_fixed_t)lround(sy);
|
||||
|
||||
#if 0
|
||||
struct touch_point *tp;
|
||||
@ -757,8 +757,8 @@ static void pointer_handle_enter(void* data, struct wl_pointer* pointer, uint32_
|
||||
|
||||
assert(input);
|
||||
|
||||
float sx = wl_fixed_to_double(sx_w);
|
||||
float sy = wl_fixed_to_double(sy_w);
|
||||
double sx = wl_fixed_to_double(sx_w);
|
||||
double sy = wl_fixed_to_double(sy_w);
|
||||
|
||||
if (!surface)
|
||||
{
|
||||
@ -782,8 +782,8 @@ static void pointer_handle_enter(void* data, struct wl_pointer* pointer, uint32_
|
||||
|
||||
event->seat = input;
|
||||
event->window = window;
|
||||
event->x = sx;
|
||||
event->y = sy;
|
||||
event->x = (uint32_t)lround(sx);
|
||||
event->y = (uint32_t)lround(sy);
|
||||
|
||||
/* Apply cursor theme */
|
||||
set_cursor_image(input, serial);
|
||||
@ -861,8 +861,8 @@ static void pointer_handle_button(void* data, struct wl_pointer* pointer, uint32
|
||||
|
||||
event->seat = seat;
|
||||
event->window = window;
|
||||
event->x = seat->sx;
|
||||
event->y = seat->sy;
|
||||
event->x = (uint32_t)lround(seat->sx);
|
||||
event->y = (uint32_t)lround(seat->sy);
|
||||
event->button = button;
|
||||
event->state = (enum wl_pointer_button_state)state_w;
|
||||
}
|
||||
@ -885,8 +885,8 @@ static void pointer_handle_axis(void* data, struct wl_pointer* pointer, uint32_t
|
||||
|
||||
event->seat = seat;
|
||||
event->window = window;
|
||||
event->x = seat->sx;
|
||||
event->y = seat->sy;
|
||||
event->x = (uint32_t)lround(seat->sx);
|
||||
event->y = (uint32_t)lround(seat->sy);
|
||||
event->axis = axis;
|
||||
event->value = value;
|
||||
}
|
||||
@ -957,8 +957,8 @@ static void pointer_axis_discrete(void* data, struct wl_pointer* wl_pointer, uin
|
||||
|
||||
event->seat = seat;
|
||||
event->window = window;
|
||||
event->x = seat->sx;
|
||||
event->y = seat->sy;
|
||||
event->x = (uint32_t)lround(seat->sx);
|
||||
event->y = (uint32_t)lround(seat->sy);
|
||||
event->axis = axis;
|
||||
event->value = discrete;
|
||||
}
|
||||
@ -983,8 +983,8 @@ static void pointer_axis_value120(void* data, struct wl_pointer* wl_pointer, uin
|
||||
|
||||
event->seat = seat;
|
||||
event->window = window;
|
||||
event->x = seat->sx;
|
||||
event->y = seat->sy;
|
||||
event->x = (uint32_t)lround(seat->sx);
|
||||
event->y = (uint32_t)lround(seat->sy);
|
||||
event->axis = axis;
|
||||
event->value = value120 / 120;
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ struct uwac_seat
|
||||
|
||||
int repeat_timer_fd;
|
||||
UwacTask repeat_task;
|
||||
float sx, sy;
|
||||
double sx, sy;
|
||||
struct wl_list link;
|
||||
|
||||
void* data_context;
|
||||
|
@ -710,14 +710,19 @@ static void damage_surface(UwacWindow* window, UwacBuffer* buffer, int scale)
|
||||
static void damage_surface(UwacWindow* window, UwacBuffer* buffer, int scale)
|
||||
{
|
||||
uint32_t nrects = 0;
|
||||
const RECTANGLE_16* box = region16_rects(&buffer->damage, &nrects);
|
||||
const RECTANGLE_16* boxes = region16_rects(&buffer->damage, &nrects);
|
||||
|
||||
for (UINT32 i = 0; i < nrects; i++, box++)
|
||||
for (UINT32 i = 0; i < nrects; i++)
|
||||
{
|
||||
const int x = ((int)floor(box->left / scale)) - 1;
|
||||
const int y = ((int)floor(box->top / scale)) - 1;
|
||||
const int w = ((int)ceil((box->right - box->left) / scale)) + 2;
|
||||
const int h = ((int)ceil((box->bottom - box->top) / scale)) + 2;
|
||||
const RECTANGLE_16* box = &boxes[i];
|
||||
const double dx = floor(1.0 * box->left / scale);
|
||||
const double dy = floor(1.0 * box->top / scale);
|
||||
const double dw = ceil(1.0 * (box->right - box->left) / scale);
|
||||
const double dh = ceil(1.0 * (box->bottom - box->top) / scale);
|
||||
const int x = ((int)dx) - 1;
|
||||
const int y = ((int)dy) - 1;
|
||||
const int w = ((int)dw) + 2;
|
||||
const int h = ((int)dh) + 2;
|
||||
wl_surface_damage(window->surface, x, y, w, h);
|
||||
}
|
||||
|
||||
|
@ -772,9 +772,9 @@ wHashTable* HashTable_New(BOOL synchronized)
|
||||
if (!table->bucketArray)
|
||||
goto fail;
|
||||
|
||||
table->idealRatio = 3.0;
|
||||
table->lowerRehashThreshold = 0.0;
|
||||
table->upperRehashThreshold = 15.0;
|
||||
table->idealRatio = 3.0f;
|
||||
table->lowerRehashThreshold = 0.0f;
|
||||
table->upperRehashThreshold = 15.0f;
|
||||
table->hash = HashTable_PointerHash;
|
||||
table->key.fnObjectEquals = HashTable_PointerCompare;
|
||||
table->value.fnObjectEquals = HashTable_PointerCompare;
|
||||
|
Loading…
Reference in New Issue
Block a user