From 78bb4cdace43829b1e10f359ddee1affcfd64148 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 9 Apr 2014 18:26:20 -0400 Subject: Fixed Area drawing assuming the first pixel of the *image.NRGBA is at i.Pix[0]. --- area.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'area.go') diff --git a/area.go b/area.go index 5dfce26..3fd7cfb 100644 --- a/area.go +++ b/area.go @@ -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)] +} -- cgit v1.2.3