~ubuntu-branches/ubuntu/utopic/freerdp/utopic

« back to all changes in this revision

Viewing changes to libfreerdp-gdi/dc.c

  • Committer: Package Import Robot
  • Author(s): Otavio Salvador, Jeremy Bicha
  • Date: 2012-02-11 10:34:05 UTC
  • mfrom: (1.1.7) (9.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20120211103405-mk0gjhjn70eeyxul
Tags: 1.0.1-1
[ Jeremy Bicha ]
* New upstream release. Closes: #659332.
* Updated symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <stdlib.h>
25
25
#include <freerdp/freerdp.h>
26
26
#include <freerdp/gdi/gdi.h>
 
27
#include <freerdp/codec/color.h>
27
28
 
28
29
#include <freerdp/gdi/region.h>
29
30
 
48
49
}
49
50
 
50
51
/**
 
52
 * Create a device context.\n
 
53
 * @msdn{dd144871}
 
54
 * @return new device context
 
55
 */
 
56
 
 
57
HGDI_DC gdi_CreateDC(HCLRCONV clrconv, int bpp)
 
58
{
 
59
        HGDI_DC hDC = (HGDI_DC) malloc(sizeof(GDI_DC));
 
60
 
 
61
        hDC->drawMode = GDI_R2_BLACK;
 
62
        hDC->clip = gdi_CreateRectRgn(0, 0, 0, 0);
 
63
        hDC->clip->null = 1;
 
64
        hDC->hwnd = NULL;
 
65
 
 
66
        hDC->bitsPerPixel = bpp;
 
67
        hDC->bytesPerPixel = bpp / 8;
 
68
 
 
69
        hDC->alpha = clrconv->alpha;
 
70
        hDC->invert = clrconv->invert;
 
71
        hDC->rgb555 = clrconv->rgb555;
 
72
 
 
73
        hDC->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
 
74
        hDC->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
 
75
        hDC->hwnd->invalid->null = 1;
 
76
 
 
77
        hDC->hwnd->count = 32;
 
78
        hDC->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * hDC->hwnd->count);
 
79
        hDC->hwnd->ninvalid = 0;
 
80
 
 
81
        return hDC;
 
82
}
 
83
 
 
84
/**
51
85
 * Create a new device context compatible with the given device context.\n
52
86
 * @msdn{dd183489}
53
87
 * @param hdc device context
182
216
{
183
217
        if (hdc->hwnd)
184
218
        {
185
 
                free(hdc->hwnd->cinvalid);
186
 
                free(hdc->hwnd->invalid);
 
219
                if (hdc->hwnd->cinvalid != NULL)
 
220
                        free(hdc->hwnd->cinvalid);
 
221
 
 
222
                if (hdc->hwnd->invalid != NULL)
 
223
                        free(hdc->hwnd->invalid);
 
224
 
187
225
                free(hdc->hwnd);
188
226
        }
189
227