MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / onRender

Method onRender

Engine/source/gui/controls/guiBitmapCtrl.cpp:164–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164void GuiBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
165{
166 if (mBitmap)
167 {
168 GFX->getDrawUtil()->clearBitmapModulation();
169 GFX->getDrawUtil()->setBitmapModulation(mColor);
170 if(mWrap)
171 {
172 // We manually draw each repeat because non power of two textures will
173 // not tile correctly when rendered with GFX->drawBitmapTile(). The non POT
174 // bitmap will be padded by the hardware, and we'll see lots of slack
175 // in the texture. So... lets do what we must: draw each repeat by itself:
176 GFXTextureObject* texture = mBitmap;
177 RectI srcRegion;
178 RectI dstRegion;
179 F32 xdone = ((F32)getExtent().x/(F32)texture->mBitmapSize.x)+1;
180 F32 ydone = ((F32)getExtent().y/(F32)texture->mBitmapSize.y)+1;
181
182 S32 xshift = mStartPoint.x%texture->mBitmapSize.x;
183 S32 yshift = mStartPoint.y%texture->mBitmapSize.y;
184 for(S32 y = 0; y < ydone; ++y)
185 for(S32 x = 0; x < xdone; ++x)
186 {
187 srcRegion.set(0,0,texture->mBitmapSize.x,texture->mBitmapSize.y);
188 dstRegion.set( ((texture->mBitmapSize.x*x)+offset.x)-xshift,
189 ((texture->mBitmapSize.y*y)+offset.y)-yshift,
190 texture->mBitmapSize.x,
191 texture->mBitmapSize.y);
192 GFX->getDrawUtil()->drawBitmapStretchSR(texture, dstRegion, srcRegion, GFXBitmapFlip_None, GFXTextureFilterLinear, mAngle);
193 }
194
195 }
196 else
197 {
198 RectI rect(offset, getExtent());
199 GFX->getDrawUtil()->drawBitmapStretch(mBitmap, rect, GFXBitmapFlip_None, GFXTextureFilterLinear, false, mAngle);
200 }
201 }
202
203 if (mProfile->mBorder || !mBitmap)
204 {
205 RectI rect(offset.x, offset.y, getExtent().x, getExtent().y);
206 GFX->getDrawUtil()->drawRect(rect, mProfile->mBorderColor);
207 }
208
209 renderChildControls(offset, updateRect);
210}
211
212void GuiBitmapCtrl::setValue(S32 x, S32 y)
213{

Callers

nothing calls this directly

Calls 7

clearBitmapModulationMethod · 0.80
getDrawUtilMethod · 0.80
setBitmapModulationMethod · 0.80
drawBitmapStretchSRMethod · 0.80
drawBitmapStretchMethod · 0.80
drawRectMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected