add back rgba images in the local/server save uploads

This commit is contained in:
jacob1 2013-07-16 14:48:50 -04:00
parent 6f29926b96
commit 19e182ae42
5 changed files with 28 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -1116,6 +1116,27 @@ void Graphics::draw_icon(int x, int y, Icon icon, unsigned char alpha, bool inve
} }
} }
void Graphics::draw_rgba_image(unsigned char *data, int x, int y, float alpha)
{
unsigned char w, h;
int i, j;
unsigned char r, g, b, a;
if (!data) return;
w = *(data++)&0xFF;
h = *(data++)&0xFF;
for (j=0; j<h; j++)
{
for (i=0; i<w; i++)
{
r = *(data++)&0xFF;
g = *(data++)&0xFF;
b = *(data++)&0xFF;
a = *(data++)&0xFF;
addpixel(x+i, y+j, r, g, b, (int)(a*alpha));
}
}
}
pixel *Graphics::render_packed_rgb(void *image, int width, int height, int cmp_size) pixel *Graphics::render_packed_rgb(void *image, int width, int height, int cmp_size)
{ {
unsigned char *tmp; unsigned char *tmp;

View File

@ -247,6 +247,7 @@ public:
void draw_image(pixel *img, int x, int y, int w, int h, int a); 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(const VideoBuffer & vidBuf, int w, int h, int a);
void draw_image(VideoBuffer * vidBuf, int w, int h, int a); void draw_image(VideoBuffer * vidBuf, int w, int h, int a);
void draw_rgba_image(unsigned char *data, int x, int y, float alpha);
Graphics(); Graphics();
~Graphics(); ~Graphics();

View File

@ -9,6 +9,7 @@
#include "client/Client.h" #include "client/Client.h"
#include "client/GameSave.h" #include "client/GameSave.h"
#include "gui/Style.h" #include "gui/Style.h"
#include "images.h"
class LocalSaveActivity::CancelAction: public ui::ButtonAction class LocalSaveActivity::CancelAction: public ui::ButtonAction
{ {
@ -121,6 +122,7 @@ void LocalSaveActivity::saveWrite(std::string finalFilename)
void LocalSaveActivity::OnDraw() void LocalSaveActivity::OnDraw()
{ {
Graphics * g = ui::Engine::Ref().g; Graphics * g = ui::Engine::Ref().g;
g->draw_rgba_image((unsigned char*)save_to_disk_image, -10, 0, 0.7f);
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3); g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255); g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255);

View File

@ -12,6 +12,7 @@
#include "tasks/Task.h" #include "tasks/Task.h"
#include "gui/Style.h" #include "gui/Style.h"
#include "client/GameSave.h" #include "client/GameSave.h"
#include "images.h"
class ServerSaveActivity::CancelAction: public ui::ButtonAction class ServerSaveActivity::CancelAction: public ui::ButtonAction
{ {
@ -320,6 +321,7 @@ void ServerSaveActivity::OnTick(float dt)
void ServerSaveActivity::OnDraw() void ServerSaveActivity::OnDraw()
{ {
Graphics * g = ui::Engine::Ref().g; Graphics * g = ui::Engine::Ref().g;
g->draw_rgba_image((unsigned char*)save_to_server_image, -10, 0, 0.7f);
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3); g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255); g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255);