git.ucc.asn.au
/
ipdf
/
code.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow setting type of Real at compilation time
[ipdf/code.git]
/
src
/
screen.cpp
diff --git
a/src/screen.cpp
b/src/screen.cpp
index
59d4334
..
7d43e41
100644
(file)
--- a/
src/screen.cpp
+++ b/
src/screen.cpp
@@
-2,6
+2,8
@@
#include "screen.h"
#include "SDL_opengl.h"
#include "screen.h"
#include "SDL_opengl.h"
+#include <fcntl.h> // for access(2)
+#include <unistd.h> // for access(2)
using namespace IPDF;
using namespace std;
using namespace IPDF;
using namespace std;
@@
-139,6
+141,7
@@
void Screen::ScreenShot(const char * filename) const
if (pixels == NULL)
Fatal("Failed to allocate %d x %d x 4 = %d pixel array", w, h, w*h*4);
if (pixels == NULL)
Fatal("Failed to allocate %d x %d x 4 = %d pixel array", w, h, w*h*4);
+
for (int y = 0; y < h; ++y)
{
glReadPixels(0,h-y-1,w, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixels[y*w*4]);
for (int y = 0; y < h; ++y)
{
glReadPixels(0,h-y-1,w, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixels[y*w*4]);
@@
-169,6
+172,11
@@
void Screen::ScreenShot(const char * filename) const
*/
void Screen::RenderBMP(const char * filename) const
{
*/
void Screen::RenderBMP(const char * filename) const
{
+ if (access(filename, R_OK) == -1)
+ {
+ Error("No such file \"%s\" - Nothing to render - You might have done this deliberately?", filename);
+ return;
+ }
SDL_Surface * bmp = SDL_LoadBMP(filename);
if (bmp == NULL)
Fatal("Failed to load BMP from %s - %s", filename, SDL_GetError());
SDL_Surface * bmp = SDL_LoadBMP(filename);
if (bmp == NULL)
Fatal("Failed to load BMP from %s - %s", filename, SDL_GetError());
UCC
git Repository :: git.ucc.asn.au