aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorVicent Marti2008-05-02 17:53:21 +0000
committerVicent Marti2008-05-02 17:53:21 +0000
commitb50d430192f16f937b875b3ec77381e847156cb6 (patch)
treece8a41ea6b1400e8b369995b8cee750ca61c08ec /graphics
parent4fd1f929019daab4aa65b0a01339cec08435fae5 (diff)
downloadscummvm-rg350-b50d430192f16f937b875b3ec77381e847156cb6.tar.gz
scummvm-rg350-b50d430192f16f937b875b3ec77381e847156cb6.tar.bz2
scummvm-rg350-b50d430192f16f937b875b3ec77381e847156cb6.zip
Renderer test function in main.cpp
svn-id: r31832
Diffstat (limited to 'graphics')
-rw-r--r--graphics/VectorRenderer.cpp35
-rw-r--r--graphics/VectorRenderer.h7
2 files changed, 39 insertions, 3 deletions
diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp
index eb5d28a71f..252fc5722b 100644
--- a/graphics/VectorRenderer.cpp
+++ b/graphics/VectorRenderer.cpp
@@ -27,13 +27,43 @@
#include "graphics/surface.h"
#include "graphics/VectorRenderer.h"
#include "graphics/colormasks.h"
+#include "common/system.h"
namespace Graphics {
VectorRenderer *createRenderer() {
- return new VectorRendererAA<uint16,ColorMasks<565>>;
+ return new VectorRendererSpec<uint16,ColorMasks<565>>;
}
+
+void vector_renderer_test( OSystem *_system ) {
+ VectorRenderer *vr = createRenderer();
+
+ Surface _screen;
+ _screen.create(_system->getOverlayWidth(), _system->getOverlayHeight(), sizeof(OverlayColor));
+
+ if (!_screen.pixels)
+ return;
+
+ _system->clearOverlay();
+ _system->grabOverlay((OverlayColor*)_screen.pixels, _screen.w);
+
+ vr->setSurface( &_screen );
+ vr->setColor( 255, 255, 255 );
+
+ _system->showOverlay();
+
+ while( true ) { // draw!!
+ vr->drawLine( 25, 100, 25, 150 );
+ _system->copyRectToOverlay((OverlayColor*)_screen.getBasePtr(0, 0), _screen.w, 0, 0, _screen.w, _screen.w);
+ _system->updateScreen();
+ _system->delayMillis(100);
+ }
+
+ _system->hideOverlay();
+}
+
+
template<typename PixelType, typename PixelFormat>
void VectorRendererSpec<PixelType,PixelFormat>::
drawLineAlg(int x1, int x2, int y1, int y2, int dx, int dy) {
@@ -83,8 +113,7 @@ drawLineAlg(int x1, int x2, int y1, int y2, int dx, int dy) {
template<typename PixelType, typename PixelFormat>
void VectorRendererAA<PixelType,PixelFormat>::
-drawLineAlg(int x1, int x2, int y1, int y2, int dx, int dy)
-{
+drawLineAlg(int x1, int x2, int y1, int y2, int dx, int dy) {
PixelType *ptr = (PixelType *)_activeSurface->getBasePtr(x1, y1);
int pitch = surfacePitch();
int xdir = (x2 > x1) ? 1 : -1;
diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h
index f7dffbd621..c5a09faf81 100644
--- a/graphics/VectorRenderer.h
+++ b/graphics/VectorRenderer.h
@@ -28,9 +28,12 @@
#include "common/scummsys.h"
#include "graphics/surface.h"
+#include "common/system.h"
namespace Graphics {
+void vector_renderer_test( OSystem *_system );
+
/**
* VectorRenderer: The core Vector Renderer Class
*
@@ -104,6 +107,10 @@ public:
*/
virtual void setColor(uint8 r, uint8 g, uint8 b, uint8 a) = 0;
+ virtual void setSurface( Surface *surface ){
+ _activeSurface = surface;
+ }
+
protected:
/**