diff options
author | Pierre Ossman <ossman@cendio.se> | 2014-02-07 14:46:26 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2014-07-07 14:50:28 +0200 |
commit | ac13abe4ce9f74522acd9697a08dc56de8e2949f (patch) | |
tree | 4eb0fdaa6cf22d0e06f63b9cb1a03063f5f21c27 /vncviewer/PlatformPixelBuffer.h | |
parent | 668468b3d43d5ea1562ebc0be8de0c98c5601a60 (diff) | |
download | tigervnc-ac13abe4ce9f74522acd9697a08dc56de8e2949f.tar.gz tigervnc-ac13abe4ce9f74522acd9697a08dc56de8e2949f.zip |
Create a proper interface base class for the viewport's framebuffer
This allows us to gracefully fall back to the FLTK code in case the
platform specific code cannot be used.
Diffstat (limited to 'vncviewer/PlatformPixelBuffer.h')
-rw-r--r-- | vncviewer/PlatformPixelBuffer.h | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/vncviewer/PlatformPixelBuffer.h b/vncviewer/PlatformPixelBuffer.h index f634ccd4..28d085aa 100644 --- a/vncviewer/PlatformPixelBuffer.h +++ b/vncviewer/PlatformPixelBuffer.h @@ -1,4 +1,4 @@ -/* Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB +/* Copyright 2011-2014 Pierre Ossman for Cendio AB * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,31 +21,15 @@ #include <rfb/PixelBuffer.h> -#include <FL/fl_draw.H> - -class PlatformPixelBuffer: public rfb::ManagedPixelBuffer { +class PlatformPixelBuffer: public rfb::FullFramePixelBuffer { public: - PlatformPixelBuffer(int width, int height) : - rfb::ManagedPixelBuffer(rfb::PixelFormat(32, 24, false, true, - 255, 255, 255, 0, 8, 16), - width, height) - {}; - - inline void draw(int src_x, int src_y, int x, int y, int w, int h); -}; + PlatformPixelBuffer(const rfb::PixelFormat& pf, int width, int height, + rdr::U8* data); -inline void PlatformPixelBuffer::draw(int src_x, int src_y, int x, int y, int w, int h) -{ - int pixel_bytes, stride_bytes; - const uchar *buf_start; + virtual void draw(int src_x, int src_y, int x, int y, int w, int h) = 0; - pixel_bytes = getPF().bpp/8; - stride_bytes = pixel_bytes * getStride(); - buf_start = data + - pixel_bytes * src_x + - stride_bytes * src_y; - - fl_draw_image(buf_start, x, y, w, h, pixel_bytes, stride_bytes); -} +protected: + int stride; +}; #endif |