ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/video_blit.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/video_blit.cpp (file contents):
Revision 1.4 by cebix, 2001-07-01T14:38:03Z vs.
Revision 1.5 by cebix, 2001-07-01T19:57:55Z

# Line 35 | Line 35 | struct VisualFormat {
35   };
36   static VisualFormat visualFormat;
37  
38 + // This holds the pixels values of the palette colors for 8->16/32-bit expansion
39 + uint32 ExpandMap[256];
40 +
41   /* -------------------------------------------------------------------------- */
42   /* --- Raw Copy / No conversion required                                  --- */
43   /* -------------------------------------------------------------------------- */
# Line 259 | Line 262 | static void Blit_Copy_Raw(uint8 * dest,
262   #include "video_blit.h"
263  
264   /* -------------------------------------------------------------------------- */
265 + /* --- 8-bit indexed to 16-bit mode color expansion                       --- */
266 + /* -------------------------------------------------------------------------- */
267 +
268 + static void Blit_Expand_8_To_16(uint8 * dest, const uint8 * p, uint32 length)
269 + {
270 +        uint16 *q = (uint16 *)dest;
271 +        for (int i=0; i<length; i++)
272 +                *q++ = ExpandMap[*p++];
273 + }
274 +
275 + /* -------------------------------------------------------------------------- */
276 + /* --- 8-bit indexed to 32-bit mode color expansion                       --- */
277 + /* -------------------------------------------------------------------------- */
278 +
279 + static void Blit_Expand_8_To_32(uint8 * dest, const uint8 * p, uint32 length)
280 + {
281 +        uint32 *q = (uint32 *)dest;
282 +        for (int i=0; i<length; i++)
283 +                *q++ = ExpandMap[*p++];
284 + }
285 +
286 + /* -------------------------------------------------------------------------- */
287   /* --- Blitters to the host frame buffer, or XImage buffer                --- */
288   /* -------------------------------------------------------------------------- */
289  
# Line 319 | Line 344 | bool Screen_blitter_init(XVisualInfo * v
344                  visualFormat.Rmask = visual_info->red_mask;
345                  visualFormat.Gmask = visual_info->green_mask;
346                  visualFormat.Bmask = visual_info->blue_mask;
347 <        
347 >
348                  // Compute RGB shift values
349                  visualFormat.Rshift = 0;
350                  for (uint32 Rmask = visualFormat.Rmask; Rmask && ((Rmask & 1) != 1); Rmask >>= 1)
# Line 330 | Line 355 | bool Screen_blitter_init(XVisualInfo * v
355                  visualFormat.Bshift = 0;
356                  for (uint32 Bmask = visualFormat.Bmask; Bmask && ((Bmask & 1) != 1); Bmask >>= 1)
357                          ++visualFormat.Bshift;
358 +
359 +                bool blitter_found = false;
360 +        
361 +                // 8-bit mode on 16/32-bit screen?
362 +                if (mac_depth == VDEPTH_8BIT && visualFormat.depth > 8) {
363 +                        if (visual_info->depth <= 16) {
364 +                                Screen_blit = Blit_Expand_8_To_16;
365 +                                blitter_found = true;
366 +                        } else {
367 +                                Screen_blit = Blit_Expand_8_To_32;
368 +                                blitter_found = true;
369 +                        }
370 +                }
371          
372                  // Search for an adequate blit function
335                bool blitter_found = false;
373                  const int blitters_count = sizeof(Screen_blitters)/sizeof(Screen_blitters[0]);
374                  for (int i = 0; !blitter_found && (i < blitters_count); i++) {
375                          if      (       (visualFormat.depth == Screen_blitters[i].depth)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines