MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / FAllocateBmp

Function FAllocateBmp

xdevice.cpp:97–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95// Allocate or reallocate a 24 bit color bitmap to have a given size.
96
97flag FAllocateBmp(Bitmap *b, int x, int y)
98{
99 char sz[cchSzDef];
100 long cb;
101 byte *rgb;
102
103 if (x == b->x && y == b->y)
104 return fTrue;
105 if (x < 0 || y < 0 || x > zColmap || y > zColmap) {
106 sprintf(sz, "Can't create color bitmap larger than %d by %d!\n",
107 zColmap, zColmap);
108 PrintError(sz);
109 return fFalse;
110 }
111 cb = CbColmap(x, y);
112 if (cb < 0) {
113 sprintf(sz, "Can't allocate color bitmap of size %d by %d!\n", x, y);
114 PrintError(sz);
115 return fFalse;
116 }
117 if (cb != CbColmap(b->x, b->y)) {
118 rgb = (byte *)PAllocate(cb, "color bitmap");
119 if (rgb == NULL)
120 return fFalse;
121 DeallocatePIf(b->rgb);
122 b->rgb = rgb;
123 }
124 b->x = x; b->y = y;
125 b->clRow = CbColmapRow(x) >> 2;
126 return fTrue;
127}
128
129
130// Load a bitmap from file into a 24 bit bitmap structure. This supports

Callers 8

xscreen.cppFile · 0.85
XChartRisingFunction · 0.85
FReadBmpFunction · 0.85
FBmpCopyFromWinFunction · 0.85
FBmpShrinkToWinFunction · 0.85
FBmpDrawBackFunction · 0.85
FBmpDrawMapFunction · 0.85
FBmpDrawMap2Function · 0.85

Calls 2

PrintErrorFunction · 0.85
PAllocateFunction · 0.85

Tested by

no test coverage detected