(svn r10121) -Codechange: split renderer from rest of code; no longer any code directly accesses the video-buffer
-Add: added NULL blitter and renderer, which are always used for -vnull -Add: dedicated driver doesn't blit nor render by default. Can be overruled by user. (-D -b 8bpp-optimized) -Remove: removed CTRL+D from win32, which is incompatible with above -Add: extended screenshot support for PNG and BMP -Codechange: remove all hardcoded 8bpp references and replace them with more dynamic ones -Codechange: minor stuff in blitters
This commit is contained in:
@@ -12,12 +12,12 @@ static FBlitter_8bppDebug iFBlitter_8bppDebug;
|
||||
|
||||
void Blitter_8bppDebug::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
||||
{
|
||||
const byte *src, *src_line;
|
||||
Pixel8 *dst, *dst_line;
|
||||
const uint8 *src, *src_line;
|
||||
uint8 *dst, *dst_line;
|
||||
|
||||
/* Find where to start reading in the source sprite */
|
||||
src_line = (const byte *)bp->sprite + (bp->skip_top * bp->sprite_width + bp->skip_left) * ScaleByZoom(1, zoom);
|
||||
dst_line = (Pixel8 *)bp->dst + bp->top * bp->pitch + bp->left;
|
||||
src_line = (const uint8 *)bp->sprite + (bp->skip_top * bp->sprite_width + bp->skip_left) * ScaleByZoom(1, zoom);
|
||||
dst_line = (uint8 *)bp->dst + bp->top * bp->pitch + bp->left;
|
||||
|
||||
for (int y = 0; y < bp->height; y++) {
|
||||
dst = dst_line;
|
||||
|
@@ -7,15 +7,15 @@
|
||||
|
||||
#include "blitter.hpp"
|
||||
|
||||
typedef Pixel Pixel8;
|
||||
|
||||
class Blitter_8bppDebug : public Blitter {
|
||||
public:
|
||||
uint8 GetScreenDepth() { return 8; }
|
||||
/* virtual */ uint8 GetScreenDepth() { return 8; }
|
||||
|
||||
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
|
||||
Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
|
||||
/* virtual */ const char *GetRenderer() { return "8bpp"; }
|
||||
};
|
||||
|
||||
class FBlitter_8bppDebug: public BlitterFactory<FBlitter_8bppDebug> {
|
||||
|
@@ -12,16 +12,16 @@ static FBlitter_8bppOptimized iFBlitter_8bppOptimized;
|
||||
|
||||
void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
||||
{
|
||||
const byte *src, *src_next;
|
||||
Pixel8 *dst, *dst_line;
|
||||
const uint8 *src, *src_next;
|
||||
uint8 *dst, *dst_line;
|
||||
uint offset = 0;
|
||||
|
||||
/* Find the offset of this zoom-level */
|
||||
offset = ((const byte *)bp->sprite)[(int)zoom * 2] | ((const byte *)bp->sprite)[(int)zoom * 2 + 1] << 8;
|
||||
offset = ((const uint8 *)bp->sprite)[(int)zoom * 2] | ((const byte *)bp->sprite)[(int)zoom * 2 + 1] << 8;
|
||||
|
||||
/* Find where to start reading in the source sprite */
|
||||
src = (const byte *)bp->sprite + offset;
|
||||
dst_line = (Pixel8 *)bp->dst + bp->top * bp->pitch + bp->left;
|
||||
src = (const uint8 *)bp->sprite + offset;
|
||||
dst_line = (uint8 *)bp->dst + bp->top * bp->pitch + bp->left;
|
||||
|
||||
/* Skip over the top lines in the source image */
|
||||
for (int y = 0; y < bp->skip_top; y++) {
|
||||
|
@@ -7,15 +7,15 @@
|
||||
|
||||
#include "blitter.hpp"
|
||||
|
||||
typedef Pixel Pixel8;
|
||||
|
||||
class Blitter_8bppOptimized : public Blitter {
|
||||
public:
|
||||
uint8 GetScreenDepth() { return 8; }
|
||||
/* virtual */ uint8 GetScreenDepth() { return 8; }
|
||||
|
||||
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
|
||||
Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
|
||||
/* virtual */ const char *GetRenderer() { return "8bpp"; }
|
||||
};
|
||||
|
||||
class FBlitter_8bppOptimized: public BlitterFactory<FBlitter_8bppOptimized> {
|
||||
|
@@ -11,12 +11,12 @@ static FBlitter_8bppSimple iFBlitter_8bppSimple;
|
||||
|
||||
void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
||||
{
|
||||
const byte *src, *src_line;
|
||||
Pixel8 *dst, *dst_line;
|
||||
const uint8 *src, *src_line;
|
||||
uint8 *dst, *dst_line;
|
||||
|
||||
/* Find where to start reading in the source sprite */
|
||||
src_line = (const byte *)bp->sprite + (bp->skip_top * bp->sprite_width + bp->skip_left) * ScaleByZoom(1, zoom);
|
||||
dst_line = (Pixel8 *)bp->dst + bp->top * bp->pitch + bp->left;
|
||||
src_line = (const uint8 *)bp->sprite + (bp->skip_top * bp->sprite_width + bp->skip_left) * ScaleByZoom(1, zoom);
|
||||
dst_line = (uint8 *)bp->dst + bp->top * bp->pitch + bp->left;
|
||||
|
||||
for (int y = 0; y < bp->height; y++) {
|
||||
dst = dst_line;
|
||||
|
@@ -7,15 +7,15 @@
|
||||
|
||||
#include "blitter.hpp"
|
||||
|
||||
typedef Pixel Pixel8;
|
||||
|
||||
class Blitter_8bppSimple : public Blitter {
|
||||
public:
|
||||
uint8 GetScreenDepth() { return 8; }
|
||||
/* virtual */ uint8 GetScreenDepth() { return 8; }
|
||||
|
||||
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
|
||||
Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
|
||||
/* virtual */ const char *GetRenderer() { return "8bpp"; }
|
||||
};
|
||||
|
||||
class FBlitter_8bppSimple: public BlitterFactory<FBlitter_8bppSimple> {
|
||||
|
@@ -53,6 +53,11 @@ public:
|
||||
*/
|
||||
virtual Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator) = 0;
|
||||
|
||||
/**
|
||||
* Get the renderer this class depends on.
|
||||
*/
|
||||
virtual const char *GetRenderer() = 0;
|
||||
|
||||
virtual ~Blitter() { }
|
||||
};
|
||||
|
||||
|
24
src/blitter/null.cpp
Normal file
24
src/blitter/null.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "../stdafx.h"
|
||||
#include "../zoom.hpp"
|
||||
#include "../gfx.h"
|
||||
#include "../functions.h"
|
||||
#include "null.hpp"
|
||||
|
||||
static FBlitter_Null iFBlitter_Null;
|
||||
|
||||
void Blitter_Null::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
||||
{
|
||||
}
|
||||
|
||||
Sprite *Blitter_Null::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
||||
{
|
||||
Sprite *dest_sprite;
|
||||
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite));
|
||||
|
||||
dest_sprite->height = sprite->height;
|
||||
dest_sprite->width = sprite->width;
|
||||
dest_sprite->x_offs = sprite->x_offs;
|
||||
dest_sprite->y_offs = sprite->y_offs;
|
||||
|
||||
return dest_sprite;
|
||||
}
|
30
src/blitter/null.hpp
Normal file
30
src/blitter/null.hpp
Normal file
@@ -0,0 +1,30 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file null.hpp */
|
||||
|
||||
#ifndef BLITTER_NULL_HPP
|
||||
#define BLITTER_NULL_HPP
|
||||
|
||||
#include "blitter.hpp"
|
||||
|
||||
class Blitter_Null : public Blitter {
|
||||
public:
|
||||
/* virtual */ uint8 GetScreenDepth() { return 0; }
|
||||
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
|
||||
/* virtual */ const char *GetRenderer() { return "null"; }
|
||||
};
|
||||
|
||||
class FBlitter_Null: public BlitterFactory<FBlitter_Null> {
|
||||
public:
|
||||
/* virtual */ const char *GetName() { return "null"; }
|
||||
|
||||
/* virtual */ const char *GetDescription() { return "Null Blitter (does nothing)"; }
|
||||
|
||||
/* virtual */ Blitter *CreateInstance() { return new Blitter_Null(); }
|
||||
};
|
||||
|
||||
#endif /* BLITTER_NULL_HPP */
|
Reference in New Issue
Block a user