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

Method onRender

Engine/source/gui/controls/guiColorPicker.cpp:374–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372}
373
374void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
375{
376 if (mStateBlock.isNull())
377 {
378 GFXStateBlockDesc desc;
379 desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
380 desc.setZReadWrite(false);
381 desc.zWriteEnable = false;
382 desc.setCullMode(GFXCullNone);
383 mStateBlock = GFX->createStateBlock(desc);
384 }
385
386 RectI boundsRect(offset, getExtent());
387 renderColorBox(boundsRect);
388
389 if (mPositionChanged || mBitmap == NULL)
390 {
391 bool nullBitmap = false;
392
393 if (mPositionChanged == false && mBitmap == NULL)
394 nullBitmap = true;
395
396 mPositionChanged = false;
397 Point2I extent = getRoot()->getExtent();
398
399 // If we are anything but a pallete, change the pick color
400 if (mDisplayMode != pPallet)
401 {
402 Point2I resolution = getRoot()->getExtent();
403
404 U32 buf_x = offset.x + mSelectorPos.x + 1;
405 U32 buf_y = resolution.y - (extent.y - (offset.y + mSelectorPos.y + 1));
406
407 GFXTexHandle bb( resolution.x, resolution.y, GFXFormatR8G8B8A8, &GFXDefaultRenderTargetProfile, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__) );
408
409 Point2I tmpPt(buf_x, buf_y);
410
411 GFXTarget *targ = GFX->getActiveRenderTarget();
412 targ->resolveTo(bb);
413
414 if (mBitmap)
415 {
416 delete mBitmap;
417 mBitmap = NULL;
418 }
419
420 mBitmap = new GBitmap(bb.getWidth(), bb.getHeight());
421
422 bb.copyToBmp(mBitmap);
423
424 if (!nullBitmap)
425 {
426 if (mSelectColor)
427 {
428 Point2I pos = findColor(mSetColor, offset, resolution, *mBitmap);
429 mSetColor = mSetColor.BLACK;
430 mSelectColor = false;
431 setSelectorPos(pos);

Callers

nothing calls this directly

Calls 13

avarFunction · 0.85
setBlendMethod · 0.80
setZReadWriteMethod · 0.80
setCullModeMethod · 0.80
createStateBlockMethod · 0.80
getExtentMethod · 0.80
getActiveRenderTargetMethod · 0.80
isNullMethod · 0.45
resolveToMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45
copyToBmpMethod · 0.45

Tested by

no test coverage detected