Endpoint32Query::Endpoint32Query(const char* address, const char* port) { if (!HasContent(address) || !HasContent(port)) return; addrinfo* result = nullptr; addrinfo hints = {}; hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; if (getaddrinfo(address, port, &hints, &result) == 0) _data = result; }
void ReImagePanel::mouseReleaseEvent( QMouseEvent* _event ) { if( HasContent() ) { if( IsDragging() ) m_dragStart.setX( -1 ); } }
std::widestring CChainTraverser_CreateSummary::GetParaText() { if (IsInTable()) { if (HasContent(m_sTableParaText)) { return m_sTableParaText; } } if ((x64_int_cast)m_sParaText.size()>0) { if (HasContent(m_sParaText)) { return m_sParaText; } } return m_sPrevParaText; }
void CChainTraverser_CreateSummary::ClearParaText() { if ((x64_int_cast)m_sParaText.size()>0) { if (HasContent(m_sParaText)) { m_sPrevParaText = m_sParaText; } } m_sParaText.erase(); }
void ReImagePanel::mousePressEvent( QMouseEvent* _event ) { if( HasContent() ) { if( ( Qt::MidButton == _event->button() ) || ( Qt::LeftButton == _event->button() && Qt::ControlModifier & _event->modifiers() ) ) { m_contentOriginBackup = m_contentOrigin; m_dragStart = _event->pos(); } } }
QSize ReImagePanel::GetBv() const { // The bounding volume should contain all the items and the spacing between them // plus the surrounding paddings. QSize bv; if( HasContent() ) { bv.setWidth( ( m_grid.width() - 1 ) * ( m_currentItemSize + m_hSpacing ) + m_currentItemSize + m_leftPadding + m_rightPadding ); bv.setHeight( ( m_grid.height() - 1 ) * ( m_currentItemSize + m_vSpacing ) + m_currentItemSize + m_topPadding + m_bottomPadding ); } return bv; }
void ReImagePanel::mouseMoveEvent( QMouseEvent* _event ) { if( HasContent() ) { if( IsDragging() ) { // Dragging: vertical only. QPoint delta = _event->pos() - m_dragStart; m_contentOrigin = m_contentOriginBackup + delta; update(); } } }
void DebugRenderer::Render() { if (!HasContent()) return; Graphics* graphics = GetSubsystem<Graphics>(); // Engine does not render when window is closed or device is lost assert(graphics && graphics->IsInitialized() && !graphics->IsDeviceLost()); URHO3D_PROFILE(RenderDebugGeometry); ShaderVariation* vs = graphics->GetShader(VS, "Basic", "VERTEXCOLOR"); ShaderVariation* ps = graphics->GetShader(PS, "Basic", "VERTEXCOLOR"); unsigned numVertices = (lines_.Size() + noDepthLines_.Size()) * 2 + (triangles_.Size() + noDepthTriangles_.Size()) * 3; // Resize the vertex buffer if too small or much too large if (vertexBuffer_->GetVertexCount() < numVertices || vertexBuffer_->GetVertexCount() > numVertices * 2) vertexBuffer_->SetSize(numVertices, MASK_POSITION | MASK_COLOR, true); float* dest = (float*)vertexBuffer_->Lock(0, numVertices, true); if (!dest) return; for (unsigned i = 0; i < lines_.Size(); ++i) { const DebugLine& line = lines_[i]; dest[0] = line.start_.x_; dest[1] = line.start_.y_; dest[2] = line.start_.z_; ((unsigned&)dest[3]) = line.color_; dest[4] = line.end_.x_; dest[5] = line.end_.y_; dest[6] = line.end_.z_; ((unsigned&)dest[7]) = line.color_; dest += 8; } for (unsigned i = 0; i < noDepthLines_.Size(); ++i) { const DebugLine& line = noDepthLines_[i]; dest[0] = line.start_.x_; dest[1] = line.start_.y_; dest[2] = line.start_.z_; ((unsigned&)dest[3]) = line.color_; dest[4] = line.end_.x_; dest[5] = line.end_.y_; dest[6] = line.end_.z_; ((unsigned&)dest[7]) = line.color_; dest += 8; } for (unsigned i = 0; i < triangles_.Size(); ++i) { const DebugTriangle& triangle = triangles_[i]; dest[0] = triangle.v1_.x_; dest[1] = triangle.v1_.y_; dest[2] = triangle.v1_.z_; ((unsigned&)dest[3]) = triangle.color_; dest[4] = triangle.v2_.x_; dest[5] = triangle.v2_.y_; dest[6] = triangle.v2_.z_; ((unsigned&)dest[7]) = triangle.color_; dest[8] = triangle.v3_.x_; dest[9] = triangle.v3_.y_; dest[10] = triangle.v3_.z_; ((unsigned&)dest[11]) = triangle.color_; dest += 12; } for (unsigned i = 0; i < noDepthTriangles_.Size(); ++i) { const DebugTriangle& triangle = noDepthTriangles_[i]; dest[0] = triangle.v1_.x_; dest[1] = triangle.v1_.y_; dest[2] = triangle.v1_.z_; ((unsigned&)dest[3]) = triangle.color_; dest[4] = triangle.v2_.x_; dest[5] = triangle.v2_.y_; dest[6] = triangle.v2_.z_; ((unsigned&)dest[7]) = triangle.color_; dest[8] = triangle.v3_.x_; dest[9] = triangle.v3_.y_; dest[10] = triangle.v3_.z_; ((unsigned&)dest[11]) = triangle.color_; dest += 12; } vertexBuffer_->Unlock(); graphics->SetBlendMode(lineAntiAlias_ ? BLEND_ALPHA : BLEND_REPLACE); graphics->SetColorWrite(true); graphics->SetCullMode(CULL_NONE); graphics->SetDepthWrite(true); graphics->SetLineAntiAlias(lineAntiAlias_); graphics->SetScissorTest(false); graphics->SetStencilTest(false); graphics->SetShaders(vs, ps); graphics->SetShaderParameter(VSP_MODEL, Matrix3x4::IDENTITY); graphics->SetShaderParameter(VSP_VIEW, view_); graphics->SetShaderParameter(VSP_VIEWINV, view_.Inverse()); graphics->SetShaderParameter(VSP_VIEWPROJ, gpuProjection_ * view_); graphics->SetShaderParameter(PSP_MATDIFFCOLOR, Color(1.0f, 1.0f, 1.0f, 1.0f)); graphics->SetVertexBuffer(vertexBuffer_); unsigned start = 0; unsigned count = 0; if (lines_.Size()) { count = lines_.Size() * 2; graphics->SetDepthTest(CMP_LESSEQUAL); graphics->Draw(LINE_LIST, start, count); start += count; } if (noDepthLines_.Size()) { count = noDepthLines_.Size() * 2; graphics->SetDepthTest(CMP_ALWAYS); graphics->Draw(LINE_LIST, start, count); start += count; } graphics->SetBlendMode(BLEND_ALPHA); if (triangles_.Size()) { count = triangles_.Size() * 3; graphics->SetDepthTest(CMP_LESSEQUAL); graphics->Draw(TRIANGLE_LIST, start, count); start += count; } if (noDepthTriangles_.Size()) { count = noDepthTriangles_.Size() * 3; graphics->SetDepthTest(CMP_ALWAYS); graphics->Draw(TRIANGLE_LIST, start, count); } graphics->SetLineAntiAlias(false); }
void ReImagePanel::Tick( qreal _delta ) { bool isDirty = false; // Update item positioning. TItemListItor itor = m_itemList.begin(); TItemListItor itorEnd = m_itemList.end(); for( ; itor != itorEnd; ++itor ) { ReImageItem* item = *itor; if( NULL != item ) { static qreal sXSpeed = 200.0f; static qreal sYSpeed = 200.0f; int x = item->m_pos.x(); int newX = item->m_newPos.x(); int y = item->m_pos.y(); int newY = item->m_newPos.y(); if( x != newX ) { bool sign = x < newX; x += sign ? 10 : -10; if( sign != ( x < newX ) ) x = newX; item->m_pos.setX( x ); isDirty = true; } if( y != newY ) { bool sign = y < newY; y += sign ? 10 : -10; if( sign != ( y < newY ) ) y = newY; item->m_pos.setY( y ); isDirty = true; } } } // Rect enveloping. if( HasContent() && !IsDragging() ) { int newViewportOriginX = m_contentOrigin.x(); int newViewportOriginY = m_contentOrigin.y(); QSize bv = GetBv(); if( ReRectEnveloper::sTick( newViewportOriginX, newViewportOriginY, m_contentOrigin.x(), m_contentOrigin.y(), bv.width(), bv.height(), 0, 0, width(), height(), ReRectEnveloper::EAlign_MiddleH ) ) { m_contentOrigin.setX( newViewportOriginX ); m_contentOrigin.setY( newViewportOriginY ); isDirty = true; } } if( isDirty ) update(); }