MythTV  master
surface.cpp
Go to the documentation of this file.
1 #include "surface.h"
2 #include <stdlib.h>
3 #include <inttypes.h> // added for amd64 support
4 
5 Surface * surface_new (int w, int h) {
6  Surface * s = (Surface*)malloc(sizeof(Surface));
7  s->realstart = (int*)malloc(w*h*4 + 128);
8  s->buf = (int*)((uintptr_t)s->realstart + 128 - (((uintptr_t)s->realstart) % 128));
9  s->size = w*h;
10  s->width = w;
11  s->height = h;
12  return s;
13 }
14 
15 void surface_delete (Surface **s) {
16  free ((*s)->realstart);
17  free (*s);
18  *s = NULL;
19 }
Surface::height
int height
Definition: surface.h:7
surface.h
Surface::width
int width
Definition: surface.h:6
Surface
Definition: surface.h:4
surface_delete
void surface_delete(Surface **s)
Definition: surface.cpp:15
Surface::size
int size
Definition: surface.h:8
Surface::buf
int * buf
Definition: surface.h:5
Surface::realstart
int * realstart
Definition: surface.h:10
surface_new
Surface * surface_new(int w, int h)
Definition: surface.cpp:5