summaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2013-03-10 18:08:34 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2013-03-10 18:08:34 (GMT)
commite6bca489c9aae88f1c7bbb44c4e2df71f481cbd3 (patch)
tree6781e70afdc32c0322cce0062d523edfbdebae8a /src/graphics
parent6090f0b0aaf302612f363cd3d85408e3b7d1150b (diff)
downloadpowder-e6bca489c9aae88f1c7bbb44c4e2df71f481cbd3.zip
powder-e6bca489c9aae88f1c7bbb44c4e2df71f481cbd3.tar.gz
AvatarButton/holder, rename ThumbnailBroker for more general purposes
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/Graphics.cpp15
-rw-r--r--src/graphics/Graphics.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp
index 068cc5d..3394ab2 100644
--- a/src/graphics/Graphics.cpp
+++ b/src/graphics/Graphics.cpp
@@ -35,10 +35,25 @@ VideoBuffer::VideoBuffer(VideoBuffer * old):
std::copy(old->Buffer, old->Buffer+(old->Width*old->Height), Buffer);
};
+VideoBuffer::VideoBuffer(pixel * buffer, int width, int height):
+ Width(width),
+ Height(height)
+{
+ Buffer = new pixel[width*height];
+ std::copy(buffer, buffer+(width*height), Buffer);
+}
+
void VideoBuffer::Resize(float factor, bool resample)
{
int newWidth = ((float)Width)*factor;
int newHeight = ((float)Height)*factor;
+ Resize(newWidth, newHeight);
+}
+
+void VideoBuffer::Resize(int width, int height, bool resample)
+{
+ int newWidth = width;
+ int newHeight = height;
pixel * newBuffer;
if(resample)
newBuffer = Graphics::resample_img(Buffer, Width, Height, newWidth, newHeight);
diff --git a/src/graphics/Graphics.h b/src/graphics/Graphics.h
index 2c90074..596d93d 100644
--- a/src/graphics/Graphics.h
+++ b/src/graphics/Graphics.h
@@ -110,8 +110,10 @@ public:
VideoBuffer(const VideoBuffer & old);
VideoBuffer(VideoBuffer * old);
+ VideoBuffer(pixel * buffer, int width, int height);
VideoBuffer(int width, int height);
void Resize(float factor, bool resample = false);
+ void Resize(int width, int height, bool resample = false);
TPT_INLINE void BlendPixel(int x, int y, int r, int g, int b, int a)
{
#ifdef PIX32OGL