diff options
| author | Pietro Gagliardi <[email protected]> | 2014-04-09 18:26:20 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-04-09 18:26:20 -0400 |
| commit | 78bb4cdace43829b1e10f359ddee1affcfd64148 (patch) | |
| tree | 580b6ccfd8ef5aee8223bd88d1636a35a91b084e /area.go | |
| parent | bfb259da273e13be02cb2dc637af737e4e694a72 (diff) | |
Fixed Area drawing assuming the first pixel of the *image.NRGBA is at i.Pix[0].
Diffstat (limited to 'area.go')
| -rw-r--r-- | area.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -315,3 +315,12 @@ func (a *Area) setRect(x int, y int, width int, height int, rr *[]resizerequest) func (a *Area) preferredSize() (width int, height int) { return a.sysData.preferredSize() } + +// internal function, but shared by all system implementations: &img.Pix[0] is not necessarily the first pixel in the image +func pixelDataPos(img *image.NRGBA) int { + return img.PixOffset(img.Rect.Min.X, img.Rect.Min.Y) +} + +func pixelData(img *image.NRGBA) *uint8 { + return &img.Pix[pixelDataPos(img)] +} |
