public override void Draw(Graphics graphics, bool current, bool fullAlpha) { Rectangle viewableArea = GetVisibleArea(graphics); int left = (viewableArea.X / TileLayer.CHUNK_SIZE); int top = (viewableArea.Y / TileLayer.CHUNK_SIZE); int right = ((viewableArea.X + viewableArea.Width) / TileLayer.CHUNK_SIZE); int bottom = ((viewableArea.Y + viewableArea.Height) / TileLayer.CHUNK_SIZE); for (int x = left; x <= right; x++) { for (int y = top; y <= bottom; y++) { Bitmap bitmap = Layer.GetChunkBitmap(x * TileLayer.CHUNK_SIZE, y * TileLayer.CHUNK_SIZE, !fullAlpha); if (bitmap != null) { graphics.DrawImageUnscaled(bitmap, x * TileLayer.CHUNK_SIZE, y * TileLayer.CHUNK_SIZE); } } } //Draw the selection box if (current && Layer.Selection != null) { graphics.DrawSelectionRectangle(new Rectangle( Layer.Selection.Area.X * Layer.Definition.Grid.Width, Layer.Selection.Area.Y * Layer.Definition.Grid.Height, Layer.Selection.Area.Width * Layer.Definition.Grid.Width, Layer.Selection.Area.Height * Layer.Definition.Grid.Height)); } }