Minor code improvement: added Image::locatePixel(x, y) function to get rid of direct pointer arithmetic.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2411 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/x0vncserver/Image.h b/unix/x0vncserver/Image.h
index 43c0b0b..4cac8b4 100644
--- a/unix/x0vncserver/Image.h
+++ b/unix/x0vncserver/Image.h
@@ -64,7 +64,14 @@
// Pointer to corresponding XImage, made public for efficiency.
// NOTE: if this field is NULL, then no methods other than Init()
// may be called.
- XImage* xim;
+ XImage *xim;
+
+ // Get a pointer to the data corresponding to the given coordinates.
+ inline char *locatePixel(int x, int y) const {
+ return (xim->data +
+ y * xim->bytes_per_line +
+ x * (xim->bits_per_pixel / 8));
+ }
protected: