paragui-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-cvs] CVS: paragui/src/draw/dummy Makefile.am,NONE,1.1.2.1 nullc


From: Teunis Peters <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/draw/dummy Makefile.am,NONE,1.1.2.1 nullcore.cpp,NONE,1.1.2.1
Date: Wed, 30 Oct 2002 12:36:30 -0500

Update of /cvsroot/paragui/paragui/src/draw/dummy
In directory subversions:/tmp/cvs-serv26880/src/draw/dummy

Added Files:
      Tag: devel-opengl
        Makefile.am nullcore.cpp 
Log Message:
Addition of missing files.  When a directory is added to CVS, the files within 
it aren't.  Who knew?
Note - the dummy driver should work but the "win/dx" driver needs a LOT of 
work.ie: the Win/DX driver is based on an out-of-date "dummy" driver....


--- NEW FILE ---
## Makefile.am for ParaGUI using the Dummy video driver

# noinst_LTLIBRARIES = libpg_null.la
pkglib_LTLIBRARIES = libpg_null.la
libpg_null_la_SOURCES = $(DUMMY_SRCS)
libpg_null_la_LDFLAGS = -module -avoid-version

# the ParaGUI Dummy video driver sources
DUMMY_SRCS =                    \
        nullcore.cpp

INCLUDES = \
        $(SDL_CFLAGS) \
        -I$(top_srcdir)/include

style_cvs:
        astyle --style=kr --indent=tab=4 --indent-switches *.cpp

style_personal:
        astyle *.cpp

MAINTAINERCLEANFILES = Makefile.in

--- NEW FILE ---
/* nullcore.cpp
 * -------------
 * FIXME
 */

/* define to spit out lots of tracking info */
/* #undef DUMMY_DEBUG */

#ifdef DUMMY_DEBUG
#define DBGX(x) x
#else
#define DBGX(x)
#endif

#ifndef PG_DRAW_H
#include "pgdraw.h"
#endif
#include "pglog.h"
#include "pgfont.h"

#include "pgdriverdta.h"

namespace PG_Draw {

class DummyDraw;
/* preliminary test object */
class DummyDrawable : public PG_DrawableSurface {
   friend class DummyDraw;
  SDL_Surface* dummySurface;
protected:
   DummyDrawable();
  ~DummyDrawable();

  int Lock();
  void Unlock();
  void UpdateRects(int numrects, PG_Rect *rects);
  int SetColorKey(Uint32 flag, Uint32 key);
  bool SetClipRect(const PG_Rect& rect);
  void BlitSurface(const SDL_Surface* srf_src, const PG_Rect& rect_src, const 
PG_Rect& rect_dst);
  int FillRect(const PG_Rect& dstrect, Uint32 color);
  void DrawLine(Uint32 x0, Uint32 y0, Uint32 x1, Uint32 y1, const SDL_Color& 
color, Uint8 width = 1);
  void SetPixel(int x, int y, const SDL_Color& color);
  void DrawTile(const PG_Rect& ref, const PG_Rect& drawrect, 
PG_DrawableSurface* tilemap);
  void GetClipRect(PG_Rect& rect);
  void BlitScale(PG_DrawableSurface* src, bool smooth = true);
  /* from SDL_SetColors(..) (don't US know how to spell? It's 'colour'! */
  int SetColors(SDL_Color *colors, int firstcolor, int ncolors);
  int SetPalette(int flags, SDL_Color *colors, int firstcolor, int ncolors);
  int SetAlpha(Uint32 flag, Uint8 alpha);
  PG_DrawableSurface* RotoScaleSurface(double angle, double zoom,
                                       bool smooth = true);
  PG_DrawableSurface* ScaleSurface(double zoomx, double zoomy,
                                   bool smooth = true);
  void DrawGradient(const PG_Rect& r, PG_Gradient& gradient);
  void DrawGradient(const PG_Rect& rect, const SDL_Color & ul, const SDL_Color 
& ur, const SDL_Color & dl, const SDL_Color & dr);
  void DrawThemedSurface(const PG_Rect& r, PG_Gradient* gradient, 
PG_DrawableSurface* background, int bkmode, Uint8 blend);
  bool BlitFTBitmap(FT_Bitmap *Bitmap, int PosX, int PosY, PG_Font* Param, 
PG_Rect *ClipRect);

  /* SDL_Surface* getScreen() { return dummySurface; }; */

#if 0
public:
   DummyDrawable(DummyDraw*, SDL_Surface*);
#endif
};

class DummyDraw : public PG_Draw {
  friend class DummyDrawable;
  DummyDrawable* mainscreen;
  SDL_VideoInfo vi;
  SDL_PixelFormat pi;
public:
  DummyDraw();
  virtual ~DummyDraw();

  virtual void preinit();
  virtual void prerm();
  virtual void postrm();

  void init(Uint32 flags);
  void quit();
  
  PG_DrawableSurface* SetMode(int width, int height, int depth, Uint32 flags);
  void UpdateRects(int numrects, PG_Rect *rects);
  int Flip();
  PG_DrawableSurface* AccelDrawableSurface(SDL_Surface* src, bool 
hasalpha=false);
  PG_DrawableSurface* CreateSDLSurface(SDL_Surface*);
  PG_DrawableSurface*
  CreateDrawableSurface(Uint32 flags,int width, int height, int depth=0,
                        Uint32 Rmask=0, Uint32 Gmask=0, Uint32 Bmask=0, Uint32 
Amask=0);
  
  PG_DrawableSurface* CreateDrawableSurface(int width, int height);
  PG_DrawableSurface*
  CreateDrawableSurfaceFrom(void* pixels,
                            int width, int height, int depth=0, int pitch=0,
                            Uint32 Rmask=0, Uint32 Gmask=0, Uint32 Bmask=0, 
Uint32 Amask=0);
  PG_DrawableSurface* CopyDrawableSurface(SDL_Surface* src);
  int Lock();
  void Unlock();
  bool SetClipRect(const PG_Rect& rect = PG_Rect());
  void GetClipRect(PG_Rect& rect);
  void BlitSurface(const PG_DrawableSurface* srf_src, const PG_Rect& rect_src, 
const PG_Rect& rect_dst);
  void BlitSurface(const SDL_Surface* srf_src, const PG_Rect& rect_src, const 
PG_Rect& rect_dst);
  PG_DrawableSurface* CreateGradient(const PG_Rect& r, PG_Gradient& gradient);
  PG_DrawableSurface*  CreateGradient(const PG_Rect& r, SDL_Color & ul, 
SDL_Color & ur, SDL_Color & dl, SDL_Color & dr);
  PG_DrawableSurface* GetVideoSurface();
  const SDL_VideoInfo* GetVideoInfo() const;
  int VerifyMode(int width, int height, int depth, Uint32 flags);
  SDL_Rect ** ListModes(SDL_PixelFormat *format, Uint32 flags);
  int attach(PG_DrawableSurface*);
  int detach(PG_DrawableSurface*);
};

DummyDraw::DummyDraw() {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  mainscreen = NULL;
  vi.hw_available  = 0;
  vi.wm_available  = 0;
  vi.UnusedBits1   = 0;
  vi.UnusedBits2   = 0;
  vi.blit_hw       = 0;
  vi.blit_hw_CC    = 0;
  vi.blit_hw_A     = 0;
  vi.blit_sw       = 0;
  vi.blit_sw_CC    = 0;
  vi.blit_sw_A     = 0;
  vi.blit_fill     = 0;
  vi.UnusedBits3   = 0;
  vi.video_mem     = 0;
  vi.vfmt          = &pi;
  /* mask a 32bpp mode I guess *grin* */
  pi.palette       = NULL;
  pi.BitsPerPixel  = 32;
  pi.BytesPerPixel = 4;
  pi.Rloss  = pi.Gloss  = pi.Bloss  = pi.Aloss  = 0;
  pi.Rshift = 16;  pi.Gshift = 8;  pi.Bshift = 0;  pi.Ashift = 0;
  pi.Rmask  = 0xff0000;
  pi.Gmask  = 0x00ff00;
  pi.Bmask  = 0x0000ff;
  pi.Amask  = 0x000000;
  pi.colorkey = 0;
  pi.alpha    = 0;
};

DummyDraw::~DummyDraw() {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  if (mainscreen != NULL) {
    delete mainscreen;
    mainscreen = NULL;
  };
};

void DummyDraw::preinit() { DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__)); };
void DummyDraw::prerm()   { DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__)); };
void DummyDraw::postrm()  { DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__)); };

void DummyDraw::init(Uint32 flags) { DBGX(PG_LogDBG("DummyDraw: %s", 
__FUNCTION__)); };
void DummyDraw::quit() { DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__)); };

PG_DrawableSurface* DummyDraw::SetMode(int width, int height, int depth,
                                       Uint32 flags) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  if (mainscreen == NULL) {
    mainscreen = new DummyDrawable();
  };
  return mainscreen;
};

void DummyDraw::UpdateRects(int numrects, PG_Rect *rects) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
};

int DummyDraw::Flip() { DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__)); return 
0; };

PG_DrawableSurface* DummyDraw::AccelDrawableSurface(SDL_Surface* src, bool 
hasalpha=false) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return new DummyDrawable();
};

PG_DrawableSurface*
DummyDraw::CreateSDLSurface(SDL_Surface* s) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return new DummyDrawable();
};

PG_DrawableSurface*
DummyDraw::CreateDrawableSurface(Uint32 flags,int width, int height, int 
depth=0,
                                 Uint32 Rmask=0, Uint32 Gmask=0, Uint32 
Bmask=0, Uint32 Amask=0) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return new DummyDrawable();
};

PG_DrawableSurface* DummyDraw::CreateDrawableSurface(int width, int height) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return new DummyDrawable();
};

PG_DrawableSurface*
DummyDraw::CreateDrawableSurfaceFrom(void* pixels,
                                     int width, int height, int depth=0, int 
pitch=0,
                                     Uint32 Rmask=0, Uint32 Gmask=0, Uint32 
Bmask=0, Uint32 Amask=0) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return new DummyDrawable();
};

PG_DrawableSurface* DummyDraw::CopyDrawableSurface(SDL_Surface* src) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return new DummyDrawable();
};

int DummyDraw::Lock() {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return 0;
};

void DummyDraw::Unlock() {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
};

bool DummyDraw::SetClipRect(const PG_Rect& rect) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return true;
};

void DummyDraw::GetClipRect(PG_Rect& rect) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
};

void DummyDraw::BlitSurface(const PG_DrawableSurface* srf_src,
                            const PG_Rect& rect_src, const PG_Rect& rect_dst) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
};

void DummyDraw::BlitSurface(const SDL_Surface* srf_src,
                            const PG_Rect& rect_src, const PG_Rect& rect_dst) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
};

PG_DrawableSurface* DummyDraw::CreateGradient(const PG_Rect& r,
                                              PG_Gradient& gradient) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return new DummyDrawable();
};

PG_DrawableSurface* DummyDraw::CreateGradient(const PG_Rect& r,
                                              SDL_Color & ul,
                                              SDL_Color & ur,
                                              SDL_Color & dl,
                                              SDL_Color & dr) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return new DummyDrawable();
};

PG_DrawableSurface* DummyDraw::GetVideoSurface() {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return mainscreen;
};

const SDL_VideoInfo* DummyDraw::GetVideoInfo() const {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return &vi;
};

int DummyDraw::VerifyMode(int width, int height, int depth, Uint32 flags) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return 1;
};

SDL_Rect **DummyDraw::ListModes(SDL_PixelFormat *format, Uint32 flags) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return NULL;
};

int DummyDraw::attach(PG_DrawableSurface* s) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return PG_Draw::attach(s);
};

int DummyDraw::detach(PG_DrawableSurface* s) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return PG_Draw::detach(s);
};

DummyDrawable::DummyDrawable() {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  dummySurface =
    SDL_CreateRGBSurface(0, 1, 1, 32,
                         0xff0000, 0x00ff00, 0x0000ff, 0xff000000);
};
DummyDrawable::~DummyDrawable() {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  if (dummySurface != NULL) {
    SDL_FreeSurface(dummySurface);
    dummySurface = NULL;
  };
};

int DummyDrawable::Lock() { DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__)); 
return 0; };
void DummyDrawable::Unlock() { DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__)); 
};
void DummyDrawable::UpdateRects(int numrects, PG_Rect *rects) { 
DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__)); };
int DummyDrawable::SetColorKey(Uint32 flag, Uint32 key) { 
DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__)); return 0; };
bool DummyDrawable::SetClipRect(const PG_Rect& rect) { 
DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__)); return true; };
void DummyDrawable::BlitSurface(const SDL_Surface* srf_src, const PG_Rect& 
rect_src, const PG_Rect& rect_dst) { DBGX(PG_LogDBG("DummyDraw: %s", 
__FUNCTION__)); };
int DummyDrawable::FillRect(const PG_Rect& dstrect, Uint32 color) { 
DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__)); return 0; };
void DummyDrawable::DrawLine(Uint32 x0, Uint32 y0, Uint32 x1, Uint32 y1, const 
SDL_Color& color, Uint8 width = 1) { DBGX(PG_LogDBG("DummyDraw: %s", 
__FUNCTION__)); };
void DummyDrawable::SetPixel(int x, int y, const SDL_Color& color) { 
DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__)); };

void DummyDrawable::DrawTile(const PG_Rect& ref,
                             const PG_Rect& drawrect,
                             PG_DrawableSurface* tilemap) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
};

void DummyDrawable::GetClipRect(PG_Rect& rect) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
};

void DummyDrawable::BlitScale(PG_DrawableSurface* src, bool smooth) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
};

/* from SDL_SetColors(..) (don't US know how to spell? It's 'colour'! */
int DummyDrawable::SetColors(SDL_Color *colors, int firstcolor, int ncolors) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return 0;
};

int DummyDrawable::SetPalette(int flags, SDL_Color *colors,
                              int firstcolor, int ncolors) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return 0;
};

int DummyDrawable::SetAlpha(Uint32 flag, Uint8 alpha) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return 0;
};

PG_DrawableSurface* DummyDrawable::RotoScaleSurface(double angle, double zoom,
                                                    bool smooth) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return new DummyDrawable();
};

PG_DrawableSurface* DummyDrawable::ScaleSurface(double zoomx, double zoomy,
                                                bool smooth) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return new DummyDrawable();
};

void DummyDrawable::DrawGradient(const PG_Rect& r, PG_Gradient& gradient) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
};

void DummyDrawable::DrawGradient(const PG_Rect& rect,
                                 const SDL_Color & ul, const SDL_Color & ur,
                                 const SDL_Color & dl, const SDL_Color & dr) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
};

void DummyDrawable::DrawThemedSurface(const PG_Rect& r,
                                      PG_Gradient* gradient,
                                      PG_DrawableSurface* background,
                                      int bkmode, Uint8 blend) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
};

bool DummyDrawable::BlitFTBitmap(FT_Bitmap *Bitmap, int PosX, int PosY, 
PG_Font* Param, PG_Rect *ClipRect) {
  DBGX(PG_LogDBG("DummyDraw: %s", __FUNCTION__));
  return false;
};

}; /* namespace PG_Draw */

void* pg_bootdriver(void) {
  PG_Draw::DummyDraw* pg;
  pg = new PG_Draw::DummyDraw();
  return pg;
};





reply via email to

[Prev in Thread] Current Thread [Next in Thread]