| 113 | } |
| 114 | |
| 115 | void GuiOffscreenCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */) |
| 116 | { |
| 117 | if (!mTargetDirty) |
| 118 | return; |
| 119 | |
| 120 | #ifdef TORQUE_ENABLE_GFXDEBUGEVENTS |
| 121 | char buf[256]; |
| 122 | dSprintf(buf, sizeof(buf), "OffsceenCanvas %s", getName() ? getName() : getIdString()); |
| 123 | GFXDEBUGEVENT_SCOPE_EX(GuiOffscreenCanvas_renderFrame, ColorI::GREEN, buf); |
| 124 | #endif |
| 125 | |
| 126 | PROFILE_START(OffscreenCanvasPreRender); |
| 127 | |
| 128 | #ifdef TORQUE_GFX_STATE_DEBUG |
| 129 | GFX->getDebugStateManager()->startFrame(); |
| 130 | #endif |
| 131 | |
| 132 | if (mTarget->getSize() != mTargetSize) |
| 133 | { |
| 134 | _setupTargets(); |
| 135 | mNamedTarget.setViewport( RectI( Point2I::Zero, mTargetSize ) ); |
| 136 | } |
| 137 | |
| 138 | // Make sure the root control is the size of the canvas. |
| 139 | Point2I size = mTarget->getSize(); |
| 140 | |
| 141 | if(size.x == 0 || size.y == 0) |
| 142 | { |
| 143 | PROFILE_END(); |
| 144 | return; |
| 145 | } |
| 146 | |
| 147 | RectI screenRect(0, 0, size.x, size.y); |
| 148 | |
| 149 | maintainSizing(); |
| 150 | |
| 151 | //preRender (recursive) all controls |
| 152 | preRender(); |
| 153 | |
| 154 | PROFILE_END(); |
| 155 | |
| 156 | // Are we just doing pre-render? |
| 157 | if(preRenderOnly) |
| 158 | { |
| 159 | return; |
| 160 | } |
| 161 | |
| 162 | resetUpdateRegions(); |
| 163 | |
| 164 | PROFILE_START(OffscreenCanvasRenderControls); |
| 165 | |
| 166 | GuiCursor *mouseCursor = NULL; |
| 167 | bool cursorVisible = true; |
| 168 | |
| 169 | Point2I cursorPos((S32)mCursorPt.x, (S32)mCursorPt.y); |
| 170 | mouseCursor = mDefaultCursor; |
| 171 | |
| 172 | mLastCursorEnabled = cursorVisible; |
nothing calls this directly
no test coverage detected