MCPcopy Create free account
hub / github.com/bwapi/bwapi / BlitGrpFrame

Method BlitGrpFrame

bwapi/BWAPI/Source/BW/Bitmap.cpp:60–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58 }
59
60 void Bitmap::BlitGrpFrame(const grpFrame *pGrp, int x, int y)
61 {
62 if ( !this->isValid() || !pGrp )
63 return;
64
65 // Get pointers to grp frame data
66 WORD *pwLineData = (WORD*)pGrp->dataOffset;
67 BYTE *pbBase = (BYTE*)pGrp->dataOffset;
68
69 // Set GRP offsets
70 x += pGrp->x;
71 y += pGrp->y;
72
73 int yOff = y;
74 for ( int i = 0; i < pGrp->hgt; ++i )
75 {
76 // Get pointer to current line's byte code data
77 BYTE *pData = &pbBase[ pwLineData[i] ];
78
79 int xOff = x;
80 int pxRemaining = pGrp->wid;
81 do
82 {
83 //BWAPI::Broodwar << "Reading" << std::endl;
84 BYTE op = *pData++;
85
86 if ( op & 0x80 )
87 {
88 op &= 0x7F;
89 pxRemaining -= op;
90 xOff += op;
91 }
92 else if ( op & 0x40 )
93 {
94 op &= 0xBF;
95 pxRemaining -= op;
96 BYTE px = *pData++;
97 while ( op-- ) // @TODO: optimize to memset
98 this->plot(xOff++, yOff, px);
99 }
100 else
101 {
102 pxRemaining -= op;
103 while ( op-- )
104 this->plot(xOff++, yOff, *pData++);
105 }
106 } while ( pxRemaining > 0 );
107 ++yOff;
108 } // for each line
109 }
110
111 void Bitmap::BlitGraphic(const grpHead *pGrp, int frame, int x, int y)
112 {

Callers 1

BlitGraphicMethod · 0.95

Calls 2

isValidMethod · 0.95
plotMethod · 0.95

Tested by

no test coverage detected