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

Function BmpCopyBlock

xdevice.cpp:312–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310// another, stretching pixels as needed. Like the Windows StretchBlt() API.
311
312void BmpCopyBlock(CONST Bitmap *bs, int x1, int y1, int x2, int y2,
313 Bitmap *bd, int x3, int y3, int x4, int y4)
314{
315 int xs = x2-x1+1, ys = y2-y1+1, xd = x4-x3+1, yd = y4-y3+1,
316 x, y, xT, yT, nR, nG, nB;
317 byte *pbDst;
318
319 // Sanity checks of coordinate bounds, which shouldn't ever fail.
320 Assert(FBetween(x1, 0, bs->x-1));
321 Assert(FBetween(y1, 0, bs->y-1));
322 Assert(FBetween(x2, 0, bs->x-1));
323 Assert(FBetween(y2, 0, bs->y-1));
324 Assert(FBetween(x3, 0, bd->x-1));
325 Assert(FBetween(y3, 0, bd->y-1));
326 Assert(FBetween(x4, 0, bd->x-1));
327 Assert(FBetween(y4, 0, bd->y-1));
328
329 for (y = y3; y <= y4; y++) {
330 pbDst = _PbXY(bd, x3, y);
331 yT = y1 + (y-y3) * ys / yd;
332 for (x = x3; x <= x4; x++) {
333 xT = x1 + (x-x3) * xs / xd;
334 _GetRGB(_PbXY(bs, xT, yT), &nR, &nG, &nB);
335 _SetRGB(pbDst, nR, nG, nB);
336 pbDst += cbPixelK;
337 }
338 }
339}
340
341
342// Adjust the color of a pixel on a world map, based on whether the location

Callers 2

FBmpDrawBackFunction · 0.85
FBmpDrawMapFunction · 0.85

Calls 4

AssertFunction · 0.85
_PbXYFunction · 0.85
_GetRGBFunction · 0.85
_SetRGBFunction · 0.85

Tested by

no test coverage detected