void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf & sAppStream,const CPDF_Point & ptOffset) { if (IsVisible() && m_bFlash) { CFX_ByteTextBuf sCaret; CPDF_Rect rcRect = GetCaretRect(); CPDF_Rect rcClip = GetClipRect(); rcRect = CPWL_Utils::OffsetRect(rcRect,ptOffset.x,ptOffset.y); rcClip = CPWL_Utils::OffsetRect(rcClip,ptOffset.x,ptOffset.y); sCaret << "q\n"; if (!rcClip.IsEmpty()) { sCaret << rcClip.left << " " << rcClip.bottom + 2.5f << " " << rcClip.right - rcClip.left << " " << rcClip.top - rcClip.bottom - 4.5f << " re W n\n"; } sCaret << m_fWidth << " w\n0 G\n"; sCaret << rcRect.left + m_fWidth/2 << " " << rcRect.bottom << " m\n"; sCaret << rcRect.left + m_fWidth/2 << " " << rcRect.top << " l S\nQ\n"; sAppStream << sCaret; } }
// **************************************************************************** // // Function Name: RGpDrawingSurface::IntersectClipRect( ) // // Description: Sets a new clip rect that is the interesection of the // current clip rect and the given clip rect // // Returns: Nothing // // Exceptions: None // // **************************************************************************** // void RGpDrawingSurface::IntersectClipRect( const RIntRect& newRect ) { RIntRect clipRect = GetClipRect(); clipRect.Intersect( clipRect, newRect ); SetClipRect( clipRect ); }
void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) { if (IsVisible() && m_bFlash) { CFX_FloatRect rcRect = GetCaretRect(); CFX_FloatRect rcClip = GetClipRect(); CFX_PathData path; path.SetPointCount(2); FX_FLOAT fCaretX = rcRect.left + m_fWidth * 0.5f; FX_FLOAT fCaretTop = rcRect.top; FX_FLOAT fCaretBottom = rcRect.bottom; if (!rcClip.IsEmpty()) { rcRect.Intersect(rcClip); if (!rcRect.IsEmpty()) { fCaretTop = rcRect.top; fCaretBottom = rcRect.bottom; path.SetPoint(0, fCaretX, fCaretBottom, FXPT_MOVETO); path.SetPoint(1, fCaretX, fCaretTop, FXPT_LINETO); } else { return; } } else { path.SetPoint(0, fCaretX, fCaretBottom, FXPT_MOVETO); path.SetPoint(1, fCaretX, fCaretTop, FXPT_LINETO); } CFX_GraphStateData gsd; gsd.m_LineWidth = m_fWidth; pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255, 0, 0, 0), FXFILL_ALTERNATE); } }
// NB: eventually these methods will be defined unconditionally, and // can be moved into Layers.h const nsIntRect* Layer::GetEffectiveClipRect() { if (ShadowLayer* shadow = AsShadowLayer()) { return shadow->GetShadowClipRect(); } return GetClipRect(); }
// **************************************************************************** // // Function Name: RGpDrawingSurface::IntersectClipVectorRect( ) // // Description: Sets a new clip rect that is the interesection of the // current clip rect and the given clip vector rect // // Returns: Nothing // // Exceptions: None // // **************************************************************************** // void RGpDrawingSurface::IntersectClipVectorRect( const RIntVectorRect& vectRect ) { RIntRect clipRect = GetClipRect(); RIntRect newRect = vectRect.m_TransformedBoundingRect; clipRect.Intersect( clipRect, newRect ); SetClipRect( clipRect ); }
// NB: eventually these methods will be defined unconditionally, and // can be moved into Layers.h const nsIntRect* Layer::GetEffectiveClipRect() { if (LayerComposite* shadow = AsLayerComposite()) { return shadow->GetShadowClipRect(); } return GetClipRect(); }
void Window::DrawBack( const Rect &rect ) { const static Image bg( view->GetSystemIcons(), 0, 34, 30, 30 ); Rect clip; FillPattern( rect, bg, 0, 0 ); GetClipRect( clip ); SetClipRect( rect ); DrawBox( Rect(0, 0, w, h), BOX_RAISED ); SetClipRect( clip ); }
// ----------------------------------------------------------------------- // // // ROUTINE: CLTWnd::PtInWnd // // PURPOSE: Tests a point in a window // // NOTE: The window needs to be visible, but not necessarily enabled // // ----------------------------------------------------------------------- // BOOL CLTWnd::PtInWnd(int x, int y) { // Translate the rectangle to screen coordinates if(!m_bVisible || !m_bEnabled) return FALSE; CRect rc; GetClipRect(&rc); return(PtInRect(&rc,x,y)); }
// ----------------------------------------------------------------------- // // // ROUTINE: CLTWnd::DrawToSurface // // PURPOSE: Does the dirty work for drawing a single window to a surface // // ----------------------------------------------------------------------- // BOOL CLTWnd::DrawToSurface(HSURFACE hSurfDest) { // We don't draw the main window (the only one without a parent) if (m_pParentWnd) { CRect rcSurf; GetSurfaceRect(&rcSurf); CRect rcClip; GetClipRect(&rcClip); CRect rcSource; // check for intersection of the clip area and the surface if (rcSource.IntersectRect(rcSurf, rcClip)) { // retain the absolute coordinates of the intersection relative to the main drawing window CPoint ptIntersect = rcSource.TopLeft(); // normalize coordinates relative to child surface rcSource -= rcSurf.TopLeft(); // create a lithtech-compatible rect LTRect drcSource; drcSource.left = rcSource.left; drcSource.top = rcSource.top; drcSource.right = rcSource.right; drcSource.bottom = rcSource.bottom; // draw the surface if (m_hSurf) { if (IsFlagSet(LTWF_TRANSPARENT)) { if(g_pLTClient->DrawSurfaceToSurfaceTransparent(hSurfDest,m_hSurf, &drcSource, ptIntersect.x, ptIntersect.y, m_hColorTransparent) != LT_OK) return FALSE; } else { if(g_pLTClient->DrawSurfaceToSurface(hSurfDest, m_hSurf, &drcSource, ptIntersect.x, ptIntersect.y) != LT_OK) return FALSE; } } } } return TRUE; }
bool CStdGL::UpdateClipper() { // no render target? do nothing if (!RenderTarget || !Active) return true; // negative/zero? C4Rect clipRect = GetClipRect(); if (clipRect.Wdt<=0 || clipRect.Hgt<=0) { ClipAll=true; return true; } ClipAll=false; // set it glViewport(clipRect.x, RenderTarget->Hgt-clipRect.y-clipRect.Hgt, clipRect.Wdt, clipRect.Hgt); ProjectionMatrix = StdProjectionMatrix::Orthographic(clipRect.x, clipRect.x + clipRect.Wdt, clipRect.y + clipRect.Hgt, clipRect.y); return true; }
void DisplayElement::InvalidateChild (DisplayElement *pChild, WebRect *pDirty) { WebRect dirty; dirty.Set(pDirty); dirty.Shift(mRect.left, mRect.top); if (GetOverflow() == DISPLAY_OVERFLOW_HIDDEN) { WebRect clipRect; GetClipRect(&clipRect); // If completely outside clipping rect, stop here if (!dirty.Overlaps(&clipRect)) { return; } // clip pDirty to our rect dirty.And(&clipRect); } if ((mFlags & DISPLAY_FLAG_FIXED_POS) || !mpParent) { DisplayManager *pManager = GetManager(); if (pManager) { if (mFlags & DISPLAY_FLAG_FIXED_POS) { dirty.Shift(pManager->mViewRect.left, pManager->mViewRect.top); } pManager->InvalidateViewportRegion(&dirty); } } else { mpParent->InvalidateChild(this, &dirty); } }
void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) { if (IsValid()) { CFX_FloatRect rcRefresh = pRect ? *pRect : GetWindowRect(); if (!HasFlag(PWS_NOREFRESHCLIP)) { CFX_FloatRect rcClip = GetClipRect(); if (!rcClip.IsEmpty()) { rcRefresh.Intersect(rcClip); } } FX_RECT rcWin = PWLtoWnd(rcRefresh); rcWin.left -= PWL_INVALIDATE_INFLATE; rcWin.top -= PWL_INVALIDATE_INFLATE; rcWin.right += PWL_INVALIDATE_INFLATE; rcWin.bottom += PWL_INVALIDATE_INFLATE; if (CFX_SystemHandler* pSH = GetSystemHandler()) { if (FX_HWND hWnd = GetAttachedHWnd()) { pSH->InvalidateRect(hWnd, rcWin); } } } }
/* Generate grid ---------------------------------------------------------------------------------*/ void TableSkin::ThinkGrid( PointList& points, RectList& rects, const Pos &p ) { Tiler tiler( points, rects, p); tiler.SetClipRect( GetClipRect() ); // TOP/LEFT DIVIDERS // BOTTOM/RIGHT DIVIDERS // DIVIDERS int i, n = _x_dividers.Size(); int j, m = _y_dividers.Size(); if ( Exists(BODY+VDIV) ) for( i=1; i<n-1; ++i ) { int begin = (_x_dividers[i-1] + _x_dividers[i])/2; int end = (_x_dividers[i] + _x_dividers[i+1])/2; int shift = _x_dividers[i] - (end+begin-1)/2; Rect top_bound = Rect( begin, _rLU.GetY1(), end-begin, _rLU.GetH() ); Rect mid_bound = Rect( begin, _rLU.GetY2(), end-begin, _rLD.GetY1()-_rLU.GetY2()); Rect btm_bound = Rect( begin, _rLD.GetY1(), end-begin, _rLD.GetH() ); tiler.Orient(VERTICAL); if ( Exists(HEAD+VDIV) ) { IGraphics &g = ImageDicer::GetImage(HEAD+VDIV); tiler.RectCut( g.GetRect(), top_bound, Tiler::HALIGNCENTER|Tiler::VALIGNTOP, shift ); } IGraphics &g = ImageDicer::GetImage(BODY+VDIV); tiler.RectFill1D( g.GetRect(), mid_bound, Tiler::HALIGNCENTER, shift ); if ( Exists(TAIL+VDIV) ) { IGraphics &g = ImageDicer::GetImage(TAIL+VDIV); tiler.RectCut( g.GetRect(), btm_bound, Tiler::HALIGNCENTER|Tiler::VALIGNBOTTOM, shift ); } } if ( Exists(BODY+HDIV) ) for( j=1; j<m-1; ++j ) { int begin = (_y_dividers[j-1] + _y_dividers[j])/2; int end = (_y_dividers[j] + _y_dividers[j+1])/2; int shift = _y_dividers[j] - (end+begin-1)/2; Rect top_bound = Rect( _rLU.GetX1(), begin, _rLU.GetW(), end-begin ); Rect mid_bound = Rect( _rLU.GetX2(), begin, _rRU.GetX1()-_rLU.GetX2(), end-begin); Rect btm_bound = Rect( _rRU.GetX1(), begin, _rRU.GetW(), end-begin ); tiler.Orient(HORIZONTAL); if ( Exists(HEAD+HDIV) ) { IGraphics &g = ImageDicer::GetImage(HEAD+HDIV); tiler.RectCut( g.GetRect(), top_bound, Tiler::VALIGNCENTER|Tiler::HALIGNLEFT, shift ); } IGraphics &g = ImageDicer::GetImage(BODY+HDIV); tiler.RectFill1D( g.GetRect(), mid_bound, Tiler::VALIGNCENTER, shift ); if ( Exists(TAIL+HDIV) ) { IGraphics &g = ImageDicer::GetImage(TAIL+HDIV); tiler.RectCut( g.GetRect(), btm_bound, Tiler::VALIGNCENTER|Tiler::HALIGNRIGHT, shift ); } } if ( Exists(CROSSING) ) { for( i=1; i<n-1; ++i) for( j=1; j<m-1; ++j) { int xb = (_x_dividers[i-1] + _x_dividers[i])/2; int yb = (_y_dividers[j-1] + _y_dividers[j])/2; int xe = (_x_dividers[i+1] + _x_dividers[i])/2; int ye = (_y_dividers[j+1] + _y_dividers[j])/2; int xs = _x_dividers[i] - (xe+xb-1)/2; int ys = _y_dividers[j] - (ye+yb-1)/2; Rect r = Rect( xb, yb, xe-xb, ye-yb ); IGraphics &g = ImageDicer::GetImage(CROSSING); tiler.Orient(VERTICAL); tiler.RectCut( g.GetRect(), r, Tiler::VALIGNCENTER|Tiler::HALIGNCENTER, xs, ys); } } }
const nsIntRect* Layer::GetEffectiveClipRect() { return GetClipRect(); }
// x,y are in same coordinate space as this->mRect; viewX, viewY is the upper left corner of the viewport in // the coordinate space of this->mRect DisplayElement *DisplayElement::TrapEventPoint (DISPLAY_INT x, DISPLAY_INT y, DISPLAY_INT viewX, DISPLAY_INT viewY) { // if we clip our children to our rect, and the point is outside our rect, // then fail right away if (GetOverflow() == DISPLAY_OVERFLOW_HIDDEN) { WebRect clipRect; GetClipRect(&clipRect); if (!clipRect.Contains(x,y)) { return (0); } } DisplayElement *pChild = mpLastChild, *pFound; // now search positive-z children in reverse order while (pChild && (pChild->GetZIndex() >= 0)) { if (pChild->mFlags & DISPLAY_FLAG_FIXED_POS) { pFound = pChild->TrapEventPoint(x - (mRect.left + viewX), y - (mRect.top + viewY), -mRect.left, -mRect.top); } else { pFound = pChild->TrapEventPoint(x - mRect.left, y - mRect.top, viewX - mRect.left, viewY - mRect.top); } if (pFound) { return (pFound); } pChild = pChild->mpPrev; } // if we contain the point, trap it if (TrapEventInThis(x,y)) { return (this); } // now search negative-z children in reverse order while (pChild) { if (pChild->mFlags & DISPLAY_FLAG_FIXED_POS) { pFound = pChild->TrapEventPoint(x - (mRect.left + viewX), y - (mRect.top + viewY), -mRect.left, -mRect.top); } else { pFound = pChild->TrapEventPoint(x - mRect.left, y - mRect.top, viewX - mRect.left, viewY - mRect.top); } if (pFound) { return (pFound); } pChild = pChild->mpPrev; } return (0); }
void CProgressBar::DoRender() { super::DoRender(); CTextureFrag* pFrag = m_fragForeGround.GetTextureFrag(); if (pFrag && pFrag->Texture()) { CWindowManager::GetInstance()->RenderTextureControl( pFrag, IsGrid9Scale(), GetGrid9ScaleOffset(), &m_foreQuadp, &m_foreQuadt, GetColor( m_bUseInheritColorScale ), IsClip(), !IsEnable(), GetClipRect(), &GetWorldTM() ); } }
void DisplayElement::Draw (DISPLAY_INT iScreenX, DISPLAY_INT iScreenY, WebRect *pViewport, WebGraphics *pGC) { DisplayElement *pChild = mpFirstChild; WebRect clip, saveClip, screenClip; WEBC_BOOL clipRestore = WEBC_FALSE; pGC->GetClip(&saveClip); clip.Set(&saveClip); if (GetOverflow() != DISPLAY_OVERFLOW_VISIBLE) //if (GetOverflow() == DISPLAY_OVERFLOW_HIDDEN) { GetClipRect(&screenClip); screenClip.Shift(iScreenX - mRect.left, iScreenY - mRect.top); if (!clip.Overlaps(&screenClip)) { // we're not visible, so neither are our children return; } clip.And(&screenClip); pGC->SetClip(&clip); clipRestore = WEBC_TRUE; } WebRect screenRect(mRect); screenRect.MoveTo(iScreenX, iScreenY); mScreenRect = screenRect; // April2013 - save the screenrect of last known draw and subtract boundaries of the display manager screenrect DisplayManager*pManager= this->GetManager(); if (pManager && pManager->mBrowser) pManager=pManager->mBrowser->GetDisplayManager(); if (pManager) { WebRect r; // printf("Not working all the way \n"); r=pManager->mScreenRect; mScreenRect.top -= r.top; mScreenRect.bottom -= r.top; mScreenRect.left -= r.left; mScreenRect.right -= r.left; } // April2013 - end save the screenrect of last known draw and subtract boundaries of the display manager screenrect // Start drawing // pGC->StartBuffer(); // Draw negative-z children while (pChild && (pChild->GetZIndex() < 0)) { if (pChild->mFlags & DISPLAY_FLAG_FIXED_POS) { pChild->Draw(pViewport->left + pChild->mRect.left, pViewport->top + pChild->mRect.top, pViewport, pGC); } else { pChild->Draw(iScreenX + pChild->mRect.left, iScreenY + pChild->mRect.top, pViewport, pGC); } pChild = pChild->mpNext; } // if I am visible if (screenRect.Overlaps(&clip)) { // Draw myself DrawThisOnly(iScreenX, iScreenY, pGC); } #if (INCLUDE_EXPERIMENTAL_DIV_SCROLLBARS) int xContentOffset=0; int yContentOffset=0; if (clipRestore && vScrollWidth() || hScrollWidth()) { WebRect contentClip; contentClip.Set(&clip); contentClip.SetHeight(contentClip.Height()-hScrollWidth()); contentClip.SetWidth(contentClip.Width()-vScrollWidth()); pGC->SetClip(&contentClip); if (GetHScroll()) { WebHScroll *pScroll = (WebHScroll *)GetHScroll(); xContentOffset=pScroll->GetPosition(); } if (GetVScroll()) { WebVScroll *pScroll = (WebVScroll *)GetVScroll(); yContentOffset=pScroll->GetPosition(); if (yContentOffset) { // If we have a y offset step i nto the content holder element // so we don't exclude the whole thing becuase it is out of our // range. // if (GetInlineContentHolder()) // pChild = GetInlineContentHolder()->mpFirstChild; ; } } } #endif // Draw positive-z children while (pChild) { #if (INCLUDE_EXPERIMENTAL_DIV_SCROLLBARS) if (pChild->IncludeInFlow() && pChild->mRect.bottom >= yContentOffset && pChild->mRect.right >= xContentOffset) { if (pChild->mFlags & DISPLAY_FLAG_FIXED_POS) { pChild->Draw(pViewport->left+pChild->mRect.left-xContentOffset, pViewport->top+pChild->mRect.top-yContentOffset, pViewport, pGC); } else { pChild->Draw(iScreenX + pChild->mRect.left-xContentOffset, iScreenY+pChild->mRect.top-yContentOffset, pViewport, pGC); } } #else if (pChild->mFlags & DISPLAY_FLAG_FIXED_POS) { pChild->Draw(pViewport->left + pChild->mRect.left, pViewport->top + pChild->mRect.top, pViewport, pGC); } else { pChild->Draw(iScreenX + pChild->mRect.left, iScreenY + pChild->mRect.top, pViewport, pGC); } #endif pChild = pChild->mpNext; } if (clipRestore) { pGC->SetClip(&saveClip); } #if (INCLUDE_EXPERIMENTAL_DIV_SCROLLBARS) if (clipRestore && vScrollWidth() || hScrollWidth()) { DisplayElement *pScroll; if (GetHScroll()) { pScroll = (WebHScroll *)GetHScroll(); pScroll->Draw(iScreenX + pScroll->mRect.left, iScreenY + pScroll->mRect.top, pViewport, pGC); } if (GetVScroll()) { pScroll = (WebVScroll *)GetVScroll(); pScroll->Draw(iScreenX + pScroll->mRect.left, iScreenY + pScroll->mRect.top, pViewport, pGC); } pGC->SetClip(&saveClip); } #endif // pGC->EndBuffer(); }