     }
     
     public var image: CIImage {
-        return _image.cropped(to: extent)
+        return _image.clamped(to: extent).cropped(to: extent)
     }
 }
 

    
    public let height: Int
    
    private var _image: CIImage {
        didSet {
            _image = _image.clamped(to: extent)
            state.isDirty = true
        }
    }
    
    fileprivate var state: GPContextState = GPContextState()
    

    public init(width: Int, height: Int) {
        self.width = width
        self.height = height
        self._image = CIImage.empty()
    }
    
    private init(width: Int, height: Int, image: CIImage) {
