summaryrefslogtreecommitdiffstats
path: root/win/tkWinDraw.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-06-01 22:29:19 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-06-01 22:29:19 (GMT)
commite35d614587b25a1a03ededdf2d04bcbfca86be70 (patch)
tree5bc13e4395b89309cb5eb55ee6a0b1d763975de7 /win/tkWinDraw.c
parentc985425b2f03e2e14bf3f7ee9884cd74c184373e (diff)
downloadtk-e35d614587b25a1a03ededdf2d04bcbfca86be70.zip
tk-e35d614587b25a1a03ededdf2d04bcbfca86be70.tar.gz
tk-e35d614587b25a1a03ededdf2d04bcbfca86be70.tar.bz2
Change XSetDashes signature and many others to match Xorg, needed for Cygwin.
Add .PHONY targets, and various quoting issues (Makefile.in)
Diffstat (limited to 'win/tkWinDraw.c')
-rwxr-xr-xwin/tkWinDraw.c69
1 files changed, 35 insertions, 34 deletions
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index fea17d3..26d73e8 100755
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkWinDraw.c --
*
* This file contains the Xlib emulation functions pertaining to
@@ -156,7 +156,7 @@ TkWinGetDrawableDC(display, d, state)
if (twdPtr->type == TWD_WINDOW) {
TkWindow *winPtr = twdPtr->window.winPtr;
-
+
dc = GetDC(twdPtr->window.handle);
if (winPtr == NULL) {
cmap = DefaultColormap(display, DefaultScreen(display));
@@ -220,7 +220,7 @@ TkWinReleaseDrawableDC(d, dc, state)
* Returns the converted array of POINTs.
*
* Side effects:
- * Allocates a block of memory in thread local storage that
+ * Allocates a block of memory in thread local storage that
* should not be freed.
*
*----------------------------------------------------------------------
@@ -233,7 +233,7 @@ ConvertPoints(points, npoints, mode, bbox)
int mode; /* CoordModeOrigin or CoordModePrevious. */
RECT *bbox; /* Bounding box of points. */
{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int i;
@@ -256,7 +256,7 @@ ConvertPoints(points, npoints, mode, bbox)
bbox->left = bbox->right = points[0].x;
bbox->top = bbox->bottom = points[0].y;
-
+
if (mode == CoordModeOrigin) {
for (i = 0; i < npoints; i++) {
tsdPtr->winPoints[i].x = points[i].x;
@@ -505,7 +505,7 @@ XCopyPlane(display, src, dest, gc, src_x, src_y, width, height, dest_x,
*----------------------------------------------------------------------
*/
-void
+int
TkPutImage(colors, ncolors, display, d, gc, image, src_x, src_y, dest_x,
dest_y, width, height)
unsigned long *colors; /* Array of pixel values used by this
@@ -515,7 +515,7 @@ TkPutImage(colors, ncolors, display, d, gc, image, src_x, src_y, dest_x,
Drawable d; /* Destination drawable. */
GC gc;
XImage* image; /* Source image. */
- int src_x, src_y; /* Offset of subimage. */
+ int src_x, src_y; /* Offset of subimage. */
int dest_x, dest_y; /* Position of subimage origin in
* drawable. */
unsigned int width, height; /* Dimensions of subimage. */
@@ -549,22 +549,22 @@ TkPutImage(colors, ncolors, display, d, gc, image, src_x, src_y, dest_x,
}
SetTextColor(dc, gc->foreground);
SetBkColor(dc, gc->background);
- } else {
+ } else {
int i, usePalette;
/*
* Do not use a palette for TrueColor images.
*/
-
+
usePalette = (image->bits_per_pixel < 16);
-
+
if (usePalette) {
infoPtr = (BITMAPINFO*) ckalloc(sizeof(BITMAPINFOHEADER)
+ sizeof(RGBQUAD)*ncolors);
} else {
infoPtr = (BITMAPINFO*) ckalloc(sizeof(BITMAPINFOHEADER));
}
-
+
infoPtr->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
infoPtr->bmiHeader.biWidth = image->width;
infoPtr->bmiHeader.biHeight = -image->height; /* Top-down order */
@@ -595,13 +595,14 @@ TkPutImage(colors, ncolors, display, d, gc, image, src_x, src_y, dest_x,
panic("Fail to allocate bitmap\n");
DeleteDC(dcMem);
TkWinReleaseDrawableDC(d, dc, &state);
- return;
+ return BadValue;
}
bitmap = SelectObject(dcMem, bitmap);
BitBlt(dc, dest_x, dest_y, width, height, dcMem, src_x, src_y, SRCCOPY);
DeleteObject(SelectObject(dcMem, bitmap));
DeleteDC(dcMem);
TkWinReleaseDrawableDC(d, dc, &state);
+ return Success;
}
/*
@@ -635,7 +636,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
HBRUSH brush, oldBrush;
if (d == None) {
- return 0;
+ return BadDrawable;
}
dc = TkWinGetDrawableDC(display, d, &state);
@@ -658,7 +659,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
/*
* Select stipple pattern into destination dc.
*/
-
+
stipple = CreatePatternBrush(twdPtr->bitmap.handle);
SetBrushOrgEx(dc, gc->ts_x_origin, gc->ts_y_origin, NULL);
oldBrush = SelectObject(dc, stipple);
@@ -690,7 +691,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
SelectObject(dcMem, oldBitmap);
DeleteObject(bitmap);
}
-
+
DeleteDC(dcMem);
SelectObject(dc, oldBrush);
DeleteObject(stipple);
@@ -708,7 +709,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
HPEN newPen = CreatePen(PS_NULL, 0, gc->foreground);
HPEN oldPen = SelectObject(dc, newPen);
oldBrush = SelectObject(dc, brush);
-
+
for (i = 0; i < nrectangles; i++) {
Rectangle(dc, rectangles[i].x, rectangles[i].y,
rectangles[i].x + rectangles[i].width + 1,
@@ -722,7 +723,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
}
DeleteObject(brush);
TkWinReleaseDrawableDC(d, dc, &state);
- return 1;
+ return Success;
}
/*
@@ -756,7 +757,7 @@ RenderObject(dc, gc, points, npoints, mode, pen, func)
HPEN oldPen;
HBRUSH oldBrush;
POINT *winPoints = ConvertPoints(points, npoints, mode, &rect);
-
+
if ((gc->fill_style == FillStippled
|| gc->fill_style == FillOpaqueStippled)
&& gc->stipple != None) {
@@ -767,7 +768,7 @@ RenderObject(dc, gc, points, npoints, mode, pen, func)
HBITMAP oldBitmap;
int i;
HBRUSH oldMemBrush;
-
+
if (twdPtr->type != TWD_BITMAP) {
panic("unexpected drawable type in stipple");
}
@@ -787,7 +788,7 @@ RenderObject(dc, gc, points, npoints, mode, pen, func)
/*
* Select stipple pattern into destination dc.
*/
-
+
SetBrushOrgEx(dc, gc->ts_x_origin, gc->ts_y_origin, NULL);
oldBrush = SelectObject(dc, CreatePatternBrush(twdPtr->bitmap.handle));
@@ -795,7 +796,7 @@ RenderObject(dc, gc, points, npoints, mode, pen, func)
* Create temporary drawing surface containing a copy of the
* destination equal in size to the bounding box of the object.
*/
-
+
dcMem = CreateCompatibleDC(dc);
oldBitmap = SelectObject(dcMem, CreateCompatibleBitmap(dc, width,
height));
@@ -804,7 +805,7 @@ RenderObject(dc, gc, points, npoints, mode, pen, func)
/*
* Translate the object for rendering in the temporary drawing
- * surface.
+ * surface.
*/
for (i = 0; i < npoints; i++) {
@@ -884,9 +885,9 @@ XDrawLines(display, d, gc, points, npoints, mode)
HPEN pen;
TkWinDCState state;
HDC dc;
-
+
if (d == None) {
- return 0;
+ return BadDrawable;
}
dc = TkWinGetDrawableDC(display, d, &state);
@@ -895,9 +896,9 @@ XDrawLines(display, d, gc, points, npoints, mode)
SetBkMode(dc, TRANSPARENT);
RenderObject(dc, gc, points, npoints, mode, pen, Polyline);
DeleteObject(pen);
-
+
TkWinReleaseDrawableDC(d, dc, &state);
- return 1;
+ return Success;
}
/*
@@ -1229,24 +1230,24 @@ SetUpGraphicsPort(gc)
switch (gc->cap_style) {
case CapNotLast:
case CapButt:
- style |= PS_ENDCAP_FLAT;
+ style |= PS_ENDCAP_FLAT;
break;
case CapRound:
- style |= PS_ENDCAP_ROUND;
+ style |= PS_ENDCAP_ROUND;
break;
default:
- style |= PS_ENDCAP_SQUARE;
+ style |= PS_ENDCAP_SQUARE;
break;
}
switch (gc->join_style) {
- case JoinMiter:
- style |= PS_JOIN_MITER;
+ case JoinMiter:
+ style |= PS_JOIN_MITER;
break;
case JoinRound:
- style |= PS_JOIN_ROUND;
+ style |= PS_JOIN_ROUND;
break;
default:
- style |= PS_JOIN_BEVEL;
+ style |= PS_JOIN_BEVEL;
break;
}
return ExtCreatePen(style, gc->line_width, &lb, 0, NULL);
@@ -1350,7 +1351,7 @@ TkWinFillRect(dc, x, y, width, height, pixel)
*----------------------------------------------------------------------
*/
-void
+void
TkpDrawHighlightBorder(tkwin, fgGC, bgGC, highlightWidth, drawable)
Tk_Window tkwin;
GC fgGC;