CalcBoundingBox() added so that Max() works in wxDC
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@991 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -362,6 +362,8 @@ void wxDC::ComputeScaleAndOrigin(void)
|
|||||||
{
|
{
|
||||||
// this is a bit artificial, but we need to force wxDC to think
|
// this is a bit artificial, but we need to force wxDC to think
|
||||||
// the pen has changed
|
// the pen has changed
|
||||||
|
// Using this code, wxDC will ignore the new settings
|
||||||
|
// so it's complete non-sense, Robert Roebling TODO!!
|
||||||
wxPen* pen = GetPen();
|
wxPen* pen = GetPen();
|
||||||
wxPen tempPen;
|
wxPen tempPen;
|
||||||
m_pen = tempPen;
|
m_pen = tempPen;
|
||||||
|
@@ -61,12 +61,11 @@ void gdk_draw_bitmap (GdkDrawable *drawable,
|
|||||||
src_private = (GdkWindowPrivate*) src;
|
src_private = (GdkWindowPrivate*) src;
|
||||||
if (drawable_private->destroyed || src_private->destroyed)
|
if (drawable_private->destroyed || src_private->destroyed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gc_private = (GdkGCPrivate*) gc;
|
gc_private = (GdkGCPrivate*) gc;
|
||||||
|
|
||||||
if (width == -1)
|
if (width == -1) width = src_private->width;
|
||||||
width = src_private->width;
|
if (height == -1) height = src_private->height;
|
||||||
if (height == -1)
|
|
||||||
height = src_private->height;
|
|
||||||
|
|
||||||
XCopyPlane( drawable_private->xdisplay,
|
XCopyPlane( drawable_private->xdisplay,
|
||||||
src_private->xwindow,
|
src_private->xwindow,
|
||||||
@@ -143,6 +142,9 @@ void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 )
|
|||||||
gdk_draw_line( m_window, m_penGC,
|
gdk_draw_line( m_window, m_penGC,
|
||||||
XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
|
XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CalcBoundingBox(x1, y1);
|
||||||
|
CalcBoundingBox(x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::CrossHair( long x, long y )
|
void wxPaintDC::CrossHair( long x, long y )
|
||||||
@@ -156,10 +158,8 @@ void wxPaintDC::CrossHair( long x, long y )
|
|||||||
GetSize( &w, &h );
|
GetSize( &w, &h );
|
||||||
long xx = XLOG2DEV(x);
|
long xx = XLOG2DEV(x);
|
||||||
long yy = YLOG2DEV(y);
|
long yy = YLOG2DEV(y);
|
||||||
gdk_draw_line( m_window, m_penGC,
|
gdk_draw_line( m_window, m_penGC, 0, yy, XLOG2DEVREL(w), yy );
|
||||||
0, yy, XLOG2DEVREL(w), yy );
|
gdk_draw_line( m_window, m_penGC, xx, 0, xx, YLOG2DEVREL(h) );
|
||||||
gdk_draw_line( m_window, m_penGC,
|
|
||||||
xx, 0, xx, YLOG2DEVREL(h) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,6 +209,8 @@ void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double y
|
|||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_arc( m_window, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
|
gdk_draw_arc( m_window, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
|
||||||
|
|
||||||
|
CalcBoundingBox (x1, y1);
|
||||||
|
CalcBoundingBox (x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
|
void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
|
||||||
@@ -231,6 +233,9 @@ void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double
|
|||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, start, end );
|
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, start, end );
|
||||||
|
|
||||||
|
CalcBoundingBox (x, y);
|
||||||
|
CalcBoundingBox (x + width, y + height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::DrawPoint( long x, long y )
|
void wxPaintDC::DrawPoint( long x, long y )
|
||||||
@@ -239,6 +244,8 @@ void wxPaintDC::DrawPoint( long x, long y )
|
|||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
|
gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
|
||||||
|
|
||||||
|
CalcBoundingBox (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
||||||
@@ -246,6 +253,9 @@ void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
|||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
||||||
|
if (n <= 0) return;
|
||||||
|
|
||||||
|
CalcBoundingBox( points[0].x + xoffset, points[0].y + yoffset );
|
||||||
|
|
||||||
for (int i = 0; i < n-1; i++)
|
for (int i = 0; i < n-1; i++)
|
||||||
{
|
{
|
||||||
@@ -254,6 +264,8 @@ void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
|||||||
long y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste
|
long y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste
|
||||||
long y2 = YLOG2DEV(points[i+1].y + yoffset);
|
long y2 = YLOG2DEV(points[i+1].y + yoffset);
|
||||||
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
|
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
|
||||||
|
|
||||||
|
CalcBoundingBox( points[i+1].x + xoffset, points[i+1].y + yoffset );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,16 +276,23 @@ void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
|
|||||||
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
||||||
|
|
||||||
wxNode *node = points->First();
|
wxNode *node = points->First();
|
||||||
|
if (!node) return;
|
||||||
|
|
||||||
|
wxPoint *pt = (wxPoint*)node->Data();
|
||||||
|
CalcBoundingBox( pt->x + xoffset, pt->y + yoffset );
|
||||||
|
|
||||||
while (node->Next())
|
while (node->Next())
|
||||||
{
|
{
|
||||||
wxPoint *point = (wxPoint*)node->Data();
|
wxPoint *point = (wxPoint*)node->Data();
|
||||||
wxPoint *npoint = (wxPoint*)node->Next()->Data();
|
wxPoint *npoint = (wxPoint*)node->Next()->Data();
|
||||||
long x1 = XLOG2DEV(point->x + xoffset);
|
long x1 = XLOG2DEV(point->x + xoffset);
|
||||||
long x2 = XLOG2DEV(npoint->x + xoffset);
|
long x2 = XLOG2DEV(npoint->x + xoffset);
|
||||||
long y1 = YLOG2DEV(point->y + yoffset); // and again...
|
long y1 = YLOG2DEV(point->y + yoffset); // and a waste again...
|
||||||
long y2 = YLOG2DEV(npoint->y + yoffset);
|
long y2 = YLOG2DEV(npoint->y + yoffset);
|
||||||
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
|
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
|
|
||||||
|
CalcBoundingBox( npoint->x + xoffset, npoint->y + yoffset );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,24 +300,33 @@ void wxPaintDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!n) return; // Nothing to draw
|
if (!n) return;
|
||||||
|
|
||||||
GdkPoint *gdkpoints = new GdkPoint[n+1];
|
GdkPoint *gdkpoints = new GdkPoint[n+1];
|
||||||
int i;
|
int i;
|
||||||
for (i = 0 ; i < n ; i++)
|
for (i = 0 ; i < n ; i++)
|
||||||
{
|
{
|
||||||
gdkpoints[i].x = XLOG2DEV(points[i].x + xoffset);
|
gdkpoints[i].x = XLOG2DEV(points[i].x + xoffset);
|
||||||
gdkpoints[i].y = YLOG2DEV(points[i].y + yoffset);
|
gdkpoints[i].y = YLOG2DEV(points[i].y + yoffset);
|
||||||
|
|
||||||
|
CalcBoundingBox( points[i].x + xoffset, points[i].y + yoffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_brush.GetStyle() != wxTRANSPARENT)
|
if (m_brush.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
|
gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
|
||||||
|
|
||||||
// To do: Fillstyle
|
// To do: Fillstyle
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
for (i = 0 ; i < n ; i++)
|
for (i = 0 ; i < n ; i++)
|
||||||
|
{
|
||||||
gdk_draw_line( m_window, m_penGC,
|
gdk_draw_line( m_window, m_penGC,
|
||||||
gdkpoints[i%n].x,
|
gdkpoints[i%n].x,
|
||||||
gdkpoints[i%n].y,
|
gdkpoints[i%n].y,
|
||||||
gdkpoints[(i+1)%n].x,
|
gdkpoints[(i+1)%n].x,
|
||||||
gdkpoints[(i+1)%n].y);
|
gdkpoints[(i+1)%n].y);
|
||||||
|
}
|
||||||
|
|
||||||
delete[] gdkpoints;
|
delete[] gdkpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,6 +335,8 @@ void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUN
|
|||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
int n = lines->Number();
|
int n = lines->Number();
|
||||||
|
if (!n) return;
|
||||||
|
|
||||||
GdkPoint *gdkpoints = new GdkPoint[n];
|
GdkPoint *gdkpoints = new GdkPoint[n];
|
||||||
wxNode *node = lines->First();
|
wxNode *node = lines->First();
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
@@ -317,20 +347,27 @@ void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUN
|
|||||||
gdkpoints[cnt].y = YLOG2DEV(p->y + yoffset);
|
gdkpoints[cnt].y = YLOG2DEV(p->y + yoffset);
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
cnt++;
|
cnt++;
|
||||||
|
|
||||||
|
CalcBoundingBox( p->x + xoffset, p->y + yoffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_brush.GetStyle() != wxTRANSPARENT)
|
if (m_brush.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
|
gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
|
||||||
|
|
||||||
// To do: Fillstyle
|
// To do: Fillstyle
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0 ; i < n ; i++)
|
for (i = 0 ; i < n ; i++)
|
||||||
|
{
|
||||||
gdk_draw_line( m_window, m_penGC,
|
gdk_draw_line( m_window, m_penGC,
|
||||||
gdkpoints[i%n].x,
|
gdkpoints[i%n].x,
|
||||||
gdkpoints[i%n].y,
|
gdkpoints[i%n].y,
|
||||||
gdkpoints[(i+1)%n].x,
|
gdkpoints[(i+1)%n].x,
|
||||||
gdkpoints[(i+1)%n].y );
|
gdkpoints[(i+1)%n].y );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
delete[] gdkpoints;
|
delete[] gdkpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,6 +392,9 @@ void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
|
|||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
|
gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
|
||||||
|
|
||||||
|
CalcBoundingBox( x, y );
|
||||||
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
|
void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
|
||||||
@@ -420,6 +460,10 @@ void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, d
|
|||||||
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
|
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
|
||||||
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
|
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this ignores the radius
|
||||||
|
CalcBoundingBox( x, y );
|
||||||
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
|
void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
|
||||||
@@ -440,6 +484,9 @@ void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
|
|||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 );
|
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 );
|
||||||
|
|
||||||
|
CalcBoundingBox( x, y );
|
||||||
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPaintDC::CanDrawBitmap(void) const
|
bool wxPaintDC::CanDrawBitmap(void) const
|
||||||
@@ -473,6 +520,11 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
|
|||||||
gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL );
|
gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL );
|
||||||
gdk_gc_set_clip_origin( m_penGC, 0, 0 );
|
gdk_gc_set_clip_origin( m_penGC, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CalcBoundingBox( x, y );
|
||||||
|
int width = icon.GetWidth();
|
||||||
|
int height = icon.GetHeight();
|
||||||
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
||||||
@@ -480,6 +532,9 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
|||||||
{
|
{
|
||||||
if (!Ok()) return FALSE;
|
if (!Ok()) return FALSE;
|
||||||
|
|
||||||
|
CalcBoundingBox( xdest, ydest );
|
||||||
|
CalcBoundingBox( xdest + width, ydest + height );
|
||||||
|
|
||||||
wxClientDC *csrc = (wxClientDC*)source;
|
wxClientDC *csrc = (wxClientDC*)source;
|
||||||
|
|
||||||
if (csrc->m_isMemDC)
|
if (csrc->m_isMemDC)
|
||||||
@@ -521,8 +576,10 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
|||||||
gdk_window_copy_area ( m_window, m_penGC,
|
gdk_window_copy_area ( m_window, m_penGC,
|
||||||
XLOG2DEV(xdest), YLOG2DEV(ydest),
|
XLOG2DEV(xdest), YLOG2DEV(ydest),
|
||||||
csrc->GetWindow(),
|
csrc->GetWindow(),
|
||||||
source->DeviceToLogicalX(xsrc), source->DeviceToLogicalY(ysrc),
|
source->DeviceToLogicalX(xsrc),
|
||||||
source->DeviceToLogicalXRel(width), source->DeviceToLogicalYRel(height) );
|
source->DeviceToLogicalY(ysrc),
|
||||||
|
source->DeviceToLogicalXRel(width),
|
||||||
|
source->DeviceToLogicalYRel(height) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
gdk_window_copy_area ( m_window, m_penGC,
|
gdk_window_copy_area ( m_window, m_penGC,
|
||||||
@@ -565,6 +622,11 @@ void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(us
|
|||||||
if (font->descent > 0) ul_y++;
|
if (font->descent > 0) ul_y++;
|
||||||
gdk_draw_line( m_window, m_textGC, x, ul_y, x + width, ul_y);
|
gdk_draw_line( m_window, m_textGC, x, ul_y, x + width, ul_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long w, h;
|
||||||
|
GetTextExtent (text, &w, &h);
|
||||||
|
CalcBoundingBox (x + w, y + h);
|
||||||
|
CalcBoundingBox (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPaintDC::CanGetTextExtent(void) const
|
bool wxPaintDC::CanGetTextExtent(void) const
|
||||||
@@ -614,8 +676,7 @@ void wxPaintDC::Clear(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int width = 0;
|
int width,height;
|
||||||
int height = 0;
|
|
||||||
GetSize( &width, &height );
|
GetSize( &width, &height );
|
||||||
gdk_draw_rectangle( m_window, m_bgGC, TRUE, 0, 0, width, height );
|
gdk_draw_rectangle( m_window, m_bgGC, TRUE, 0, 0, width, height );
|
||||||
}
|
}
|
||||||
@@ -832,7 +893,6 @@ void wxPaintDC::SetClippingRegion( long x, long y, long width, long height )
|
|||||||
gdk_gc_set_clip_rectangle( m_brushGC, &rect );
|
gdk_gc_set_clip_rectangle( m_brushGC, &rect );
|
||||||
gdk_gc_set_clip_rectangle( m_textGC, &rect );
|
gdk_gc_set_clip_rectangle( m_textGC, &rect );
|
||||||
gdk_gc_set_clip_rectangle( m_bgGC, &rect );
|
gdk_gc_set_clip_rectangle( m_bgGC, &rect );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::DestroyClippingRegion(void)
|
void wxPaintDC::DestroyClippingRegion(void)
|
||||||
|
@@ -362,6 +362,8 @@ void wxDC::ComputeScaleAndOrigin(void)
|
|||||||
{
|
{
|
||||||
// this is a bit artificial, but we need to force wxDC to think
|
// this is a bit artificial, but we need to force wxDC to think
|
||||||
// the pen has changed
|
// the pen has changed
|
||||||
|
// Using this code, wxDC will ignore the new settings
|
||||||
|
// so it's complete non-sense, Robert Roebling TODO!!
|
||||||
wxPen* pen = GetPen();
|
wxPen* pen = GetPen();
|
||||||
wxPen tempPen;
|
wxPen tempPen;
|
||||||
m_pen = tempPen;
|
m_pen = tempPen;
|
||||||
|
@@ -61,12 +61,11 @@ void gdk_draw_bitmap (GdkDrawable *drawable,
|
|||||||
src_private = (GdkWindowPrivate*) src;
|
src_private = (GdkWindowPrivate*) src;
|
||||||
if (drawable_private->destroyed || src_private->destroyed)
|
if (drawable_private->destroyed || src_private->destroyed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gc_private = (GdkGCPrivate*) gc;
|
gc_private = (GdkGCPrivate*) gc;
|
||||||
|
|
||||||
if (width == -1)
|
if (width == -1) width = src_private->width;
|
||||||
width = src_private->width;
|
if (height == -1) height = src_private->height;
|
||||||
if (height == -1)
|
|
||||||
height = src_private->height;
|
|
||||||
|
|
||||||
XCopyPlane( drawable_private->xdisplay,
|
XCopyPlane( drawable_private->xdisplay,
|
||||||
src_private->xwindow,
|
src_private->xwindow,
|
||||||
@@ -143,6 +142,9 @@ void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 )
|
|||||||
gdk_draw_line( m_window, m_penGC,
|
gdk_draw_line( m_window, m_penGC,
|
||||||
XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
|
XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CalcBoundingBox(x1, y1);
|
||||||
|
CalcBoundingBox(x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::CrossHair( long x, long y )
|
void wxPaintDC::CrossHair( long x, long y )
|
||||||
@@ -156,10 +158,8 @@ void wxPaintDC::CrossHair( long x, long y )
|
|||||||
GetSize( &w, &h );
|
GetSize( &w, &h );
|
||||||
long xx = XLOG2DEV(x);
|
long xx = XLOG2DEV(x);
|
||||||
long yy = YLOG2DEV(y);
|
long yy = YLOG2DEV(y);
|
||||||
gdk_draw_line( m_window, m_penGC,
|
gdk_draw_line( m_window, m_penGC, 0, yy, XLOG2DEVREL(w), yy );
|
||||||
0, yy, XLOG2DEVREL(w), yy );
|
gdk_draw_line( m_window, m_penGC, xx, 0, xx, YLOG2DEVREL(h) );
|
||||||
gdk_draw_line( m_window, m_penGC,
|
|
||||||
xx, 0, xx, YLOG2DEVREL(h) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,6 +209,8 @@ void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double y
|
|||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_arc( m_window, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
|
gdk_draw_arc( m_window, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
|
||||||
|
|
||||||
|
CalcBoundingBox (x1, y1);
|
||||||
|
CalcBoundingBox (x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
|
void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
|
||||||
@@ -231,6 +233,9 @@ void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double
|
|||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, start, end );
|
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, start, end );
|
||||||
|
|
||||||
|
CalcBoundingBox (x, y);
|
||||||
|
CalcBoundingBox (x + width, y + height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::DrawPoint( long x, long y )
|
void wxPaintDC::DrawPoint( long x, long y )
|
||||||
@@ -239,6 +244,8 @@ void wxPaintDC::DrawPoint( long x, long y )
|
|||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
|
gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
|
||||||
|
|
||||||
|
CalcBoundingBox (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
||||||
@@ -246,6 +253,9 @@ void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
|||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
||||||
|
if (n <= 0) return;
|
||||||
|
|
||||||
|
CalcBoundingBox( points[0].x + xoffset, points[0].y + yoffset );
|
||||||
|
|
||||||
for (int i = 0; i < n-1; i++)
|
for (int i = 0; i < n-1; i++)
|
||||||
{
|
{
|
||||||
@@ -254,6 +264,8 @@ void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
|||||||
long y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste
|
long y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste
|
||||||
long y2 = YLOG2DEV(points[i+1].y + yoffset);
|
long y2 = YLOG2DEV(points[i+1].y + yoffset);
|
||||||
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
|
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
|
||||||
|
|
||||||
|
CalcBoundingBox( points[i+1].x + xoffset, points[i+1].y + yoffset );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,16 +276,23 @@ void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
|
|||||||
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
||||||
|
|
||||||
wxNode *node = points->First();
|
wxNode *node = points->First();
|
||||||
|
if (!node) return;
|
||||||
|
|
||||||
|
wxPoint *pt = (wxPoint*)node->Data();
|
||||||
|
CalcBoundingBox( pt->x + xoffset, pt->y + yoffset );
|
||||||
|
|
||||||
while (node->Next())
|
while (node->Next())
|
||||||
{
|
{
|
||||||
wxPoint *point = (wxPoint*)node->Data();
|
wxPoint *point = (wxPoint*)node->Data();
|
||||||
wxPoint *npoint = (wxPoint*)node->Next()->Data();
|
wxPoint *npoint = (wxPoint*)node->Next()->Data();
|
||||||
long x1 = XLOG2DEV(point->x + xoffset);
|
long x1 = XLOG2DEV(point->x + xoffset);
|
||||||
long x2 = XLOG2DEV(npoint->x + xoffset);
|
long x2 = XLOG2DEV(npoint->x + xoffset);
|
||||||
long y1 = YLOG2DEV(point->y + yoffset); // and again...
|
long y1 = YLOG2DEV(point->y + yoffset); // and a waste again...
|
||||||
long y2 = YLOG2DEV(npoint->y + yoffset);
|
long y2 = YLOG2DEV(npoint->y + yoffset);
|
||||||
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
|
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
|
|
||||||
|
CalcBoundingBox( npoint->x + xoffset, npoint->y + yoffset );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,24 +300,33 @@ void wxPaintDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset
|
|||||||
{
|
{
|
||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
if (!n) return; // Nothing to draw
|
if (!n) return;
|
||||||
|
|
||||||
GdkPoint *gdkpoints = new GdkPoint[n+1];
|
GdkPoint *gdkpoints = new GdkPoint[n+1];
|
||||||
int i;
|
int i;
|
||||||
for (i = 0 ; i < n ; i++)
|
for (i = 0 ; i < n ; i++)
|
||||||
{
|
{
|
||||||
gdkpoints[i].x = XLOG2DEV(points[i].x + xoffset);
|
gdkpoints[i].x = XLOG2DEV(points[i].x + xoffset);
|
||||||
gdkpoints[i].y = YLOG2DEV(points[i].y + yoffset);
|
gdkpoints[i].y = YLOG2DEV(points[i].y + yoffset);
|
||||||
|
|
||||||
|
CalcBoundingBox( points[i].x + xoffset, points[i].y + yoffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_brush.GetStyle() != wxTRANSPARENT)
|
if (m_brush.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
|
gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
|
||||||
|
|
||||||
// To do: Fillstyle
|
// To do: Fillstyle
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
for (i = 0 ; i < n ; i++)
|
for (i = 0 ; i < n ; i++)
|
||||||
|
{
|
||||||
gdk_draw_line( m_window, m_penGC,
|
gdk_draw_line( m_window, m_penGC,
|
||||||
gdkpoints[i%n].x,
|
gdkpoints[i%n].x,
|
||||||
gdkpoints[i%n].y,
|
gdkpoints[i%n].y,
|
||||||
gdkpoints[(i+1)%n].x,
|
gdkpoints[(i+1)%n].x,
|
||||||
gdkpoints[(i+1)%n].y);
|
gdkpoints[(i+1)%n].y);
|
||||||
|
}
|
||||||
|
|
||||||
delete[] gdkpoints;
|
delete[] gdkpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,6 +335,8 @@ void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUN
|
|||||||
if (!Ok()) return;
|
if (!Ok()) return;
|
||||||
|
|
||||||
int n = lines->Number();
|
int n = lines->Number();
|
||||||
|
if (!n) return;
|
||||||
|
|
||||||
GdkPoint *gdkpoints = new GdkPoint[n];
|
GdkPoint *gdkpoints = new GdkPoint[n];
|
||||||
wxNode *node = lines->First();
|
wxNode *node = lines->First();
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
@@ -317,20 +347,27 @@ void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUN
|
|||||||
gdkpoints[cnt].y = YLOG2DEV(p->y + yoffset);
|
gdkpoints[cnt].y = YLOG2DEV(p->y + yoffset);
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
cnt++;
|
cnt++;
|
||||||
|
|
||||||
|
CalcBoundingBox( p->x + xoffset, p->y + yoffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_brush.GetStyle() != wxTRANSPARENT)
|
if (m_brush.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
|
gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
|
||||||
|
|
||||||
// To do: Fillstyle
|
// To do: Fillstyle
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0 ; i < n ; i++)
|
for (i = 0 ; i < n ; i++)
|
||||||
|
{
|
||||||
gdk_draw_line( m_window, m_penGC,
|
gdk_draw_line( m_window, m_penGC,
|
||||||
gdkpoints[i%n].x,
|
gdkpoints[i%n].x,
|
||||||
gdkpoints[i%n].y,
|
gdkpoints[i%n].y,
|
||||||
gdkpoints[(i+1)%n].x,
|
gdkpoints[(i+1)%n].x,
|
||||||
gdkpoints[(i+1)%n].y );
|
gdkpoints[(i+1)%n].y );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
delete[] gdkpoints;
|
delete[] gdkpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,6 +392,9 @@ void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
|
|||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
|
gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
|
||||||
|
|
||||||
|
CalcBoundingBox( x, y );
|
||||||
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
|
void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
|
||||||
@@ -420,6 +460,10 @@ void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, d
|
|||||||
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
|
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
|
||||||
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
|
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this ignores the radius
|
||||||
|
CalcBoundingBox( x, y );
|
||||||
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
|
void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
|
||||||
@@ -440,6 +484,9 @@ void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
|
|||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 );
|
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 );
|
||||||
|
|
||||||
|
CalcBoundingBox( x, y );
|
||||||
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPaintDC::CanDrawBitmap(void) const
|
bool wxPaintDC::CanDrawBitmap(void) const
|
||||||
@@ -473,6 +520,11 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
|
|||||||
gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL );
|
gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL );
|
||||||
gdk_gc_set_clip_origin( m_penGC, 0, 0 );
|
gdk_gc_set_clip_origin( m_penGC, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CalcBoundingBox( x, y );
|
||||||
|
int width = icon.GetWidth();
|
||||||
|
int height = icon.GetHeight();
|
||||||
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
||||||
@@ -480,6 +532,9 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
|||||||
{
|
{
|
||||||
if (!Ok()) return FALSE;
|
if (!Ok()) return FALSE;
|
||||||
|
|
||||||
|
CalcBoundingBox( xdest, ydest );
|
||||||
|
CalcBoundingBox( xdest + width, ydest + height );
|
||||||
|
|
||||||
wxClientDC *csrc = (wxClientDC*)source;
|
wxClientDC *csrc = (wxClientDC*)source;
|
||||||
|
|
||||||
if (csrc->m_isMemDC)
|
if (csrc->m_isMemDC)
|
||||||
@@ -521,8 +576,10 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
|||||||
gdk_window_copy_area ( m_window, m_penGC,
|
gdk_window_copy_area ( m_window, m_penGC,
|
||||||
XLOG2DEV(xdest), YLOG2DEV(ydest),
|
XLOG2DEV(xdest), YLOG2DEV(ydest),
|
||||||
csrc->GetWindow(),
|
csrc->GetWindow(),
|
||||||
source->DeviceToLogicalX(xsrc), source->DeviceToLogicalY(ysrc),
|
source->DeviceToLogicalX(xsrc),
|
||||||
source->DeviceToLogicalXRel(width), source->DeviceToLogicalYRel(height) );
|
source->DeviceToLogicalY(ysrc),
|
||||||
|
source->DeviceToLogicalXRel(width),
|
||||||
|
source->DeviceToLogicalYRel(height) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
gdk_window_copy_area ( m_window, m_penGC,
|
gdk_window_copy_area ( m_window, m_penGC,
|
||||||
@@ -565,6 +622,11 @@ void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(us
|
|||||||
if (font->descent > 0) ul_y++;
|
if (font->descent > 0) ul_y++;
|
||||||
gdk_draw_line( m_window, m_textGC, x, ul_y, x + width, ul_y);
|
gdk_draw_line( m_window, m_textGC, x, ul_y, x + width, ul_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long w, h;
|
||||||
|
GetTextExtent (text, &w, &h);
|
||||||
|
CalcBoundingBox (x + w, y + h);
|
||||||
|
CalcBoundingBox (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPaintDC::CanGetTextExtent(void) const
|
bool wxPaintDC::CanGetTextExtent(void) const
|
||||||
@@ -614,8 +676,7 @@ void wxPaintDC::Clear(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int width = 0;
|
int width,height;
|
||||||
int height = 0;
|
|
||||||
GetSize( &width, &height );
|
GetSize( &width, &height );
|
||||||
gdk_draw_rectangle( m_window, m_bgGC, TRUE, 0, 0, width, height );
|
gdk_draw_rectangle( m_window, m_bgGC, TRUE, 0, 0, width, height );
|
||||||
}
|
}
|
||||||
@@ -832,7 +893,6 @@ void wxPaintDC::SetClippingRegion( long x, long y, long width, long height )
|
|||||||
gdk_gc_set_clip_rectangle( m_brushGC, &rect );
|
gdk_gc_set_clip_rectangle( m_brushGC, &rect );
|
||||||
gdk_gc_set_clip_rectangle( m_textGC, &rect );
|
gdk_gc_set_clip_rectangle( m_textGC, &rect );
|
||||||
gdk_gc_set_clip_rectangle( m_bgGC, &rect );
|
gdk_gc_set_clip_rectangle( m_bgGC, &rect );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPaintDC::DestroyClippingRegion(void)
|
void wxPaintDC::DestroyClippingRegion(void)
|
||||||
|
Reference in New Issue
Block a user