~paulliu/ubuntu/precise/freerdp/fixext

« back to all changes in this revision

Viewing changes to libfreerdp-cache/brush.c

  • Committer: Package Import Robot
  • Author(s): Otavio Salvador
  • Date: 2012-02-11 10:34:05 UTC
  • mfrom: (1.2.2)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: package-import@ubuntu.com-20120211103405-x2wgdb6x8plb7cdk
Tags: upstream-1.0.1
ImportĀ upstreamĀ versionĀ 1.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
 
87
87
void brush_cache_put(rdpBrushCache* brush, uint32 index, void* entry, uint32 bpp)
88
88
{
 
89
        void* prevEntry;
 
90
 
89
91
        if (bpp == 1)
90
92
        {
91
93
                if (index > brush->maxMonoEntries)
94
96
                        return;
95
97
                }
96
98
 
 
99
                prevEntry = brush->monoEntries[index].entry;
 
100
 
 
101
                if (prevEntry != NULL)
 
102
                        xfree(prevEntry);
 
103
 
97
104
                brush->monoEntries[index].bpp = bpp;
98
105
                brush->monoEntries[index].entry = entry;
99
106
        }
105
112
                        return;
106
113
                }
107
114
 
 
115
                prevEntry = brush->entries[index].entry;
 
116
 
 
117
                if (prevEntry != NULL)
 
118
                        xfree(prevEntry);
 
119
 
108
120
                brush->entries[index].bpp = bpp;
109
121
                brush->entries[index].entry = entry;
110
122
        }
142
154
 
143
155
void brush_cache_free(rdpBrushCache* brush)
144
156
{
 
157
        int i;
 
158
 
145
159
        if (brush != NULL)
146
160
        {
147
 
                xfree(brush->entries);
148
 
                xfree(brush->monoEntries);
 
161
                if (brush->entries != NULL)
 
162
                {
 
163
                        for (i = 0; i < (int) brush->maxEntries; i++)
 
164
                        {
 
165
                                if (brush->entries[i].entry != NULL)
 
166
                                        xfree(brush->entries[i].entry);
 
167
                        }
 
168
 
 
169
                        xfree(brush->entries);
 
170
                }
 
171
 
 
172
                if (brush->monoEntries != NULL)
 
173
                {
 
174
                        for (i = 0; i < (int) brush->maxMonoEntries; i++)
 
175
                        {
 
176
                                if (brush->monoEntries[i].entry != NULL)
 
177
                                        xfree(brush->monoEntries[i].entry);
 
178
                        }
 
179
 
 
180
                        xfree(brush->monoEntries);
 
181
                }
 
182
 
149
183
                xfree(brush);
150
184
        }
151
185
}