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

Function FBmpDrawMap2

xdevice.cpp:889–929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

887// 24 bit bitmap. Called from the graphic -Nl switch local space chart.
888
889flag FBmpDrawMap2(int x1, int y1, int x2, int y2,
890 real rx1, real ry1, real rx2, real ry2)
891{
892 Bitmap *bmp = &gi.bmp;
893 int x12;
894 real rx, ry, x3, y3, x4, y4, x34;
895
896 if (!gi.fBmp || (gi.fFile && gs.ft != ftBmp))
897 return fFalse;
898 if (gi.bmpWorld.rgb == NULL && !FLoadBmp(BITMAP_EARTH, &gi.bmpWorld, fFalse))
899 return fFalse;
900#ifdef WINANY
901 if (!gi.fFile) {
902 if (!FAllocateBmp(&wi.bmpWin, gs.xWin, gs.yWin))
903 return fFalse;
904 bmp = &wi.bmpWin;
905 }
906#endif
907
908 rx = (real)gi.bmpWorld.x / rDegMax; ry = (real)gi.bmpWorld.y / rDegHalf;
909 BmpSetAll(bmp, KvFromKi(gi.kiOff));
910 rx1 = Mod(rx1); rx2 = Mod(rx2);
911 x3 = rx1 * rx; y3 = ry1 * ry;
912 x4 = rx2 * rx; y4 = ry2 * ry;
913 if (x3 < x4 && x4-x3 > rSmall) {
914 // In most cases, just copy the entire rectangle all at once.
915 BmpCopyBlock2(&gi.bmpWorld, x3, y3, x4, y4, bmp, x1, y1, x2, y2);
916 } else {
917 // If viewport spans 180W/E, then have to copy twice from Earth bitmap.
918 x34 = (real)gi.bmpWorld.x - rSmall;
919 x12 = x1 + (int)((real)(x2-x1+1) * (x34 - x3) / (x34 - x3 + x4));
920 BmpCopyBlock2(&gi.bmpWorld, x3, y3, x34, y4, bmp, x1, y1, x12, y2);
921 BmpCopyBlock2(&gi.bmpWorld, 0, y3, x4, y4, bmp, x12+1, y1, x2, y2);
922 }
923
924#ifdef WINANY
925 if (!gi.fFile)
926 BmpCopyToWin(bmp, wi.hdc, 0, 0);
927#endif
928 return fTrue;
929}
930
931
932// Adjust the window or bitmap's content to be smoother, and look antialiased.

Callers 1

XChartLocalFunction · 0.85

Calls 6

FLoadBmpFunction · 0.85
FAllocateBmpFunction · 0.85
BmpSetAllFunction · 0.85
ModFunction · 0.85
BmpCopyBlock2Function · 0.85
BmpCopyToWinFunction · 0.85

Tested by

no test coverage detected