diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2013-03-15 12:59:55 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2013-03-15 12:59:55 (GMT) |
| commit | 73b6ff4efb4bbe31993a595987b9abc59a5a2e76 (patch) | |
| tree | 7320e993bf6df6c59ef956087f3fa63f17b19b5d /src/graphics | |
| parent | 6b68c04cd613847e4f2bbe1f0cd8a2a13a9d4660 (diff) | |
| download | powder-73b6ff4efb4bbe31993a595987b9abc59a5a2e76.zip powder-73b6ff4efb4bbe31993a595987b9abc59a5a2e76.tar.gz | |
Use VideoBuffer in place of thumbnail
Diffstat (limited to 'src/graphics')
| -rw-r--r-- | src/graphics/Graphics.cpp | 20 | ||||
| -rw-r--r-- | src/graphics/RasterDrawMethods.inl | 10 | ||||
| -rw-r--r-- | src/graphics/Renderer.h | 2 |
3 files changed, 22 insertions, 10 deletions
diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp index 3394ab2..35120c9 100644 --- a/src/graphics/Graphics.cpp +++ b/src/graphics/Graphics.cpp @@ -55,6 +55,16 @@ void VideoBuffer::Resize(int width, int height, bool resample) int newWidth = width; int newHeight = height; pixel * newBuffer; + if(newHeight == -1 && newWidth == -1) + return; + if(newHeight == -1) + { + newHeight = ((float)Height)*((float)newWidth/(float)Width); + } + if(newWidth == -1) + { + newWidth = ((float)Width)*((float)newHeight/(float)Height); + } if(resample) newBuffer = Graphics::resample_img(Buffer, Width, Height, newWidth, newHeight); else @@ -1113,16 +1123,6 @@ pixel *Graphics::render_packed_rgb(void *image, int width, int height, int cmp_s return res; } -void Graphics::draw_image(const VideoBuffer & vidBuf, int x, int y, int a) -{ - draw_image(vidBuf.Buffer, x, y, vidBuf.Width, vidBuf.Height, a); -} - -void Graphics::draw_image(VideoBuffer * vidBuf, int x, int y, int a) -{ - draw_image(vidBuf->Buffer, x, y, vidBuf->Width, vidBuf->Height, a); -} - VideoBuffer Graphics::DumpFrame() { #ifdef OGLI diff --git a/src/graphics/RasterDrawMethods.inl b/src/graphics/RasterDrawMethods.inl index 07b8257..527d249 100644 --- a/src/graphics/RasterDrawMethods.inl +++ b/src/graphics/RasterDrawMethods.inl @@ -386,4 +386,14 @@ void PIXELMETHODS_CLASS::draw_image(pixel *img, int x, int y, int w, int h, int blendpixel(x+i, y+j, r, g, b, a); img++; } +} + +void PIXELMETHODS_CLASS::draw_image(const VideoBuffer & vidBuf, int x, int y, int a) +{ + draw_image(vidBuf.Buffer, x, y, vidBuf.Width, vidBuf.Height, a); +} + +void PIXELMETHODS_CLASS::draw_image(VideoBuffer * vidBuf, int x, int y, int a) +{ + draw_image(vidBuf->Buffer, x, y, vidBuf->Width, vidBuf->Height, a); }
\ No newline at end of file diff --git a/src/graphics/Renderer.h b/src/graphics/Renderer.h index a1ed159..c5fe015 100644 --- a/src/graphics/Renderer.h +++ b/src/graphics/Renderer.h @@ -129,6 +129,8 @@ public: void gradientrect(int x, int y, int width, int height, int r, int g, int b, int a, int r2, int g2, int b2, int a2); void draw_image(pixel *img, int x, int y, int w, int h, int a); + void draw_image(const VideoBuffer & vidBuf, int w, int h, int a); + void draw_image(VideoBuffer * vidBuf, int w, int h, int a); VideoBuffer DumpFrame(); |
