diff --git a/examples/examples/Games/GameOfLife/.icon.png b/examples/examples/Games/GameOfLife/.icon.png index 0c8c440c8..382dc37f9 100644 Binary files a/examples/examples/Games/GameOfLife/.icon.png and b/examples/examples/Games/GameOfLife/.icon.png differ diff --git a/examples/examples/Games/GameOfLife/.project b/examples/examples/Games/GameOfLife/.project index c11df4066..3e16fa896 100644 --- a/examples/examples/Games/GameOfLife/.project +++ b/examples/examples/Games/GameOfLife/.project @@ -1,5 +1,5 @@ # Gambas Project File 3.0 -# Compiled with Gambas 2.99.0 (r2921) +# Compiled with Gambas 2.99.0 Title=Game of Life Startup=FMain Icon=glob2-icon-48x48.png diff --git a/examples/examples/Games/GameOfLife/.settings b/examples/examples/Games/GameOfLife/.settings index 9c007cb9d..8360b36e0 100644 --- a/examples/examples/Games/GameOfLife/.settings +++ b/examples/examples/Games/GameOfLife/.settings @@ -18,10 +18,10 @@ SearchComment=False SearchString=True [OpenFile] -Active=1 -File[1]="/home/benoit/gambas/3.0/link/share/gambas3/examples/Games/GameOfLife/.src/CGameField.class:160.29" -File[2]="/home/benoit/gambas/3.0/link/share/gambas3/examples/Games/GameOfLife/.src/FMain.class:41.0" -File[3]="/home/benoit/gambas/3.0/link/share/gambas3/examples/Games/GameOfLife/.src/FMain.form" +File[1]=".src/CGameField.class:160.29" +File[2]=".src/FMain.class:41.0" +Active=3 +File[3]=".src/FMain.form" Count=3 [Watches] diff --git a/examples/examples/Games/GameOfLife/.src/CGameField.class b/examples/examples/Games/GameOfLife/.src/CGameField.class index e75d5a59b..4ed130a27 100644 --- a/examples/examples/Games/GameOfLife/.src/CGameField.class +++ b/examples/examples/Games/GameOfLife/.src/CGameField.class @@ -88,8 +88,14 @@ Public Sub DrawGame(bBorder As Boolean) 'Draw.FillColor = Color.LightBackground 'Draw.Rect(4, 4, Game.Width * $iZoom, Game.Height * $iZoom) - Draw.LineStyle = If(bBorder, Line.Solid, Line.None) - Draw.FillColor = Color.red + If bBorder Then + Draw.LineStyle = Line.Solid + Else + Draw.FillRect(0, 0, dw.W, dw.H, Color.Background) + Draw.LineStyle = Line.None + Endif + + Draw.FillColor = Color.Red Draw.Foreground = Color.LightBackground Draw.Zoom(Game, $iZoom, 4, 4) diff --git a/examples/examples/Games/GameOfLife/.src/FMain.class b/examples/examples/Games/GameOfLife/.src/FMain.class index c07245aad..f6f966e4d 100644 --- a/examples/examples/Games/GameOfLife/.src/FMain.class +++ b/examples/examples/Games/GameOfLife/.src/FMain.class @@ -12,7 +12,7 @@ End Public Sub Form_Open() - Draw.Begin(dw) + Draw.Begin(dwgGame) Draw.FillRect(0, 0, Draw.W, Draw.H, Color.White) Draw.End Button1_Click @@ -22,7 +22,7 @@ End Public Sub Button1_Click() Game.Init(chkSmall.Value, Slider2.Value, chkSymetryH.Value, chkSymetryV.Value) - Game.SetDrawArea(dW) + Game.SetDrawArea(dwgGame) DrawGame End @@ -76,7 +76,9 @@ End Public Sub chkBorder_Click() - If Not togEvolution.Value Then DrawGame + If Not togEvolution.Value Then + DrawGame + Endif End diff --git a/examples/examples/Games/GameOfLife/.src/FMain.form b/examples/examples/Games/GameOfLife/.src/FMain.form index 105dd794d..697c961a8 100644 --- a/examples/examples/Games/GameOfLife/.src/FMain.form +++ b/examples/examples/Games/GameOfLife/.src/FMain.form @@ -28,10 +28,10 @@ Text = ("Written in Gambas
\nby Iman Karim
\nand BenoƮt Minisini\n

\nThanks to the Gambas team!") } } - { dW DrawingArea + { dwgGame DrawingArea MoveScaled(31,1,93,93) - Cached = True Border = Border.Plain + Cached = True } { Button1 Button MoveScaled(1,26,29,6) @@ -132,11 +132,11 @@ Value = 50 } { Label1 Label - MoveScaled(1,17,7,3) + MoveScaled(1,18,7,3) Text = ("Alive") } { Label2 Label - MoveScaled(19,17,7,3) + MoveScaled(19,18,7,3) Text = ("Dead") Alignment = Align.Right } diff --git a/gb.gtk/src/gdraw.cpp b/gb.gtk/src/gdraw.cpp index 6e222f2c9..92832e366 100644 --- a/gb.gtk/src/gdraw.cpp +++ b/gb.gtk/src/gdraw.cpp @@ -911,9 +911,16 @@ void gDraw::picture(gPicture *pic, int x, int y, int w, int h, int sx, int sy, i { if (w != sw || h != sh) { + bool smooth; + + if (w >= sw && h >= sw && (w % sw) == 0 && (h % sh) == 0) + smooth = false; + else + smooth = true; + gPicture *pic2; pic2 = pic->copy(sx, sy, sw, sh); - pic = pic2->stretch(w, h, true); + pic = pic2->stretch(w, h, smooth); delete pic2; del = true; sx = 0; sy = 0; sw = w; sh = h; diff --git a/gb.qt4/src/CDraw.cpp b/gb.qt4/src/CDraw.cpp index 86e7e37bb..6a19596f5 100644 --- a/gb.qt4/src/CDraw.cpp +++ b/gb.qt4/src/CDraw.cpp @@ -649,7 +649,6 @@ static void draw_image(GB_DRAW *d, GB_IMAGE image, int x, int y, int w, int h, i DRAW_NORMALIZE(x, y, w, h, sx, sy, sw, sh, p->width(), p->height()); xform = (w != sw || h != sh); - if (w >= sw && h >= sw && (w % sw) == 0 && (h % sh) == 0) mode = Qt::FastTransformation; else diff --git a/gb.qt4/src/CDrawingArea.cpp b/gb.qt4/src/CDrawingArea.cpp index 8bd462376..cb9275ac2 100644 --- a/gb.qt4/src/CDrawingArea.cpp +++ b/gb.qt4/src/CDrawingArea.cpp @@ -228,6 +228,7 @@ void MyDrawingArea::setBackground() //else _set_background = true; refreshBackground(); + //XSetWindowBackgroundPixmap(QX11Info::display(), winId(), _background->handle()); #endif } } @@ -283,8 +284,8 @@ void MyDrawingArea::updateBackground() { w = QMAX(width(), 1); h = QMAX(height(), 1); - - if (w != _background->width() && h != _background->height()) + + if (w != _background->width() || h != _background->height()) { QPixmap *p = new QPixmap(w, h); p->fill(palette().color(backgroundRole()));