Simplify clip region handling under Windows, which also makes Solo's

clipping policy work properly. I haven't proved why it didn't work
the previous way, but I have a good guess: I think that clip regions
are handled by reference. So I saved the old clip region out of the
DC, then did an IntersectClipRect, and then selected the old clip
region back in again - but the old clip region had never been
_de_-selected, because IntersectClipRect didn't change which object
was selected but rather it modified-in-place the one that already
was selected. So my attempt to restore the old clip region did
nothing whatsoever, and thus clipping to two different rectangles
during the same draw sequence failed. Now I'm completely destroying
the clip region during unclip(), which seems to work better.

[originally from svn r5662]
This commit is contained in:
Simon Tatham
2005-04-23 17:09:19 +00:00
parent 5b1235c369
commit c7085f0ffb

View File

@ -154,18 +154,12 @@ void frontend_default_colour(frontend *fe, float *output)
void clip(frontend *fe, int x, int y, int w, int h) void clip(frontend *fe, int x, int y, int w, int h)
{ {
if (!fe->clip) {
fe->clip = CreateRectRgn(0, 0, 1, 1);
GetClipRgn(fe->hdc_bm, fe->clip);
}
IntersectClipRect(fe->hdc_bm, x, y, x+w, y+h); IntersectClipRect(fe->hdc_bm, x, y, x+w, y+h);
} }
void unclip(frontend *fe) void unclip(frontend *fe)
{ {
assert(fe->clip); SelectClipRgn(fe->hdc_bm, NULL);
SelectClipRgn(fe->hdc_bm, fe->clip);
} }
void draw_text(frontend *fe, int x, int y, int fonttype, int fontsize, void draw_text(frontend *fe, int x, int y, int fonttype, int fontsize,