aboutsummaryrefslogtreecommitdiff
path: root/graphics/VectorRenderer.h
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/VectorRenderer.h')
-rw-r--r--graphics/VectorRenderer.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h
index 3a2d98a376..918ed1c39e 100644
--- a/graphics/VectorRenderer.h
+++ b/graphics/VectorRenderer.h
@@ -420,6 +420,14 @@ public:
*/
virtual void copyFrame(OSystem *sys) = 0;
+ /**
+ * Blits a given graphics surface on top of the current drawing surface.
+ *
+ * @param source Surface to blit into the drawing surface.
+ * @param r Position in the active drawing surface to do the blitting.
+ */
+ virtual void blitSurface(Graphics::Surface *source, const Common::Rect &r) = 0;
+
protected:
Surface *_activeSurface; /** Pointer to the surface currently being drawn */
@@ -548,6 +556,25 @@ public:
sys->updateScreen();
}
+ /**
+ * @see VectorRenderer::blitSurface()
+ */
+ virtual void blitSurface(Graphics::Surface *source, const Common::Rect &r) {
+ PixelType *dst_ptr = (PixelType *)_activeSurface->getBasePtr(r.top, r.left);
+ PixelType *src_ptr = (PixelType *)source->getBasePtr(0, 0);
+
+ int dst_pitch = surfacePitch();
+ int src_pitch = source->pitch / source->bytesPerPixel;
+
+ int h = r.height(), w = r.width();
+
+ while (h--) {
+ colorCopy(src_ptr, dst_ptr, w);
+ dst_ptr += dst_pitch;
+ src_ptr += src_pitch;
+ }
+ }
+
protected:
/**
@@ -718,6 +745,31 @@ protected:
}
}
+ /**
+ * Copies several pixes in a row from a surface to another one.
+ * Used for surface blitting.
+ * See colorFill() for optimization guidelines.
+ *
+ * @param src Source surface.
+ * @param dst Destination surface.
+ * @param count Amount of pixels to copy over.
+ */
+ virtual inline void colorCopy(PixelType *src, PixelType *dst, int count) {
+ register int n = (count + 7) >> 3;
+ switch (count % 8) {
+ case 0: do {
+ *dst++ = *src++;
+ case 7: *dst++ = *src++;
+ case 6: *dst++ = *src++;
+ case 5: *dst++ = *src++;
+ case 4: *dst++ = *src++;
+ case 3: *dst++ = *src++;
+ case 2: *dst++ = *src++;
+ case 1: *dst++ = *src++;
+ } while (--n > 0);
+ }
+ }
+
PixelType _fgColor; /** Foreground color currently being used to draw on the renderer */
PixelType _bgColor; /** Background color currently being used to draw on the renderer */