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
5Surface * 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
16 free ((*s)->realstart);
17 free (*s);
18 *s = NULL;
19}
Definition: surface.h:4
int height
Definition: surface.h:7
int size
Definition: surface.h:8
int * buf
Definition: surface.h:5
int * realstart
Definition: surface.h:10
int width
Definition: surface.h:6
Surface * surface_new(int w, int h)
Definition: surface.cpp:5
void surface_delete(Surface **s)
Definition: surface.cpp:15