2014-04-29 22:45:16 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Glyptodon LLC
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "guac_surface.h"
|
|
|
|
|
2014-04-29 23:06:44 +00:00
|
|
|
#include <cairo/cairo.h>
|
2014-04-29 22:45:16 +00:00
|
|
|
#include <guacamole/layer.h>
|
|
|
|
#include <guacamole/protocol.h>
|
|
|
|
#include <guacamole/socket.h>
|
|
|
|
|
2014-04-29 23:06:44 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2014-04-29 22:45:16 +00:00
|
|
|
guac_common_surface* guac_common_surface_alloc(guac_socket* socket, const guac_layer* layer, int w, int h) {
|
2014-04-29 23:06:44 +00:00
|
|
|
|
|
|
|
/* Init surface */
|
|
|
|
guac_common_surface* surface = malloc(sizeof(guac_common_surface));
|
|
|
|
surface->layer = layer;
|
|
|
|
surface->socket = socket;
|
|
|
|
surface->width = w;
|
|
|
|
surface->height = h;
|
|
|
|
surface->dirty = 0;
|
|
|
|
|
|
|
|
/* Create corresponding Cairo surface */
|
|
|
|
surface->stride = cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, w);
|
|
|
|
surface->buffer = malloc(surface->stride * h);
|
|
|
|
surface->surface = cairo_image_surface_create_for_data(surface->buffer, CAIRO_FORMAT_RGB24,
|
|
|
|
w, h, surface->stride);
|
|
|
|
|
|
|
|
return surface;
|
2014-04-29 22:45:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void guac_common_surface_free(guac_common_surface* surface) {
|
2014-04-29 23:06:44 +00:00
|
|
|
cairo_surface_destroy(surface->surface);
|
|
|
|
free(surface->buffer);
|
|
|
|
free(surface);
|
2014-04-29 22:45:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void guac_common_surface_draw(guac_common_surface* surface, cairo_surface_t* src, int x, int y) {
|
|
|
|
/* STUB */
|
|
|
|
}
|
|
|
|
|
|
|
|
void guac_common_surface_copy(guac_common_surface* src, int sx, int sy, int w, int h,
|
|
|
|
guac_common_surface* dst, int dx, int dy) {
|
|
|
|
/* STUB */
|
|
|
|
}
|
|
|
|
|
|
|
|
void guac_common_surface_transfer(guac_transfer_function op,
|
|
|
|
guac_common_surface* src, int sx, int sy, int w, int h,
|
|
|
|
guac_common_surface* dst, int dx, int dy) {
|
|
|
|
/* STUB */
|
|
|
|
}
|
|
|
|
|
|
|
|
void guac_common_surface_resize(guac_common_surface* surface, int w, int h) {
|
|
|
|
/* STUB */
|
|
|
|
}
|
|
|
|
|
|
|
|
void guac_common_surface_rect(guac_common_surface* surface,
|
|
|
|
int x, int y, int w, int h,
|
|
|
|
int red, int green, int blue) {
|
|
|
|
/* STUB */
|
|
|
|
}
|
|
|
|
|
|
|
|
void guac_common_surface_flush(guac_common_surface* surface) {
|
|
|
|
/* STUB */
|
|
|
|
}
|
|
|
|
|