| yes it may be better to use some of the alternative code to viewports floating around like these two (not by me): 
 
 
' -----------------------------------------------------------------------------
' cctg_drawimagerect by TonyG (slow?)
' -----------------------------------------------------------------------------
Function cctg_DrawImageRect(image:TImage,x:Int,y:Int,xs:Int,ys:Int,width:Int,height:Int)
    DrawImage LoadImage(PixmapWindow(LockImage(image),xs,ys,width,height)),x,y
End Function
' -----------------------------------------------------------------------------
' ccDrawImageArea by Ian Duff (faster?)
' -----------------------------------------------------------------------------
Function ccDrawImageArea(image:TImage, x#, y#, rx#, ry#, rw#, rh#, frame=0)
  Local origin_x#, origin_y# ; GetOrigin (origin_x, origin_y)
  Local tw = Pow2Size(image.width)
  Local th = Pow2Size(image.height)
  Local rw1#  = rx + rw
  Local rh1#  = ry + rh
  Local x0# = -image.handle_x, x1# = x0 + rw
  Local y0# = -image.handle_y, y1# = y0 + rh
  
  If rw1 > image.width
    x1 = x0 + rw + image.width - rw1
    rw1 = image.width
  EndIf
   
  If rh1 > image.height
    y1 = y0 + rh + image.height - rh1
    rh1 = image.height
  EndIf
?Win32
  If TD3D7ImageFrame(image.frame(frame))
    Local frame:TD3D7ImageFrame = TD3D7ImageFrame(image.frame(frame))
    
    frame.setUV(rx / tw, ry / th, rw1 / tw, rh1 / th)
    frame.Draw x0, y0, x1, y1, x + origin_x, y + origin_y
    frame.setUV(0, 0, image.width / Float(tw), image.height / Float(th))
  Else
?
    Local frame:TGLImageFrame = TGLImageFrame (image.frame(frame))
                
    frame.u0 = rx / tw
    frame.v0 = ry / th
    frame.u1 = rw1 / tw
    frame.v1 = rh1 / th
    
    frame.Draw x0, y0, x1, y1, x + origin_x, y + origin_y
    
    frame.u0 = 0
    frame.v0 = 0
    frame.u1 = image.width / Float(tw)
    frame.v1 = image.height / Float(th)
?Win32
  EndIf
?
  
  Function Pow2Size(n)
    Local ry = 1
    
    While ry < n
      ry :* 2
    Wend
    
    Return ry
  End Function
End Function
 
 |