/* ================= hhProjectileCrawlerGrenade::Event_ApplyExpandWound ================= */ void hhProjectileCrawlerGrenade::Event_ApplyExpandWound() { trace_t trace; if( !modelProxy.IsValid() || !modelProxy->GetCombatModel() ) { return; } idBounds clipBounds( modelProxy->GetRenderEntity()->bounds ); idVec3 traceEnd = GetOrigin(); idVec3 traceStart = traceEnd + hhUtils::RandomPointInShell( clipBounds.Expand(1.0f).GetRadius(), clipBounds.Expand(2.0f).GetRadius() ); idVec3 jointOrigin, localOrigin, localNormal; idMat3 jointAxis, axisTranspose; jointHandle_t jointHandle = INVALID_JOINT; CancelEvents( &EV_ApplyExpandWound ); PostEventSec( &EV_ApplyExpandWound, spawnArgs.GetFloat("expandWoundDelay") ); if( !gameLocal.clip.TracePoint(trace, traceStart, traceEnd, modelProxy->GetCombatModel()->GetContents(), NULL) ) { return; } if( trace.c.entityNum != entityNumber ) {//Make sure we hit ourselves return; } modelProxy->AddDamageEffect( trace, vec3_zero, spawnArgs.GetString("def_expandDamage"), (!fl.networkSync || netSyncPhysics) ); }
void CFWL_WidgetMgrDelegate::DrawChild(IFWL_Widget* parent, const CFX_RectF& rtClip, CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { if (!parent) return; FX_BOOL bFormDisable = m_pWidgetMgr->IsFormDisabled(); IFWL_Widget* pNextChild = m_pWidgetMgr->GetFirstChildWidget(parent); while (pNextChild) { IFWL_Widget* child = pNextChild; pNextChild = m_pWidgetMgr->GetNextSiblingWidget(child); if (child->GetStates() & FWL_WGTSTATE_Invisible) continue; CFX_RectF rtWidget; child->GetWidgetRect(rtWidget); if (rtWidget.IsEmpty()) continue; CFX_Matrix widgetMatrix; CFX_RectF clipBounds(rtWidget); if (!bFormDisable) child->GetMatrix(widgetMatrix, TRUE); if (pMatrix) widgetMatrix.Concat(*pMatrix); if (!bFormDisable) { widgetMatrix.TransformPoint(clipBounds.left, clipBounds.top); clipBounds.Intersect(rtClip); if (clipBounds.IsEmpty()) continue; pGraphics->SaveGraphState(); pGraphics->SetClipRect(clipBounds); } widgetMatrix.Translate(rtWidget.left, rtWidget.top, TRUE); IFWL_WidgetDelegate* pDelegate = child->SetDelegate(nullptr); if (pDelegate) { if (m_pWidgetMgr->IsFormDisabled() || IsNeedRepaint(child, &widgetMatrix, rtClip)) { pDelegate->OnDrawWidget(pGraphics, &widgetMatrix); } } if (!bFormDisable) pGraphics->RestoreGraphState(); DrawChild(child, clipBounds, pGraphics, bFormDisable ? &widgetMatrix : pMatrix); child = m_pWidgetMgr->GetNextSiblingWidget(child); } }
void Label::updateBounds() { if (_autoSize != AUTO_SIZE_NONE && _font) { // Measure bounds based only on normal state so that bounds updates are not always required on state changes. // This is a trade-off for functionality vs performance, but changing the size of UI controls on hover/focus/etc // is a pretty bad practice so we'll prioritize performance here. if (_autoSize & AUTO_SIZE_WIDTH) { float w, h; _font->measureText(_text.c_str(), getFontSize(NORMAL), getTextDrawingFlags(NORMAL), &w, &h, getCharacterSpacing(NORMAL), getLineSpacing(NORMAL)); setWidthInternal(ceilf(w + getBorder(NORMAL).left + getBorder(NORMAL).right + getPadding().left + getPadding().right)); if (_autoSize & AUTO_SIZE_HEIGHT) setHeightInternal(ceilf(h + getBorder(NORMAL).top + getBorder(NORMAL).bottom + getPadding().top + getPadding().bottom)); } else // _autoSize & AUTO_SIZE_HEIGHT { GP_ASSERT(_autoSize & AUTO_SIZE_HEIGHT); // recalculate height due to word wrapping float h = getFontSize(NORMAL); if (_textBounds.width > 0.0f) { gameplay::Rectangle clipBounds(_textBounds.width, FLT_MAX); gameplay::Rectangle out; _font->measureText(_text.c_str(), clipBounds, getFontSize(NORMAL), getTextDrawingFlags(NORMAL), &out, getTextAlignment(NORMAL), true, true, getCharacterSpacing(NORMAL), getLineSpacing(NORMAL)); h = out.height; } setHeightInternal(ceilf(h + getBorder(NORMAL).top + getBorder(NORMAL).bottom + getPadding().top + getPadding().bottom)); } } Control::updateBounds(); }
static jboolean android_view_RenderNode_setClipBounds(JNIEnv* env, jobject clazz, jlong renderNodePtr, jint left, jint top, jint right, jint bottom) { android::uirenderer::Rect clipBounds(left, top, right, bottom); return SET_AND_DIRTY(setClipBounds, clipBounds, RenderNode::GENERIC); }
void MVListBase::draw(const MVRect&) /**************************************************************************** * * Function: MVListBase::draw * Parameters: clip - Clipping rectangle to use when drawing * * Description: Draws the representation of the list. * ****************************************************************************/ { MS_obscure(); MVRect clipBounds(bounds.left()+leftIndent, bounds.top()+topIndent, bounds.right()-rightIndent, bounds.bottom()-rightIndent); // Clear the background for the list dc.setColor(getColor(scListInterior)); dc.fillRect(bounds); MV_setBorderColors(getColor(scShadow),getColor(scHighlight)); MV_drawBorder(bounds,MV_BDR_OUTSET,1); MV_setBorderColors(getColor(scBlack),getColor(scButtonFace)); MV_drawBorder(bounds.insetBy(1,1),MV_BDR_OUTSET,1); // Draw each of the items in the list. Note that we set up the clip // rectangle to clip everything to the bounds of the list correctly, // and that we only draw those items that are visible and within the // range of selectable items. MVRect v(visible & range); MVRect start(bounds.left()+leftIndent, bounds.top()+topIndent, bounds.left()+leftIndent+cellSize.x, bounds.top()+topIndent+cellSize.y); for (int i = v.left(); i < v.right(); i++) { MVRect r(start); for (int j = v.top(); j < v.bottom(); j++) { MVRect c(r); c &= clipBounds; if (!c.isEmpty()) { dc.setClipRect(c); drawCell(i,j,r); } r.top() += cellSize.y; r.bottom() += cellSize.y; } start.left() += cellSize.x; start.right() += cellSize.x; } if (range.isEmpty()) { // There is nothing to draw in the list (it is currently empty), // but if the list is selected then we should draw a dotted outline // around the first empty cell to ensure the user knows when the // list is selected. if ((state & sfFocused)) { attributes_t attr; dc.getAttributes(attr); dc.setColor(getColor(scListCell)); dc.setPenStyle(MGL_BITMAP_TRANSPARENT); dc.setPenBitmapPattern(0,MGL_GRAY_FILL); dc.usePenBitmapPattern(0); drawRect(bounds.left()+leftIndent, bounds.top()+topIndent, bounds.left()+leftIndent+cellSize.x, bounds.top()+topIndent+cellSize.y); dc.restoreAttributes(attr); } } MS_show(); }