summaryrefslogtreecommitdiffstats
path: root/client/red_gl_canvas.cpp
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-03-03 15:08:58 +0100
committerAlexander Larsson <alexl@redhat.com>2010-03-08 19:45:28 +0100
commitf8217d8b96f35fd297c74df1da6428b56b01149a (patch)
treeba51569d697f284b0048337202c74539a8f6a193 /client/red_gl_canvas.cpp
parent05697e502d709974f9b94feca5d9bdde20b993be (diff)
downloadspice-f8217d8b96f35fd297c74df1da6428b56b01149a.tar.gz
spice-f8217d8b96f35fd297c74df1da6428b56b01149a.tar.xz
spice-f8217d8b96f35fd297c74df1da6428b56b01149a.zip
Move virtualization of canvas drawing into common/canvas_base
Instead of having two virtualizations of the canvas we push the virtualization into the canvas code itself. This not only avoids the duplication of this code, it also makes the exposed API for the canvas much smaller (in terms of exported API). It also lets us use the virtualization to implement basic support for operations in canvas_base which is then overridden by each canvas implementation.
Diffstat (limited to 'client/red_gl_canvas.cpp')
-rw-r--r--client/red_gl_canvas.cpp101
1 files changed, 4 insertions, 97 deletions
diff --git a/client/red_gl_canvas.cpp b/client/red_gl_canvas.cpp
index 76dabc71..c6bb1137 100644
--- a/client/red_gl_canvas.cpp
+++ b/client/red_gl_canvas.cpp
@@ -27,7 +27,6 @@
GCanvas::GCanvas(PixmapCache& pixmap_cache, PaletteCache& palette_cache,
GlzDecoderWindow &glz_decoder_window)
: Canvas(pixmap_cache, palette_cache, glz_decoder_window)
- , _canvas (NULL)
, _pixmap (0)
, _textures_lost (false)
{
@@ -41,19 +40,13 @@ GCanvas::~GCanvas()
void GCanvas::destroy()
{
if (_canvas) {
- gl_canvas_destroy(_canvas, _textures_lost);
+ gl_canvas_set_textures_lost (_canvas, (int)_textures_lost);
+ _canvas->ops->destroy(_canvas);
_canvas = NULL;
}
destroy_pixmap();
}
-void GCanvas::clear()
-{
- if (_canvas) {
- gl_canvas_clear(_canvas);
- }
-}
-
void GCanvas::destroy_pixmap()
{
delete _pixmap;
@@ -96,7 +89,7 @@ void GCanvas::set_mode(int width, int height, int depth, RedWindow *win,
destroy();
create_pixmap(width, height, win, rendertype);
- if (!(_canvas = gl_canvas_create(NULL, width, height, depth,
+ if (!(_canvas = gl_canvas_create(width, height, depth,
&pixmap_cache().base,
&palette_cache().base,
&glz_decoder()))) {
@@ -104,97 +97,11 @@ void GCanvas::set_mode(int width, int height, int depth, RedWindow *win,
}
}
-void GCanvas::set_access_params(unsigned long base, unsigned long max)
-{
- gl_canvas_set_access_params(_canvas, base, max);
-}
-
-void GCanvas::draw_fill(SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill)
-{
- gl_canvas_draw_fill(_canvas, bbox, clip, fill);
- _pixmap->update_texture(bbox);
-}
-
-void GCanvas::draw_text(SpiceRect *bbox, SpiceClip *clip, SpiceText *text)
-{
- gl_canvas_draw_text(_canvas, bbox, clip, text);
- _pixmap->update_texture(bbox);
-}
-
-void GCanvas::draw_opaque(SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque)
-{
- gl_canvas_draw_opaque(_canvas, bbox, clip, opaque);
- _pixmap->update_texture(bbox);
-}
-
-void GCanvas::draw_copy(SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy)
+void GCanvas::touched_bbox(const SpiceRect *bbox)
{
- gl_canvas_draw_copy(_canvas, bbox, clip, copy);
_pixmap->update_texture(bbox);
}
-void GCanvas::draw_transparent(SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent)
-{
- gl_canvas_draw_transparent(_canvas, bbox, clip, transparent);
- _pixmap->update_texture(bbox);
-}
-
-void GCanvas::draw_alpha_blend(SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend)
-{
- gl_canvas_draw_alpha_blend(_canvas, bbox, clip, alpha_blend);
- _pixmap->update_texture(bbox);
-}
-
-void GCanvas::copy_bits(SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos)
-{
- gl_canvas_copy_pixels(_canvas, bbox, clip, src_pos);
- _pixmap->update_texture(bbox);
-}
-
-void GCanvas::draw_blend(SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend)
-{
- gl_canvas_draw_blend(_canvas, bbox, clip, blend);
- _pixmap->update_texture(bbox);
-}
-
-void GCanvas::draw_blackness(SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness)
-{
- gl_canvas_draw_blackness(_canvas, bbox, clip, blackness);
- _pixmap->update_texture(bbox);
-}
-
-void GCanvas::draw_whiteness(SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness)
-{
- gl_canvas_draw_whiteness(_canvas, bbox, clip, whiteness);
- _pixmap->update_texture(bbox);
-}
-
-void GCanvas::draw_invers(SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers)
-{
- gl_canvas_draw_invers(_canvas, bbox, clip, invers);
- _pixmap->update_texture(bbox);
-}
-
-void GCanvas::draw_rop3(SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3)
-{
- gl_canvas_draw_rop3(_canvas, bbox, clip, rop3);
- _pixmap->update_texture(bbox);
-}
-
-void GCanvas::draw_stroke(SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke)
-{
- gl_canvas_draw_stroke(_canvas, bbox, clip, stroke);
- _pixmap->update_texture(bbox);
-}
-
-void GCanvas::put_image(const PixmapHeader& image, const SpiceRect& dest,
- const QRegion* clip)
-{
- gl_canvas_put_image(_canvas, &dest, image.data, image.width, image.height,
- image.stride, clip);
- _pixmap->update_texture(&dest);
-}
-
CanvasType GCanvas::get_pixmap_type()
{
return CANVAS_TYPE_GL;