~ubuntu-branches/debian/experimental/mednafen/experimental

« back to all changes in this revision

Viewing changes to src/drivers/video.h

  • Committer: Package Import Robot
  • Author(s): Stephen Kitt
  • Date: 2012-11-19 07:00:37 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20121119070037-jvknrm13zvim88oc
Tags: 0.9.26-1
* New upstream WIP version.
* Change priority to "extra" to match libvorbisidec1's.
* Drop "DM-Upload-Allowed" since it is no longer appropriate.
* Refresh patches, replacing MPC_STATUS_FAIL constant from older mpcdec
  versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 VIDEOIP_LINEAR_Y
17
17
};
18
18
 
19
 
void PtoV(int *x, int *y);
 
19
void PtoV(const int in_x, const int in_y, int32 *out_x, int32 *out_y);
20
20
int InitVideo(MDFNGI *gi);
21
21
void KillVideo(void);
22
22
void BlitScreen(MDFN_Surface *, const MDFN_Rect *DisplayRect, const MDFN_Rect *LineWidths);
47
47
 
48
48
void VideoShowMessage(UTF8 *text);
49
49
 
50
 
void BlitRaw(SDL_Surface *src, const SDL_Rect *src_rect, const SDL_Rect *dest_rect);
 
50
// source_alpha = 0 (disabled)
 
51
//              = 1 (enabled)
 
52
//              = -1 (enabled only if it will be hardware-accelerated, IE via OpenGL)
 
53
void BlitRaw(MDFN_Surface *src, const MDFN_Rect *src_rect, const MDFN_Rect *dest_rect, int source_alpha = 1);
51
54
 
52
55
// Called from the main thread
53
56
bool Video_Init(MDFNGI *gi);
67
70
// Called from the main thread.
68
71
void Video_BlitToScreen(void);
69
72
 
 
73
 
 
74
class SDL_to_MDFN_Surface_Wrapper : public MDFN_Surface
 
75
{
 
76
 public:
 
77
 INLINE SDL_to_MDFN_Surface_Wrapper(SDL_Surface *sdl_surface) : ss(sdl_surface)
 
78
 {
 
79
  // Locking should be first thing.
 
80
  if(SDL_MUSTLOCK(ss))
 
81
   SDL_LockSurface(ss);
 
82
 
 
83
  format.bpp = ss->format->BitsPerPixel;
 
84
  format.colorspace = MDFN_COLORSPACE_RGB;
 
85
  format.Rshift = ss->format->Rshift;
 
86
  format.Gshift = ss->format->Gshift;
 
87
  format.Bshift = ss->format->Bshift;
 
88
  format.Ashift = ss->format->Ashift;
 
89
 
 
90
  format.Rprec = 8 - ss->format->Rloss;
 
91
  format.Gprec = 8 - ss->format->Gloss;
 
92
  format.Bprec = 8 - ss->format->Bloss;
 
93
  format.Aprec = 8 - ss->format->Aloss;
 
94
 
 
95
  pixels_is_external = true;
 
96
 
 
97
  pixels16 = NULL;
 
98
  pixels = NULL;
 
99
 
 
100
  if(ss->format->BitsPerPixel == 16)
 
101
  {
 
102
   pixels16 = (uint16*)ss->pixels;
 
103
   pitchinpix = ss->pitch >> 1;
 
104
  }
 
105
  else
 
106
  {
 
107
   pixels = (uint32*)ss->pixels;
 
108
   pitchinpix = ss->pitch >> 2;
 
109
  }
 
110
 
 
111
  format = MDFN_PixelFormat(MDFN_COLORSPACE_RGB, sdl_surface->format->Rshift, sdl_surface->format->Gshift, sdl_surface->format->Bshift, sdl_surface->format->Ashift);
 
112
 
 
113
  w = ss->w;
 
114
  h = ss->h;
 
115
 }
 
116
 
 
117
 INLINE ~SDL_to_MDFN_Surface_Wrapper()
 
118
 {
 
119
  if(SDL_MUSTLOCK(ss))
 
120
   SDL_UnlockSurface(ss);
 
121
  ss = NULL;
 
122
 }
 
123
 private:
 
124
 SDL_Surface *ss;
 
125
};
 
126
 
70
127
#endif