Пример #1
0
	// Called whenever the in-browser window changes size.
	virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip) {

		if (position.size().width() == width &&
			position.size().height() == height)
			return;  // Size didn't change, no need to update anything.

		if (opengl_context_ == NULL) {
			opengl_context_.reset(new OpenGLContext(this));
		};
		opengl_context_->InvalidateContext(this);
		opengl_context_->ResizeContext(position.size());
		if (!opengl_context_->MakeContextCurrent(this))
			return;

		width = position.size().width();
		height = position.size().height();
		// init gl here?
		OS::VideoMode vm;
		vm.width = width;
		vm.height = height;
		vm.resizable = false;
		vm.fullscreen = true;
		OS::get_singleton()->set_video_mode(vm, 0);

		DrawSelf();
	};
Пример #2
0
void GuiElement::Draw()
{
	DrawSelf();
	for (ChildList::iterator it = children.begin(); it != children.end(); ++it)
	{
		(*it)->Draw();
	}
}
Пример #3
0
void
LGAMiniArrowPopup::DeactivateSelf ()
{

	if ( FocusDraw ())
		DrawSelf ();
				
}	//	LGAMiniArrowPopup::DeactivateSelf
Пример #4
0
/** Draw this UI element. In practice this means recursively drawing all its child items too.*/
void CGUIbase::Draw() {
	if (!visible)
		return;
	if (needsUpdate)
		updateAppearance();
	
	UIrect* parentClipbox = &parent->Clipbox;
	pDrawFuncs->setClip(Clipbox);

	DrawSelf(); 
	//then draw each subcontrol
	for (size_t i=0;i<Control.size();i++) 
		Control[i]->Draw();
}
Пример #5
0
void AwtMenuItem::DrawItem(DRAWITEMSTRUCT& drawInfo)
{
    DASSERT(drawInfo.CtlType == ODT_MENU);

    if (drawInfo.itemID != m_Id)
        return;

    /* Fixed bug 4349969. Since the problem occurs on Windows 98 and not on
       Windows NT, the fix is to check for Windows 95/98 and to check if the
       handle to the menu of the item to be drawn is the same as the handle to the
       menu of the menu object. If they're not the same, just return and don't do
       the drawing.
    */
    if ( IS_WIN95 && drawInfo.hwndItem != (HWND)this->m_menuContainer->GetHMenu()) {
        return;
    } else
        DrawSelf(drawInfo);
}
Пример #6
0
void CUIContainer::Draw( CGraphics* pGraphic )
{
	DrawSelf(pGraphic);
	CBound clip = pGraphic->GetClipBound();
	for (unsigned int i = mChilds.size(); i ; i--)
	{
		if(mChilds[i-1]->Visible())
		{
			CBound bdchild = mChilds[i-1]->Bound();
			Absolute(bdchild);
			if(CBound::Intersect(clip,bdchild,bdchild))
			{
				pGraphic->SetClipBound(bdchild);
				mChilds[i-1]->Draw(pGraphic);
			}
		}
	}
	pGraphic->SetClipBound(clip);
}
Пример #7
0
void MythUIType::Draw(MythPainter *p, int xoffset, int yoffset, int alphaMod,
                      QRect clipRect)
{
    m_DirtyRegion = QRegion(QRect(0, 0, 0, 0));

    if (!m_Visible || m_Vanished)
        return;

    QRect realArea = m_Area.toQRect();
    realArea.translate(xoffset, yoffset);

    if (!realArea.intersects(clipRect))
        return;

    DrawSelf(p, xoffset, yoffset, alphaMod, clipRect);

    QList<MythUIType *>::Iterator it;

    for (it = m_ChildrenList.begin(); it != m_ChildrenList.end(); ++it)
    {
        (*it)->Draw(p, xoffset + m_Area.x(), yoffset + m_Area.y(),
                    CalcAlpha(alphaMod), clipRect);
    }

    if (p->ShowBorders())
    {
        static const QBrush nullbrush(Qt::NoBrush);
        p->DrawRect(realArea, nullbrush, QPen(m_BorderColor), 255);

        if (p->ShowTypeNames())
        {
            MythFontProperties font;
            font.SetFace(QFont("Droid Sans"));
            font.SetColor(m_BorderColor);
            font.SetPointSize(8);
            p->DrawText(realArea, objectName(), 0, font, 255, realArea);
        }
    }
}
Пример #8
0
void MythUIType::Draw(MythPainter *p, int xoffset, int yoffset, int alphaMod,
                      QRect clipRect)
{
    m_DirtyRegion = QRegion(QRect(0,0,0,0));

    if (!m_Visible)
        return;

    QRect realArea = m_Area.toQRect();
    realArea.translate(xoffset, yoffset);

    if (!realArea.intersects(clipRect))
        return;

    DrawSelf(p, xoffset, yoffset, alphaMod, clipRect);

    QList<MythUIType *>::Iterator it;
    for (it = m_ChildrenList.begin(); it != m_ChildrenList.end(); ++it)
    {
        (*it)->Draw(p, xoffset + m_Area.x(), yoffset + m_Area.y(),
                    CalcAlpha(alphaMod), clipRect);
    }
}
Пример #9
0
void
RSSourceStatusButton::StatusBlink()
{

	// Validate pointers.

	ValidateThis_();

	// Force redraw first.

	Draw(nil);
	
	// Now blink the framerect three times.
	
	Rect frame;
	CalcLocalFrameRect(frame);
	::InsetRect(&frame, 1, 1);
	
#if PP_Target_Carbon
	SInt16 menuFlash = 3 << 1;
#else
	SInt16 menuFlash = LMGetMenuFlash() << 1;			//* 2.2d9: BUG FIX #592: flash to match menu blink
#endif
	if (menuFlash < 2)
		menuFlash = 2;

	for (SInt16 i = 0; i < menuFlash; i++) {
		UInt32 junk;
		::InvertRect(&frame);
		::Delay(3, &junk);
	}
	
	// Make sure it looks right again.
	
	DrawSelf();

}
Пример #10
0
void CHudTexture::DrawSelf(int x, int y, const Color& clr) const
{
    DrawSelf(x, y, Width(), Height(), clr);
}
Пример #11
0
//+---------------------------------------------------------------------------
//
//  Member:     CDispRoot::DrawRoot
//
//  Synopsis:   Draw this display tree.
//
//  Arguments:  pContext        draw context
//              pClientData     client data used by clients in DrawClient
//              hrgnDraw        region to draw in destination coordinates
//              prcDraw         rect to draw in destination coordinates
//
//  Notes:      if hrgnDraw and prcDraw are both NULL, the bounding rect of
//              this root node is used
//
//----------------------------------------------------------------------------
void CDispRoot::DrawRoot(
        CDispDrawContext* pContext,
        void* pClientData,
        HRGN hrgnDraw,
        const RECT* prcDraw)
{
    // BUGBUG (donmarsh) - for now we must use this root's own context, due
    // to the context stack used for drawing.  Eventually, we should eliminate
    // the context pointer argument to DrawRoot.
    Assert(pContext == &_drawContext);
    AssertSz(!_fDrawLock, "Illegal call to DrawRoot inside Draw()");
    AssertSz(_cOpen==0, "DrawRoot called while Display Tree is open");
    Assert(_pRenderSurface != NULL);
    Assert(!IsSet(CDispFlags::s_interiorFlagsNotSetInDraw));

    // set redraw region (will become a rect if possible)
    CRegion rgnRedraw;
    if(hrgnDraw != NULL)
    {
        rgnRedraw = hrgnDraw;
    }
    else if(prcDraw != NULL)
    {
        rgnRedraw = *prcDraw;
    }
    else
    {
        rgnRedraw = _rcContainer;
    }
    
    // check for early exit conditions
    if(!rgnRedraw.Intersects(_rcContainer))
	{
		return;
	}

    // set initial context values
    pContext->SetClientData(pClientData);
    pContext->SetNoClip();
    pContext->_offset = _rcContainer.TopLeft().AsSize();
    pContext->_pFirstDrawNode = NULL;
    pContext->SetRedrawRegion(&rgnRedraw);

    // BUGBUG (donmarsh) -- this is a little ugly, but our the _rcVisBounds
    // for CDispRoot must be zero-based, because it is transformed by the
    // offset in CDispNode::Draw, and if _rcVisBounds == _rcContainer like
    // one would expect, _rcVisBounds gets transformed twice.
    _rcVisBounds.MoveToOrigin();

    if(_pFirstChildNode == NULL)
    {
        pContext->SetDispSurface(_pRenderSurface);
        _pRenderSurface->SetBandOffset(_afxGlobalData._Zero.size);
        CRect rcClip;
        rgnRedraw.GetBounds(&rcClip);
        CRegion rgnClip(rcClip);
        _pRenderSurface->SetClipRgn(&rgnClip);

        DrawSelf(pContext, NULL);

        _pRenderSurface->SetClipRgn(NULL);
        ::SelectClipRgn(_pRenderSurface->GetRawDC(), NULL);
        goto Cleanup;
    }
    
    // DrawRoot does not allow recursion
    _fDrawLock = TRUE;

    // speed optimization: draw border and scroll bars for first node
    // without buffering or banding, then subtract them from the redraw
    // region.
	if(_pFirstChildNode==_pLastChildNode &&
		_pFirstChildNode->IsContainer() &&
		_pFirstChildNode->IsVisible())
	{
        CDispContainer* pContainer = DYNCAST(CDispContainer, _pFirstChildNode);
        pContext->SetDispSurface(_pRenderSurface);
        _pRenderSurface->SetBandOffset(_afxGlobalData._Zero.size);
        CRect rcClip;
        rgnRedraw.GetBounds(&rcClip);
        CRegion rgnClip(rcClip);
        _pRenderSurface->SetClipRgn(&rgnClip);

        pContainer->DrawBorderAndScrollbars(pContext, &_rcContent);
        _rcContent.OffsetRect(_rcContainer.TopLeft().AsSize());
        _pRenderSurface->SetClipRgn(NULL);

        // restore clipping on destination surface to redraw region
        // (this is important when we're using filters and we have a
        // direct draw surface)
        if(rgnRedraw.IsComplex())
        {
            ::SelectClipRgn(_pRenderSurface->GetRawDC(), rgnRedraw.GetRegionAlias());
        }
        else
        {
            HRGN hrgnClip = ::CreateRectRgnIndirect(&rgnRedraw.AsRect());
            ::SelectClipRgn(_pRenderSurface->GetRawDC(), hrgnClip);
            ::DeleteObject(hrgnClip);
        }
        
        rgnRedraw.Intersect(_rcContent);
        // early exit if all we needed to draw was the border and scroll bars
        if(rgnRedraw.IsEmpty())
		{
			goto Cleanup;
		}
    }
    else
    {
        _rcContent = _rcContainer;
    }

    // early exit if all we needed to draw was the border and scroll bars
    if(!_rcContent.IsEmpty())
    {
        // try to allocate offscreen buffer
        BOOL fOffscreen = SetupOffscreenBuffer(pContext);
        Assert(!fOffscreen || _pOffscreenBuffer);

        // allocate stacks for redraw regions and context values
        CRegionStack redrawRegionStack;
        pContext->SetRedrawRegionStack(&redrawRegionStack);
        CDispContextStack contextStack;
        pContext->SetContextStack(&contextStack);

        // PreDraw pass processes the tree from highest layer to lowest,
        // culling layers beneath opaque layers, and identifying the lowest
        // opaque layer which needs to be rendered during the Draw pass
        PreDraw(pContext);
        
        // if we didn't consume the redraw region, we'll have to start rendering
        // from the root
        if(!pContext->GetRedrawRegion()->IsEmpty())
        {
            pContext->_pFirstDrawNode = this;
            redrawRegionStack.PushRegionForRoot(pContext->GetRedrawRegion(), this, _rcContainer);
            contextStack.Init();
        }
        else
        {
            Assert(pContext->_pFirstDrawNode != NULL);
            AssertSz(redrawRegionStack.MoreToPop(), "Mysterious redraw region stack bug!");
            delete pContext->GetRedrawRegion();
            contextStack.Restore();
        }

        if(!fOffscreen)
        {
            _pRenderSurface->SetBandOffset(_afxGlobalData._Zero.size);
            DrawEntire(pContext);
        }
        else if(_pOffscreenBuffer->Height() >= _rcContent.Height())
        {
            _pOffscreenBuffer->SetBandOffset(_rcContent.TopLeft().AsSize());
            DrawEntire(pContext);
            _pOffscreenBuffer->Draw(_pRenderSurface, _rcContent);
        }
        else
        {
            DrawBands(pContext, &rgnRedraw, redrawRegionStack);
        }
    
        pContext->SetClientData(NULL);

        // clear redraw region trails
        redrawRegionStack.Restore();
        for(;;)
        {
            CDispNode* pOpaqueNode = (CDispNode*)redrawRegionStack.PopKey();
            if(pOpaqueNode == NULL)
			{
				break;
			}
            pOpaqueNode->ClearFlagToRoot(CDispFlags::s_savedRedrawRegion);
        }
    
        // delete all regions except the first
        redrawRegionStack.DeleteStack(&rgnRedraw);
    }

Cleanup:
    // BUGBUG (donmarsh) -- restore _rcVisBounds to coincide with _rcContainer
    _rcVisBounds = _rcContainer;

    _fDrawLock = FALSE;
}
Пример #12
0
//+---------------------------------------------------------------------------
//
//  Member:     CDispRoot::EraseBackground
//              
//  Synopsis:   Quickly draw border and background.
//              
//  Arguments:  pContext        draw context
//              pClientData     client data used by clients in DrawClient
//              hrgnDraw        region to draw in destination coordinates
//              prcDraw         rect to draw in destination coordinates
//
//  Notes:      if hrgnDraw and prcDraw are both NULL, the bounding rect of
//              this root node is used
//              
//----------------------------------------------------------------------------
void CDispRoot::EraseBackground(
        CDispDrawContext* pContext,
        void* pClientData,
        HRGN hrgnDraw,
        const RECT* prcDraw)
{
    // BUGBUG (donmarsh) - EraseBackground can be called while we are recalcing
    // the display tree!  For example, CSelectLayout::HandleViewChange changes
    // the clip region of child windows, which causes an immediate
    // call to EraseBackground.  This is messy, because we could stomp on
    // values in pContext that are in use by the recalc code.  Therefore, we
    // ignore these calls.  If the following Assert fires, you should look
    // at the stack and protect the operation that called it with
    // CServer::CLock lock(Doc(), SERVERLOCK_IGNOREERASEBKGND);
    AssertSz(!_fDrawLock, "EraseBackground called during drawing");
// BUGBUG (donmarsh) -- temporarily disable this assert to help 5.0 stress numbers
//    AssertSz(!_fRecalcLock, "EraseBackground called during recalc");
    if(_fDrawLock || _fRecalcLock)
	{
		return;
	}

    // BUGBUG (donmarsh) - for now we must use this root's own context, due
    // to the context stack used for drawing.  Eventually, we should eliminate
    // the context pointer argument to DrawRoot.
    Assert(pContext == &_drawContext);
    AssertSz(!_fDrawLock, "Illegal call to EraseBackground inside Draw()");
    Assert(_pRenderSurface != NULL);

    // set redraw region (will become a rect if possible)
    CRegion rgnRedraw;
    if(hrgnDraw != NULL)
    {
        rgnRedraw = hrgnDraw;
    }
    else if(prcDraw != NULL)
    {
        rgnRedraw = *prcDraw;
    }
    else
    {
        rgnRedraw = _rcContainer;
    }
    
    // check for early exit conditions
    if(!rgnRedraw.Intersects(_rcContainer))
	{
		return;
	}

    // set initial context values
    pContext->SetClientData(pClientData);
    pContext->_offset = _rcContainer.TopLeft().AsSize();
    pContext->_pFirstDrawNode = NULL;
    pContext->SetRedrawRegion(&rgnRedraw);
    pContext->SetDispSurface(_pRenderSurface);
    _pRenderSurface->SetBandOffset(_afxGlobalData._Zero.size);

    // BUGBUG (donmarsh) - To address bug 62008 (erase background for HTML Help
    // control), we need to disable clipping in CDispSurface::GetDC.  Ideally,
    // CDispSurface should allow us to have a NULL _prgnClip, but that is
    // currently not the case.
    CRegion rgnClip(-15000, -15000, 15000, 15000);

    _pRenderSurface->SetClipRgn(&rgnClip);
    
    if(_pFirstChildNode == NULL)
    {
        DrawSelf(pContext, NULL);
    }
    else if(_pFirstChildNode->IsScroller())
    {
        CDispScroller* pScroller = DYNCAST(CDispScroller, _pFirstChildNode);
        CDispExtras* pExtras = pScroller->GetExtras();
        CDispInfo di(pExtras);
        pScroller->CalcDispInfo(_rcContainer, &di);
        
        // draw root background if scroller isn't opaque or doesn't have a background
        if(!pScroller->IsOpaque() || !pScroller->HasBackground())
        {
            Assert(HasBackground());
            CRect rcBackground(_rcContainer.Size());
            CRect rcBackgroundClip(rcBackground);
            pContext->IntersectRedrawRegion(&rcBackgroundClip);
            if(!rcBackgroundClip.IsEmpty())
            {
                _pDispClient->DrawClientBackground(
                    &rcBackground,
                    &rcBackgroundClip,
                    pContext->GetDispSurface(),
                    this,
                    pContext->GetClientData(),
                    0);
            }
        }
        else
        {
            pScroller->DrawBackground(pContext, &di);
        }
        
        // draw scroller's border if it has one
        if(pScroller->HasBorder(pExtras))
        {
            pScroller->DrawBorder(pContext, &di);
        }
    }
    
    _pRenderSurface->SetClipRgn(NULL);
    ::SelectClipRgn(_pRenderSurface->GetRawDC(), NULL);
}