MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / constructBitmapArray

Method constructBitmapArray

engine/source/gui/guiTypes.cc:279–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279S32 GuiControlProfile::constructBitmapArray()
280{
281 if(mBitmapArrayRects.size())
282 return mBitmapArrayRects.size();
283
284 GBitmap *bmp = mTextureHandle.getBitmap();
285
286 // Make sure the texture exists.
287 if( !bmp )
288 return 0;
289
290 //get the separator color
291 ColorI sepColor;
292 if ( !bmp || !bmp->getColor( 0, 0, sepColor ) )
293 {
294 Con::errorf("Failed to create bitmap array from %s for profile %s - couldn't ascertain seperator color!", mBitmapName, getName());
295 AssertFatal( false, avar("Failed to create bitmap array from %s for profile %s - couldn't ascertain seperator color!", mBitmapName, getName()));
296 return 0;
297 }
298
299 //now loop through all the scroll pieces, and find the bounding rectangle for each piece in each state
300 S32 curY = 0;
301
302 // ascertain the height of this row...
303 ColorI color;
304 mBitmapArrayRects.clear();
305 while(curY < (S32)bmp->getHeight())
306 {
307 // skip any sep colors
308 bmp->getColor( 0, curY, color);
309 if(color == sepColor)
310 {
311 curY++;
312 continue;
313 }
314 // ok, process left to right, grabbing bitmaps as we go...
315 S32 curX = 0;
316 while(curX < (S32)bmp->getWidth())
317 {
318 bmp->getColor(curX, curY, color);
319 if(color == sepColor)
320 {
321 curX++;
322 continue;
323 }
324 S32 startX = curX;
325 while(curX < (S32)bmp->getWidth())
326 {
327 bmp->getColor(curX, curY, color);
328 if(color == sepColor)
329 break;
330 curX++;
331 }
332 S32 stepY = curY;
333 while(stepY < (S32)bmp->getHeight())
334 {
335 bmp->getColor(startX, stepY, color);
336 if(color == sepColor)

Callers 15

onWakeMethod · 0.80
onWakeMethod · 0.80
onWakeMethod · 0.80
onWakeMethod · 0.80
onWakeMethod · 0.80
onWakeMethod · 0.80
onWakeMethod · 0.80
onWakeMethod · 0.80
onWakeMethod · 0.80
onWakeMethod · 0.80
onWakeMethod · 0.80
onWakeMethod · 0.80

Calls 10

errorfFunction · 0.85
avarFunction · 0.85
getColorMethod · 0.80
RectIClass · 0.50
sizeMethod · 0.45
getBitmapMethod · 0.45
clearMethod · 0.45
getHeightMethod · 0.45
getWidthMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected