repair refrech clipping, and clip only for transparent canvases (because the editor probably doesn't work right with clipping)
svn: r9833
This commit is contained in:
parent
77d67718bc
commit
c19191d35e
|
@ -38,7 +38,7 @@ class wxCanvasDC: public wxbCanvasDC
|
|||
int pixmapWidth;
|
||||
int pixmapHeight;
|
||||
|
||||
RgnHandle current_reg, onpaint_reg;
|
||||
RgnHandle current_reg, onpaint_reg, clip_reg;
|
||||
|
||||
int current_pen_join;
|
||||
int current_pen_cap;
|
||||
|
|
|
@ -869,12 +869,20 @@ void wxCanvas::DoPaint(void)
|
|||
if (EmptyRgn(needs_update))
|
||||
return;
|
||||
|
||||
rgn = NewRgn();
|
||||
if (cStyle & wxTRANSPARENT_WIN)
|
||||
rgn = NewRgn();
|
||||
else
|
||||
rgn = NULL;
|
||||
if (rgn) {
|
||||
CopyRgn(needs_update, rgn);
|
||||
SetRectRgn(needs_update, 0, 0, 0, 0);
|
||||
wx_dc->onpaint_reg = rgn;
|
||||
if (wx_dc->clip_reg) {
|
||||
/* FIXME: nested on-paint... */
|
||||
}
|
||||
wx_dc->clip_reg = rgn;
|
||||
wx_dc->SetCanvasClipping();
|
||||
} else {
|
||||
SetRectRgn(needs_update, 0, 0, 0, 0);
|
||||
}
|
||||
} else
|
||||
rgn = NULL;
|
||||
|
@ -886,20 +894,24 @@ void wxCanvas::DoPaint(void)
|
|||
RGBColor pixel;
|
||||
|
||||
pixel = bgcol->pixel;
|
||||
|
||||
|
||||
SetCurrentDC();
|
||||
if (rgn)
|
||||
SetClip(rgn);
|
||||
GetThemeDrawingState(&s);
|
||||
GetControlBounds(cPaintControl, &itemRect);
|
||||
RGBBackColor(&pixel);
|
||||
BackPat(GetWhitePattern());
|
||||
EraseRect(&itemRect);
|
||||
SetThemeDrawingState(s, TRUE);
|
||||
if (rgn)
|
||||
cMacDC->setCurrentUser(NULL);
|
||||
}
|
||||
|
||||
OnPaint();
|
||||
|
||||
if (rgn) {
|
||||
wx_dc->onpaint_reg = NULL;
|
||||
wx_dc->clip_reg = NULL;
|
||||
wx_dc->SetCanvasClipping();
|
||||
DisposeRgn(rgn);
|
||||
}
|
||||
|
|
|
@ -70,8 +70,9 @@ void wxCanvasDC::Init(wxCanvas* the_canvas)
|
|||
pixmapWidth = 0;
|
||||
pixmapHeight = 0;
|
||||
|
||||
current_reg = NULL ;
|
||||
onpaint_reg = NULL ;
|
||||
current_reg = NULL;
|
||||
onpaint_reg = NULL;
|
||||
clip_reg = NULL;
|
||||
|
||||
min_x = 0; min_y = 0; max_x = 0; max_y = 0;
|
||||
|
||||
|
@ -135,6 +136,10 @@ wxCanvasDC::~wxCanvasDC(void)
|
|||
::DisposeRgn(onpaint_reg);
|
||||
onpaint_reg = NULL;
|
||||
}
|
||||
if (clip_reg) {
|
||||
::DisposeRgn(clip_reg);
|
||||
clip_reg = NULL;
|
||||
}
|
||||
canvas = NULL;
|
||||
|
||||
if (reset_chain == this) {
|
||||
|
@ -279,7 +284,7 @@ void wxCanvasDC::SetCanvasClipping(void)
|
|||
if (current_reg) {
|
||||
::DisposeRgn(current_reg);
|
||||
}
|
||||
if (clipping || onpaint_reg) {
|
||||
if (clipping || onpaint_reg || clip_reg) {
|
||||
current_reg = ::NewRgn();
|
||||
CheckMemOK(current_reg);
|
||||
} else
|
||||
|
@ -287,18 +292,22 @@ void wxCanvasDC::SetCanvasClipping(void)
|
|||
|
||||
if (clipping && !clipping->rgn) {
|
||||
/* NULL rgn pointer means the empty region */
|
||||
if (!current_reg) {
|
||||
current_reg = ::NewRgn();
|
||||
CheckMemOK(current_reg);
|
||||
}
|
||||
} else if (clipping) {
|
||||
::CopyRgn(clipping->rgn, current_reg);
|
||||
::OffsetRgn(current_reg, auto_device_origin_x, auto_device_origin_y);
|
||||
if (onpaint_reg) {
|
||||
::SectRgn(current_reg, onpaint_reg, current_reg) ;
|
||||
::SectRgn(current_reg, onpaint_reg, current_reg);
|
||||
}
|
||||
if (clip_reg) {
|
||||
::SectRgn(current_reg, clip_reg, current_reg);
|
||||
}
|
||||
} else if (onpaint_reg) {
|
||||
::CopyRgn(onpaint_reg, current_reg);
|
||||
if (clip_reg) {
|
||||
::SectRgn(current_reg, clip_reg, current_reg);
|
||||
}
|
||||
} else if (clip_reg) {
|
||||
::CopyRgn(clip_reg, current_reg);
|
||||
}
|
||||
|
||||
theCurrentUser = cMacDC->currentUser();
|
||||
|
@ -956,11 +965,17 @@ CGContextRef wxCanvasDC::GetCG()
|
|||
/* Leave the region empty */
|
||||
} else {
|
||||
if (clipRgn) {
|
||||
if (onpaint_reg) {
|
||||
if (onpaint_reg || clip_reg) {
|
||||
RgnHandle visRgn;
|
||||
visRgn = NewRgn();
|
||||
if (visRgn) {
|
||||
::CopyRgn(onpaint_reg, clipRgn); // GetPortClipRegion(qdp, clipRgn);
|
||||
if (onpaint_reg) {
|
||||
::CopyRgn(onpaint_reg, clipRgn);
|
||||
if (clip_reg)
|
||||
::SectRgn(current_reg, clip_reg, current_reg);
|
||||
} else {
|
||||
::CopyRgn(clip_reg, clipRgn);
|
||||
}
|
||||
::OffsetRgn(clipRgn, gdx, gdy);
|
||||
GetPortVisibleRegion(qdp, visRgn);
|
||||
SectRgn(clipRgn, visRgn, clipRgn);
|
||||
|
|
Loading…
Reference in New Issue
Block a user