GRAPHICS: Add AdvMame scaler plugin
This commit is contained in:
parent
5e73533110
commit
20b4356ecd
3 changed files with 60 additions and 0 deletions
|
@ -167,6 +167,7 @@ public:
|
|||
#ifdef USE_HQ_SCALERS
|
||||
LINK_PLUGIN(HQ)
|
||||
#endif
|
||||
LINK_PLUGIN(ADVMAME)
|
||||
LINK_PLUGIN(SAI)
|
||||
LINK_PLUGIN(SUPERSAI)
|
||||
LINK_PLUGIN(SUPEREAGLE)
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "graphics/scaler/scale2x.h"
|
||||
#include "graphics/scaler/scale3x.h"
|
||||
#include "graphics/scaler/scalebit.h"
|
||||
|
||||
#define DST(bits, num) (scale2x_uint ## bits *)dst ## num
|
||||
#define SRC(bits, num) (const scale2x_uint ## bits *)src ## num
|
||||
|
@ -348,3 +349,43 @@ void scale(unsigned scale, void* void_dst, unsigned dst_slice, const void* void_
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AdvMamePlugin::AdvMamePlugin() {
|
||||
_factor = 2;
|
||||
_factors.push_back(2);
|
||||
_factors.push_back(3);
|
||||
}
|
||||
|
||||
void AdvMamePlugin::initialize(Graphics::PixelFormat format) {
|
||||
_format = format;
|
||||
}
|
||||
|
||||
void AdvMamePlugin::deinitialize() {
|
||||
}
|
||||
|
||||
void AdvMamePlugin::scale(const uint8 *srcPtr, uint32 srcPitch,
|
||||
uint8 *dstPtr, uint32 dstPitch, int width, int height, int x, int y) {
|
||||
::scale(_factor, dstPtr, dstPitch, srcPtr - srcPitch, srcPitch, _format.bytesPerPixel, width, height);
|
||||
}
|
||||
|
||||
uint AdvMamePlugin::increaseFactor() {
|
||||
if (_factor < 3)
|
||||
++_factor;
|
||||
return _factor;
|
||||
}
|
||||
|
||||
uint AdvMamePlugin::decreaseFactor() {
|
||||
if (_factor > 2)
|
||||
--_factor;
|
||||
return _factor;
|
||||
}
|
||||
|
||||
const char *AdvMamePlugin::getName() const {
|
||||
return "advmame";
|
||||
}
|
||||
|
||||
const char *AdvMamePlugin::getPrettyName() const {
|
||||
return "AdvMame";
|
||||
}
|
||||
|
||||
REGISTER_PLUGIN_STATIC(ADVMAME, PLUGIN_TYPE_SCALER, AdvMamePlugin);
|
||||
|
|
|
@ -36,7 +36,25 @@
|
|||
#ifndef SCALER_SCALEBIT_H
|
||||
#define SCALER_SCALEBIT_H
|
||||
|
||||
#include "graphics/scalerplugin.h"
|
||||
|
||||
int scale_precondition(unsigned scale, unsigned pixel, unsigned width, unsigned height);
|
||||
void scale(unsigned scale, void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height);
|
||||
|
||||
class AdvMamePlugin : public ScalerPluginObject {
|
||||
public:
|
||||
AdvMamePlugin();
|
||||
virtual void initialize(Graphics::PixelFormat format);
|
||||
virtual void deinitialize();
|
||||
virtual void scale(const uint8 *srcPtr, uint32 srcPitch,
|
||||
uint8 *dstPtr, uint32 dstPitch, int width, int height, int x, int y);
|
||||
virtual uint increaseFactor();
|
||||
virtual uint decreaseFactor();
|
||||
virtual uint getFactor() const { return _factor; }
|
||||
virtual bool canDrawCursor() const { return true; }
|
||||
virtual uint extraPixels() const { return 1; }
|
||||
virtual const char *getName() const;
|
||||
virtual const char *getPrettyName() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue