void CDisplayWindow::DrawGradientFill(HDC hdc,RECT *rc) { if(m_hBitmapBackground) { DeleteObject(m_hBitmapBackground); } /* Create the (temporary) off-screen buffer used for drawing. */ m_hBitmapBackground = CreateCompatibleBitmap(hdc,rc->right - rc->left,rc->bottom - rc->top); SelectObject(m_hdcBackground,m_hBitmapBackground); Gdiplus::Graphics graphics(m_hdcBackground); Gdiplus::Rect DisplayRect(0,0,rc->right - rc->left,rc->bottom - rc->top); Gdiplus::GraphicsPath Path; Path.AddRectangle(DisplayRect); Gdiplus::PathGradientBrush pgb(&Path); pgb.SetCenterPoint(Gdiplus::Point(0,0)); pgb.SetCenterColor(m_CentreColor); INT count = 1; pgb.SetSurroundColors(&m_SurroundColor,&count); graphics.FillRectangle(&pgb,DisplayRect); /* This draws a separator line across the top edge of the window, so that it is visually separated from other windows. */ Gdiplus::Pen NewPen(BORDER_COLOUR,1); graphics.DrawLine(&NewPen,0,0,rc->right,0); }
LRESULT CTabWndHost::WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { // Decode message. switch(iMsg) { // Key pressed. case WM_SIZE: { // Get the display area. CRect rcDisplay = DisplayRect(); int nCurTab = CurSel(); // Resize the currently displayed window. if (nCurTab != -1) TabWnd(nCurTab).Move(rcDisplay); } break; // Call the default handler. default: break; } // Call the base class' handler. return CStdWnd::WndProc(hWnd, iMsg, wParam, lParam); }
void CTabWndHost::OnSelChange() { int nCurTab = CurSel(); if (nCurTab == -1) return; CWnd& oWnd = TabWnd(nCurTab); // Resize and bring the window to the front. oWnd.WindowPos(HWND_TOP, DisplayRect(), true); oWnd.Focus(); }
EXPORT_C void CHuiLayout::ReportChanged() { // Report changes in the layout itself. CHuiVisual::ReportChanged(); // Notify the display that the visual's area should be redrawn. CHuiDisplay* display = NULL; // Select active display, fallback to own display. // For scaled tv-out cloning the active display takes care of scaling direty areas too. if (iOwner && iOwner->Env().CurrentDisplay()) { display = iOwner->Env().CurrentDisplay(); } else { display = Display(); } if (display && !display->IsDirtyScanNeeded()) { return; } if (display && display->UseTransformedDirtyRegions()) { THuiRealRect displayRect = DisplayRect(); EnterLocalProjection(*display->Gc(), ETrue, 0.f, &displayRect); Transform(*display->Gc(), ETrue, &displayRect); } TInt count = Count(); for(TInt i = 0; i < count; ++i) { if (display && !display->IsDirtyScanNeeded()) { break; } //Ignore inactive child visuals if ( iHuiLayoutPrivateData->iChildren[i]->Flags()& EHuiVisualFlagInactive ) { continue; } iHuiLayoutPrivateData->iChildren[i]->ReportChanged(); } if (display && display->UseTransformedDirtyRegions()) { EnterLocalProjection(*display->Gc(), EFalse); Transform(*display->Gc(), EFalse); } }
// ----------------------------------------------------------------------------- // CMceComDisplaySink::DoInitParamL // ----------------------------------------------------------------------------- // const TDesC8& CMceComDisplaySink::DoInitParamL( const CMceComCodec& aCodec ) { delete iSettings; iSettings = NULL; TMccVideoSinkSetting displaySetting; TRect displayRect = DisplayRect(); CMceComDisplaySink::ToPointAndSize( displayRect, displaySetting.iLocation, displaySetting.iSize ); displaySetting.iDeviceIndex = 0; TMMFPrioritySettings priority; priority.iPriority = aCodec.iPriority; priority.iPref = TMdaPriorityPreference(aCodec.iPriorityPreference); displaySetting.iPriority = priority; displaySetting.iVideoPayloadType = aCodec.iPayloadType; displaySetting.iIAPId = MediaStream()->Session()->iIapId; displaySetting.iWindowOrdinalPosition = 1; displaySetting.iWindowOrdinalPriority = iPriority; displaySetting.iRotation = EMccNone; displaySetting.iEnabled = ETrue; if ( aCodec.Stream() && aCodec.Stream()->iType == KMceVideo ) { displaySetting.iVideoFrameRate = reinterpret_cast<const CMceComVideoCodec&>( aCodec ).iReceiveFrameRate; } else { displaySetting.iVideoFrameRate = 0; } TMccVideoSinkSettingBuf settings( displaySetting ); iSettings = settings.AllocL(); return *iSettings; }
void CHuiLayout::DrawStoredBitmap(CHuiGc &aGc) const { if (!Display()) return; if (!iHuiLayoutPrivateData->iGc) { CHuiRenderPlugin& renderplugin = CHuiStatic::Renderer(); // deleted in destructor or CHuiCanvasVisual::FreeRenderBuffer when not needed anymore iHuiLayoutPrivateData->iGc = renderplugin.CreateCanvasGcL(); } CHuiCanvasGc& gc = *iHuiLayoutPrivateData->iGc; gc.SetGc(aGc); gc.SetDefaults(); gc.PushTransformationMatrix(); //TInt w = displayArea.Width(); TRect displayArea = Display()->VisibleArea(); TInt h = displayArea.Height(); // Pixels are upside down in OpenVG canvas render buffer if (CHuiStatic::Env().Renderer() == EHuiRendererVg10) { TInt height = h; //if (relativeOrientation == CHuiGc::EOrientationCW90 || relativeOrientation == CHuiGc::EOrientationCCW90) // { // height = w; // } gc.Translate(0.0f, height, 0.0f); gc.Scale(1.f, -1.f, 1.f); } THuiRealPoint dest_point = DisplayRect().iTl; CHuiCanvasRenderBuffer *stored = StoredRenderBuffer(); gc.DrawImage(*stored, dest_point); gc.PopTransformationMatrix(); }
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override { painter->save(); QStyle *style = option.widget->style(); style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, option.widget); QRect contentsRect = style->subElementRect(QStyle::SE_ItemViewItemText, &option, option.widget); int a = contentsRect.height(); /* Draw DecorationRole */ QRect DecorationRect(contentsRect.topLeft(), option.decorationSize); DecorationRect.translate( (a-option.decorationSize.width())/2, (a-option.decorationSize.height())/2); painter->drawPixmap(DecorationRect, index.data(Qt::DecorationRole).value<QIcon>().pixmap(option.decorationSize)); /* Draw DisplayRole */ QRect DisplayRect(contentsRect.adjusted(a+3,0,0,0)); QString text = QFontMetrics(option.font).elidedText( index.data(Qt::DisplayRole).toString(), option.textElideMode, DisplayRect.width()); painter->drawText(DisplayRect, Qt::AlignVCenter|Qt::AlignLeft, text); painter->restore(); }
EXPORT_C void CHuiLayout::Draw(CHuiGc& aGc) const { if (Flags() & EHuiVisualFlagDrawOnlyAsExternalContent) { // This is used only as external content visual. Return now if we are not currently drawing // external content. if (!Display() || !Display()->RosterImpl().IsDrawingExternalContent()) { return; } } if(iOpacity.Now() <= EPSILON && (Effect() && !Effect()->IsSemitransparent())) { // This will not be visible due to being completely transparent. return; } if (( IsDelayedEffectSource()||Freezed() ) && StoredRenderBuffer()) { DrawStoredBitmap(aGc); return; } if (!HasActiveChilderen() && !Brushes() && !Effect()) { // No children, no brushes just return. return; } /** @todo Wouldn't it be possible to just extend CHuiVisual::Draw() instead of redefining the entire method? */ THuiRealRect area = DisplayRect(); // Apply local transformation. EnterLocalProjection(aGc, ETrue, 0.f, &area); Transform(aGc, ETrue, &area); DrawBrushes(aGc, EHuiBrushLayerBackground); if(Clipping()) { // @todo Clipping not going to work if there is a transformation? // Layout clipping is not affected by transformation. aGc.Enable(CHuiGc::EFeatureClipping); aGc.PushClip(); aGc.Clip(area); } // Can we draw effect TBool canUseEffectDrawing = Effect() && !LoadingEffect(); // Flag to know what we did TBool didDrawEffect = EFalse; if (canUseEffectDrawing) { // Note that EHuiVisualFlagOpaqueHint improves performance a lot in cached effect drawing TBool transparent = !(Flags() & EHuiVisualFlagOpaqueHint) && iOpacity.Now() < 1.0f; TBool refreshCache = Changed(); didDrawEffect = Effect()->CachedDraw(aGc, area, refreshCache, !transparent); } if ( !didDrawEffect ) { // huilayout does not draw itself, only children. } else { // Effect was drawn, OpenGLES/OpenVG may be in different state than what Gc thinks so we restore it. aGc.RestoreState(); } if ( !didDrawEffect || (didDrawEffect && !EffectIsAppliedToChildren())) { // The layout itself is invisible. Only its children can be seen. TBool afterOthers = EFalse; const TInt count = Count(); for(TInt i = 0; i < count; ++i) { CHuiVisual* visual = iHuiLayoutPrivateData->iChildren[i]; //Ignore inactive child visuals if ( visual->Flags()& EHuiVisualFlagInactive ) { continue; } if(visual->Flags() & EHuiVisualFlagDrawAfterOthers) { afterOthers = ETrue; continue; } // @todo No need to draw children that won't be visible. visual->Draw(aGc); } if(afterOthers) { for(TInt i = 0; i < count; ++i) { if(iHuiLayoutPrivateData->iChildren[i]->Flags() & EHuiVisualFlagDrawAfterOthers) { iHuiLayoutPrivateData->iChildren[i]->Draw(aGc); } } } } if(Clipping()) { // Restore original clipping rectangle. aGc.PopClip(); } DrawBrushes(aGc, EHuiBrushLayerForeground); // Restore original transformation. Transform(aGc, EFalse); EnterLocalProjection(aGc, EFalse); }