Kaydet (Commit) 9fd81f77 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

refactor SvxCropExample to use RenderContext

Change-Id: I06e8702ecea2db2529eda538128d6a1693971185
üst 75594b02
...@@ -35,7 +35,7 @@ class SvxCropExample : public vcl::Window ...@@ -35,7 +35,7 @@ class SvxCropExample : public vcl::Window
public: public:
SvxCropExample( vcl::Window* pPar, WinBits nStyle ); SvxCropExample( vcl::Window* pPar, WinBits nStyle );
virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE; virtual Size GetOptimalSize() const SAL_OVERRIDE;
......
...@@ -799,29 +799,29 @@ VCL_BUILDER_DECL_FACTORY(SvxCropExample) ...@@ -799,29 +799,29 @@ VCL_BUILDER_DECL_FACTORY(SvxCropExample)
rRet = VclPtr<SvxCropExample>::Create(pParent, nWinStyle); rRet = VclPtr<SvxCropExample>::Create(pParent, nWinStyle);
} }
void SvxCropExample::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& ) void SvxCropExample::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{ {
Size aWinSize( PixelToLogic(GetOutputSizePixel() )); Size aWinSize(rRenderContext.PixelToLogic(rRenderContext.GetOutputSizePixel()));
SetLineColor(); rRenderContext.SetLineColor();
SetFillColor( GetSettings().GetStyleSettings().GetWindowColor() ); rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor());
SetRasterOp( ROP_OVERPAINT ); rRenderContext.SetRasterOp(ROP_OVERPAINT);
DrawRect( Rectangle( Point(), aWinSize ) ); rRenderContext.DrawRect(Rectangle(Point(), aWinSize));
SetLineColor( Color( COL_WHITE ) ); rRenderContext.SetLineColor(Color(COL_WHITE));
Rectangle aRect(Point((aWinSize.Width() - aFrameSize.Width())/2, Rectangle aRect(Point((aWinSize.Width() - aFrameSize.Width())/2,
(aWinSize.Height() - aFrameSize.Height())/2), (aWinSize.Height() - aFrameSize.Height())/2),
aFrameSize ); aFrameSize);
aGrf.Draw( this, aRect.TopLeft(), aRect.GetSize() ); aGrf.Draw(&rRenderContext, aRect.TopLeft(), aRect.GetSize());
Size aSz( 2, 0 ); Size aSz(2, 0);
aSz = PixelToLogic( aSz ); aSz = rRenderContext.PixelToLogic(aSz);
SetFillColor( Color( COL_TRANSPARENT ) ); rRenderContext.SetFillColor(Color(COL_TRANSPARENT));
SetRasterOp( ROP_INVERT ); rRenderContext.SetRasterOp(ROP_INVERT);
aRect.Left() += aTopLeft.Y(); aRect.Left() += aTopLeft.Y();
aRect.Top() += aTopLeft.X(); aRect.Top() += aTopLeft.X();
aRect.Right() -= aBottomRight.Y(); aRect.Right() -= aBottomRight.Y();
aRect.Bottom() -= aBottomRight.X(); aRect.Bottom() -= aBottomRight.X();
DrawRect( aRect ); rRenderContext.DrawRect(aRect);
} }
void SvxCropExample::Resize() void SvxCropExample::Resize()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment