Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

displaycard_generic.cpp

Go to the documentation of this file.
00001 /*
00002         $Id: displaycard_generic.cpp,v 1.1 2001/03/06 15:09:17 mbn Exp $
00003 
00004         ------------------------------------------------------------------------
00005         ClanLib, the platform independent game SDK.
00006 
00007         This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00008         version 2. See COPYING for details.
00009 
00010         For a total list of contributers see CREDITS.
00011 
00012         ------------------------------------------------------------------------
00013 */
00014 
00015 #include "Core/precomp.h"
00016 
00017 #include <Display/Display/Generic/displaycard_generic.h>
00018 #include <API/Display/Display/vidmode.h>
00019 #include <Display/Display/Generic/blitters.h>
00020 #include "blit_dynamic.h"
00021 #include <Display/Display/Generic/cardsurface_blitter.h>
00022 
00023 void CL_DisplayCard::set_videomode(class CL_VidMode *vidmode)
00024 {
00025         set_videomode(
00026                 vidmode->width,
00027                 vidmode->height,
00028                 vidmode->bpp);
00029 }
00030 
00031 CL_CardSurface *CL_DisplayCard_Generic::create_cardsurface_video(
00032         CL_SurfaceProvider *provider)
00033 {
00034         return new CL_CardSurface_Blitter(this, provider);
00035 }
00036 
00037 CL_CardSurface *CL_DisplayCard_Generic::create_cardsurface_system(
00038         CL_SurfaceProvider *provider)
00039 {
00040         return new CL_CardSurface_Blitter(this, provider);
00041 }
00042 
00043 CL_Blitters CL_DisplayCard_Generic::create_hw_blitters(CL_SurfaceProvider *provider)
00044 {
00045         CL_Blitters ret;
00046         return ret;
00047 }
00048 
00049 CL_Blitters CL_DisplayCard_Generic::create_hw_dynamic_blitters(CL_SurfaceProvider *provider)
00050 {
00051         CL_Blitters ret;
00052         CL_Blit_Dynamic *blt_dyn = new CL_Blit_Dynamic(provider, get_target());
00053 
00054         ret.set_noclip(blt_dyn);
00055         ret.set_clip(blt_dyn);
00056         ret.set_scale_noclip(blt_dyn);
00057         ret.set_scale_clip(blt_dyn);
00058         
00059         return ret;
00060 }
00061 
00062 void CL_DisplayCard_Generic::clear_display(
00063         float red,
00064         float green,
00065         float blue,
00066         float alpha)
00067 {
00068         fill_rect(
00069                 0,
00070                 0,
00071                 get_width(),
00072                 get_height(),
00073                 red,
00074                 green,
00075                 blue,
00076                 alpha);
00077 }
00078 
00079 void CL_DisplayCard_Generic::fill_rect(
00080         int x1,
00081         int y1,
00082         int x2,
00083         int y2,
00084         float r,
00085         float g,
00086         float b,
00087         float a)
00088 {
00089         get_target()->fill_rect(x1, y1, x2, y2, r, g, b, a);
00090 }
00091 
00092 void CL_DisplayCard_Generic::draw_rect(
00093         int x1,
00094         int y1,
00095         int x2,
00096         int y2,
00097         float r,
00098         float g,
00099         float b,
00100         float a)
00101 {
00102         get_target()->draw_rect(x1, y1, x2, y2, r, g, b, a);
00103 }
00104 
00105 void CL_DisplayCard_Generic::sync_buffers()
00106 {
00107         CL_Target *front = get_frontbuffer();
00108         CL_Target *back = get_target();
00109         
00110         if (front == back) return; // single buffered system.
00111         
00112         back->lock();
00113         front->lock();
00114 
00115         memcpy(
00116                 back->get_data(),
00117                 front->get_data(),
00118                 back->get_height()*back->get_pitch());
00119 
00120         front->unlock();
00121         back->unlock();
00122 }
00123 
00124 void CL_DisplayCard_Generic::draw_line(
00125         int x1,
00126         int y1,
00127         int x2,
00128         int y2,
00129         float r,
00130         float g,
00131         float b,
00132         float a)
00133 {
00134         get_target()->draw_line(
00135                 x1, y1,
00136                 x2, y2,
00137                 r, g, b, a);
00138 }

Generated at Wed Apr 4 19:54:00 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001