diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-09 21:26:57 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-09 21:26:57 +0100 |
commit | c18090169d6bb49e877956701e77e8af338ed675 (patch) | |
tree | 7a18b46d809fc839acc56c4b0fd2e1938614513c /plugingui/pixelbuffer.h | |
parent | 74ab9aea168bb5706e9c36aa6252f366926f5b41 (diff) |
Refactor PixelBuffer, and remove unnecessary calls to setPixel and addPixel.
Diffstat (limited to 'plugingui/pixelbuffer.h')
-rw-r--r-- | plugingui/pixelbuffer.h | 94 |
1 files changed, 45 insertions, 49 deletions
diff --git a/plugingui/pixelbuffer.h b/plugingui/pixelbuffer.h index 2785eb1..d955c1a 100644 --- a/plugingui/pixelbuffer.h +++ b/plugingui/pixelbuffer.h @@ -24,68 +24,64 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef __DRUMGIZMO_PIXELBUFFER_H__ -#define __DRUMGIZMO_PIXELBUFFER_H__ - -#include <stdlib.h> +#pragma once #include "colour.h" +#include <stdlib.h> + namespace GUI { class PixelBuffer { public: - PixelBuffer(size_t width, size_t height); - ~PixelBuffer(); + PixelBuffer(size_t width, size_t height); + ~PixelBuffer(); - void realloc(size_t width, size_t height); + void realloc(size_t width, size_t height); - void setPixel(size_t x, size_t y, - unsigned char red, - unsigned char green, - unsigned char blue, - unsigned char alpha); + void setPixel(size_t x, size_t y, + unsigned char red, + unsigned char green, + unsigned char blue, + unsigned char alpha); - unsigned char *buf; - size_t width; - size_t height; + unsigned char* buf; + size_t width; + size_t height; }; class PixelBufferAlpha { public: - PixelBufferAlpha(size_t width, size_t height); - ~PixelBufferAlpha(); - - int idx; - size_t x, y; - - void realloc(size_t width, size_t height); - - void setPixel(size_t x, size_t y, - unsigned char red, - unsigned char green, - unsigned char blue, - unsigned char alpha); - - void addPixel(size_t x, size_t y, - unsigned char red, - unsigned char green, - unsigned char blue, - unsigned char alpha); - - void addPixel(size_t x, size_t y, Colour c); - - void pixel(size_t x, size_t y, - unsigned char *red, - unsigned char *green, - unsigned char *blue, - unsigned char *alpha); - - unsigned char *buf; - size_t width; - size_t height; -}; - + PixelBufferAlpha(size_t width, size_t height); + ~PixelBufferAlpha(); + + void realloc(size_t width, size_t height); + + void setPixel(size_t x, size_t y, + unsigned char red, + unsigned char green, + unsigned char blue, + unsigned char alpha); + + void addPixel(size_t x, size_t y, + unsigned char red, + unsigned char green, + unsigned char blue, + unsigned char alpha); + + void addPixel(size_t x, size_t y, Colour c); + + void pixel(size_t x, size_t y, + unsigned char* red, + unsigned char* green, + unsigned char* blue, + unsigned char* alpha); + + unsigned char* buf; + size_t width; + size_t height; + size_t x; + size_t y; }; -#endif/*__DRUMGIZMO_PIXELBUFFER_H__*/ +} // GUI:: |