mirror of
https://github.com/mirkobrombin/raven.git
synced 2026-10-28 21:25:06 +00:00
76 lines
2.6 KiB
Diff
76 lines
2.6 KiB
Diff
--- a/text.c
|
|
+++ b/text.c
|
|
@@ -1121,7 +1121,7 @@
|
|
TEXTMETRICW tm;
|
|
int lmargin = 0, rmargin = 0;
|
|
int x = rect->left, y = rect->top;
|
|
- int width = rect->right - rect->left;
|
|
+ int width = 0;
|
|
int max_width = 0;
|
|
int last_line;
|
|
int tabwidth /* to keep gcc happy */ = 0;
|
|
@@ -1209,9 +1209,18 @@
|
|
{
|
|
lmargin = dtp->iLeftMargin;
|
|
rmargin = dtp->iRightMargin;
|
|
- if (!(flags & (DT_CENTER | DT_RIGHT)))
|
|
- x += lmargin;
|
|
dtp->uiLengthDrawn = 0; /* This param RECEIVES number of chars processed */
|
|
+ }
|
|
+
|
|
+ {
|
|
+ LONGLONG start = (LONGLONG)rect->left + lmargin;
|
|
+ LONGLONG end = (LONGLONG)rect->right - rmargin;
|
|
+ LONGLONG available = end - start;
|
|
+ if (start < INT_MIN || start > INT_MAX || end < INT_MIN || end > INT_MAX ||
|
|
+ available < INT_MIN || available > INT_MAX)
|
|
+ { SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return 0; }
|
|
+ width = (int)available;
|
|
+ if (!(flags & (DT_CENTER | DT_RIGHT))) x = (int)start;
|
|
}
|
|
|
|
if (flags & DT_EXPANDTABS)
|
|
@@ -1278,29 +1287,34 @@
|
|
strPtr = TEXT_NextLineW(hdc, strPtr, &count, line, &len, width, flags, &size, last_line, &p_retstr, tabwidth, &prefix_offset, &ellip, failure);
|
|
if (failure->failed) goto cleanup;
|
|
|
|
+ LONGLONG aligned_x = x;
|
|
#ifdef __REACTOS__
|
|
if (flags & DT_CENTER)
|
|
{
|
|
if (((rect->right - rect->left) < size.cx) && (flags & DT_CALCRECT))
|
|
{
|
|
- x = rect->left + size.cx;
|
|
+ aligned_x = (LONGLONG)rect->left + size.cx;
|
|
}
|
|
else
|
|
{
|
|
- x = (rect->left + rect->right - size.cx) / 2;
|
|
- }
|
|
- }
|
|
-#else
|
|
- if (flags & DT_CENTER) x = (rect->left + rect->right -
|
|
+ aligned_x = ((LONGLONG)rect->left + rect->right + lmargin - rmargin - size.cx) / 2;
|
|
+ }
|
|
+ }
|
|
+#else
|
|
+ if (flags & DT_CENTER) aligned_x = ((LONGLONG)rect->left + rect->right -
|
|
size.cx) / 2;
|
|
#endif
|
|
- else if (flags & DT_RIGHT) x = rect->right - size.cx;
|
|
+ else if (flags & DT_RIGHT) aligned_x = (LONGLONG)rect->right - rmargin - size.cx;
|
|
+
|
|
+ if (aligned_x < INT_MIN || aligned_x > INT_MAX)
|
|
+ { SetLastError(ERROR_CALL_NOT_IMPLEMENTED); goto cleanup; }
|
|
+ x = (int)aligned_x;
|
|
|
|
if (flags & DT_SINGLELINE)
|
|
{
|
|
#ifdef __REACTOS__
|
|
if (flags & DT_VCENTER) y = rect->top +
|
|
- (rect->bottom - rect->top + (invert_y ? size.cy : -size.cy)) / 2;
|
|
+ (rect->bottom - rect->top) / 2 - (invert_y ? -size.cy : size.cy) / 2;
|
|
else if (flags & DT_BOTTOM)
|
|
y = rect->bottom + (invert_y ? size.cy : -size.cy);
|
|
#else
|