* BUG: Draw.Picture() and Draw.Zoom() now have the same behaviour as 
  gb.qt4. The picture is not smoothed when it is enlarged by an integer
  ratio.

[GB.QT4]
* BUG: Cached DrawingArea refresh should work again.
* BUG: Resizing a cached DrawingArea should work correctly now.


git-svn-id: svn://localhost/gambas/trunk@3394 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2010-12-23 00:23:58 +00:00
parent b86a35e903
commit e5cac201f2
9 changed files with 33 additions and 18 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -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

View File

@ -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]

View File

@ -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)

View File

@ -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

View File

@ -28,10 +28,10 @@
Text = ("Written in Gambas<br>\nby <b>Iman Karim</b><br>\nand <b>Benoît Minisini</b>\n<p>\n<i>Thanks to the Gambas team!</i>")
}
}
{ 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
}

View File

@ -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;

View File

@ -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

View File

@ -228,6 +228,7 @@ void MyDrawingArea::setBackground()
//else
_set_background = true;
refreshBackground();
//XSetWindowBackgroundPixmap(QX11Info::display(), winId(), _background->handle());
#endif
}
}
@ -284,7 +285,7 @@ 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()));