Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

SurfaceLock.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net)
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  */
00009 #include "SurfaceLock.h"
00010 
00011 #include "SDLException.h"
00012 
00013 
00014 //-----------------------------------------------------------------
00015 /**
00016  * Lock surface when necessary.
00017  * @throws SDLException when surface cannot be locked
00018  */
00019 SurfaceLock::SurfaceLock(SDL_Surface *surface)
00020 {
00021     m_surface = surface;
00022     if (SDL_MUSTLOCK(m_surface)) {
00023         if (SDL_LockSurface(m_surface) < 0) {
00024             throw SDLException(ExInfo("LockSurface"));
00025         }
00026     }
00027 }
00028 //-----------------------------------------------------------------
00029 /**
00030  * Unlock surface.
00031  */
00032 SurfaceLock::~SurfaceLock()
00033 {
00034     if (SDL_MUSTLOCK(m_surface)) {
00035         SDL_UnlockSurface(m_surface);
00036     }
00037 }

Generated on Wed Jun 1 09:54:31 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2