Kaydet (Commit) 5a35cb3e authored tarafından Chris Sherlock's avatar Chris Sherlock

Split outdev2.cxx

I have split outdev2.cxx into the following files:

+ alpha.cxx
+ bezier.cxx
+ bitmap.cxx
+ blend.cxx
+ gradient.cxx
+ hatch.cxx
+ pixel.cxx
+ polygon.cxx
+ line.cxx
+ polyline.cxx
+ rect.cxx
+ transparent.cxx

I have also moved all the DrawDev functions into outdev.cxx

Change-Id: Ica7057250526cd1ed680e5ec173c73265a586ea3
üst d4bf4198
......@@ -125,6 +125,22 @@ struct ImplThresholdRes
long mnThresPixToLogY; // ""
};
#define OUTDEV_INIT() \
{ \
if ( !IsDeviceOutputNecessary() ) \
return; \
\
if ( !mpGraphics ) \
if ( !ImplGetGraphics() ) \
return; \
\
if ( mbInitClipRegion ) \
ImplInitClipRegion(); \
\
if ( mbOutputClipped ) \
return; \
}
// OutputDevice-Types
// Flags for Push()
......@@ -256,6 +272,15 @@ const char* ImplDbgCheckOutputDevice( const void* pObj );
Polygon ImplSubdivideBezier( const Polygon& rPoly );
PolyPolygon ImplSubdivideBezier( const PolyPolygon& rPolyPoly );
sal_uLong ImplAdjustTwoRect( SalTwoRect& rTwoRect, const Size& rSizePix );
void ImplAdjustTwoRect( SalTwoRect& rTwoRect, const Rectangle& rValidSrcRect );
extern const sal_uLong nVCLRLut[ 6 ];
extern const sal_uLong nVCLGLut[ 6 ];
extern const sal_uLong nVCLBLut[ 6 ];
extern const sal_uLong nVCLDitherLut[ 256 ];
extern const sal_uLong nVCLLut[ 256 ];
class VCL_DLLPUBLIC OutputDevice
{
friend class Application;
......
......@@ -234,20 +234,26 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/gdi/metric \
vcl/source/gdi/octree \
vcl/source/gdi/oldprintadaptor \
vcl/source/gdi/outdev/bezier \
vcl/source/gdi/outdev/polygon \
vcl/source/gdi/outdev/outdev2 \
vcl/source/gdi/outdev/outdev3 \
vcl/source/gdi/outdev/rect \
vcl/source/gdi/outdev/line \
vcl/source/gdi/outdev/polyline \
vcl/source/gdi/outdev/hatch \
vcl/source/gdi/outdev/gradient \
vcl/source/gdi/outdev/outdev5 \
vcl/source/gdi/outdev/outdev6 \
vcl/source/gdi/outdev/outdev \
vcl/source/gdi/outdev/outdevnative \
vcl/source/gdi/outdev/outmap \
vcl/source/outdev/tworect \
vcl/source/outdev/bezier \
vcl/source/outdev/polygon \
vcl/source/outdev/transparent \
vcl/source/outdev/alpha \
vcl/source/outdev/blend \
vcl/source/outdev/mask \
vcl/source/outdev/bitmap \
vcl/source/outdev/outdev3 \
vcl/source/outdev/pixel \
vcl/source/outdev/rect \
vcl/source/outdev/line \
vcl/source/outdev/polyline \
vcl/source/outdev/hatch \
vcl/source/outdev/gradient \
vcl/source/outdev/outdev5 \
vcl/source/outdev/outdev6 \
vcl/source/outdev/outdev \
vcl/source/outdev/outdevnative \
vcl/source/outdev/outmap \
vcl/source/gdi/pdfextoutdevdata \
vcl/source/gdi/pdffontcache \
vcl/source/gdi/pdfwriter \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <tools/debug.hxx>
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/window.hxx>
#include <vcl/metaact.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/virdev.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/outdev.hxx>
#include <vcl/image.hxx>
#include <bmpfast.hxx>
#include <salbmp.hxx>
#include <salgdi.hxx>
#include <impbmp.hxx>
#include <sallayout.hxx>
#include <image.h>
#include <outdev.h>
#include <window.h>
#include <outdata.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <boost/scoped_array.hpp>
void OutputDevice::ImplDrawAlpha( const Bitmap& rBmp, const AlphaMask& rAlpha,
const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel )
{
const Point aNullPt;
Point aOutPt( LogicToPixel( rDestPt ) );
Size aOutSz( LogicToPixel( rDestSize ) );
Rectangle aDstRect( aNullPt, GetOutputSizePixel() );
const bool bHMirr = aOutSz.Width() < 0;
const bool bVMirr = aOutSz.Height() < 0;
ClipToPaintRegion(aDstRect);
if( bHMirr )
{
aOutSz.Width() = -aOutSz.Width();
aOutPt.X() -= ( aOutSz.Width() - 1L );
}
if( bVMirr )
{
aOutSz.Height() = -aOutSz.Height();
aOutPt.Y() -= ( aOutSz.Height() - 1L );
}
if( !aDstRect.Intersection( Rectangle( aOutPt, aOutSz ) ).IsEmpty() )
{
bool bNativeAlpha = false;
static const char* pDisableNative = getenv( "SAL_DISABLE_NATIVE_ALPHA");
// #i83087# Naturally, system alpha blending cannot work with
// separate alpha VDev
bool bTryDirectPaint(!mpAlphaVDev && !pDisableNative && !bHMirr && !bVMirr);
#ifdef WNT
if(bTryDirectPaint)
{
// only paint direct when no scaling and no MapMode, else the
// more expensive conversions may be done for short-time Bitmap/BitmapEx
// used for buffering only
if(!IsMapMode() && rSrcSizePixel.Width() == aOutSz.Width() && rSrcSizePixel.Height() == aOutSz.Height())
{
bTryDirectPaint = false;
}
}
#endif
if(bTryDirectPaint)
{
Point aRelPt = aOutPt + Point( mnOutOffX, mnOutOffY );
SalTwoRect aTR = {
rSrcPtPixel.X(), rSrcPtPixel.Y(),
rSrcSizePixel.Width(), rSrcSizePixel.Height(),
aRelPt.X(), aRelPt.Y(),
aOutSz.Width(), aOutSz.Height()
};
SalBitmap* pSalSrcBmp = rBmp.ImplGetImpBitmap()->ImplGetSalBitmap();
SalBitmap* pSalAlphaBmp = rAlpha.ImplGetImpBitmap()->ImplGetSalBitmap();
bNativeAlpha = mpGraphics->DrawAlphaBitmap( aTR, *pSalSrcBmp, *pSalAlphaBmp, this );
}
VirtualDevice* pOldVDev = mpAlphaVDev;
Rectangle aBmpRect( aNullPt, rBmp.GetSizePixel() );
if( !bNativeAlpha
&& !aBmpRect.Intersection( Rectangle( rSrcPtPixel, rSrcSizePixel ) ).IsEmpty() )
{
// The scaling in this code path produces really ugly results - it
// does the most trivial scaling with no smoothing.
GDIMetaFile* pOldMetaFile = mpMetaFile;
const bool bOldMap = mbMap;
mpMetaFile = NULL; // fdo#55044 reset before GetBitmap!
mbMap = false;
Bitmap aBmp( GetBitmap( aDstRect.TopLeft(), aDstRect.GetSize() ) );
// #109044# The generated bitmap need not necessarily be
// of aDstRect dimensions, it's internally clipped to
// window bounds. Thus, we correct the dest size here,
// since we later use it (in nDstWidth/Height) for pixel
// access)
// #i38887# reading from screen may sometimes fail
if( aBmp.ImplGetImpBitmap() )
aDstRect.SetSize( aBmp.GetSizePixel() );
BitmapColor aDstCol;
const long nSrcWidth = aBmpRect.GetWidth(), nSrcHeight = aBmpRect.GetHeight();
const long nDstWidth = aDstRect.GetWidth(), nDstHeight = aDstRect.GetHeight();
const long nOutWidth = aOutSz.Width(), nOutHeight = aOutSz.Height();
// calculate offset in original bitmap
// in RTL case this is a little more complicated since the contents of the
// bitmap is not mirrored (it never is), however the paint region and bmp region
// are in mirrored coordinates, so the intersection of (aOutPt,aOutSz) with these
// is content wise somewhere else and needs to take mirroring into account
const long nOffX = IsRTLEnabled()
? aOutSz.Width() - aDstRect.GetWidth() - (aDstRect.Left() - aOutPt.X())
: aDstRect.Left() - aOutPt.X(),
nOffY = aDstRect.Top() - aOutPt.Y();
long nX, nOutX, nY, nOutY;
long nMirrOffX = 0;
long nMirrOffY = 0;
boost::scoped_array<long> pMapX(new long[ nDstWidth ]);
boost::scoped_array<long> pMapY(new long[ nDstHeight ]);
// create horizontal mapping table
if( bHMirr )
nMirrOffX = ( aBmpRect.Left() << 1 ) + nSrcWidth - 1;
for( nX = 0L, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ )
{
pMapX[ nX ] = aBmpRect.Left() + nOutX * nSrcWidth / nOutWidth;
if( bHMirr )
pMapX[ nX ] = nMirrOffX - pMapX[ nX ];
}
// create vertical mapping table
if( bVMirr )
nMirrOffY = ( aBmpRect.Top() << 1 ) + nSrcHeight - 1;
for( nY = 0L, nOutY = nOffY; nY < nDstHeight; nY++, nOutY++ )
{
pMapY[ nY ] = aBmpRect.Top() + nOutY * nSrcHeight / nOutHeight;
if( bVMirr )
pMapY[ nY ] = nMirrOffY - pMapY[ nY ];
}
BitmapReadAccess* pP = ( (Bitmap&) rBmp ).AcquireReadAccess();
BitmapReadAccess* pA = ( (AlphaMask&) rAlpha ).AcquireReadAccess();
DBG_ASSERT( pA->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ||
pA->GetScanlineFormat() == BMP_FORMAT_8BIT_TC_MASK,
"OutputDevice::ImplDrawAlpha(): non-8bit alpha no longer supported!" );
// #i38887# reading from screen may sometimes fail
if( aBmp.ImplGetImpBitmap() )
{
Bitmap aTmp;
if( mpAlphaVDev )
{
aTmp = ImplBlendWithAlpha(
aBmp,pP,pA,
aDstRect,
nOffY,nDstHeight,
nOffX,nDstWidth,
pMapX.get(),pMapY.get() );
}
else
{
aTmp = ImplBlend(
aBmp,pP,pA,
nOffY,nDstHeight,
nOffX,nDstWidth,
aBmpRect,aOutSz,
bHMirr,bVMirr,
pMapX.get(),pMapY.get() );
}
// #110958# Disable alpha VDev, we're doing the necessary
// stuff explicitly furher below
if( mpAlphaVDev )
mpAlphaVDev = NULL;
DrawBitmap( aDstRect.TopLeft(),
aTmp );
// #110958# Enable alpha VDev again
mpAlphaVDev = pOldVDev;
}
( (Bitmap&) rBmp ).ReleaseAccess( pP );
( (AlphaMask&) rAlpha ).ReleaseAccess( pA );
mbMap = bOldMap;
mpMetaFile = pOldMetaFile;
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
......@@ -25,7 +25,7 @@
#include <vcl/outdev.hxx>
#include <vcl/settings.hxx>
#include "../pdfwriter_impl.hxx"
#include "../gdi/pdfwriter_impl.hxx"
#include <boost/scoped_array.hpp>
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <tools/debug.hxx>
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/window.hxx>
#include <vcl/metaact.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/virdev.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/outdev.hxx>
#include <vcl/image.hxx>
#include <bmpfast.hxx>
#include <salbmp.hxx>
#include <salgdi.hxx>
#include <impbmp.hxx>
#include <sallayout.hxx>
#include <image.h>
#include <outdev.h>
#include <window.h>
#include <outdata.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <boost/scoped_array.hpp>
extern const sal_uLong nVCLRLut[ 6 ];
extern const sal_uLong nVCLGLut[ 6 ];
extern const sal_uLong nVCLBLut[ 6 ];
extern const sal_uLong nVCLDitherLut[ 256 ];
extern const sal_uLong nVCLLut[ 256 ];
void OutputDevice::DrawMask( const Point& rDestPt,
const Bitmap& rBitmap, const Color& rMaskColor )
{
const Size aSizePix( rBitmap.GetSizePixel() );
DrawMask( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmap, rMaskColor, META_MASK_ACTION );
}
void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
const Bitmap& rBitmap, const Color& rMaskColor )
{
DrawMask( rDestPt, rDestSize, Point(), rBitmap.GetSizePixel(), rBitmap, rMaskColor, META_MASKSCALE_ACTION );
}
void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel,
const Bitmap& rBitmap, const Color& rMaskColor,
const sal_uLong nAction )
{
if( ImplIsRecordLayout() )
return;
if( ROP_INVERT == meRasterOp )
{
DrawRect( Rectangle( rDestPt, rDestSize ) );
return;
}
if ( mpMetaFile )
{
switch( nAction )
{
case( META_MASK_ACTION ):
mpMetaFile->AddAction( new MetaMaskAction( rDestPt,
rBitmap, rMaskColor ) );
break;
case( META_MASKSCALE_ACTION ):
mpMetaFile->AddAction( new MetaMaskScaleAction( rDestPt,
rDestSize, rBitmap, rMaskColor ) );
break;
case( META_MASKSCALEPART_ACTION ):
mpMetaFile->AddAction( new MetaMaskScalePartAction( rDestPt, rDestSize,
rSrcPtPixel, rSrcSizePixel, rBitmap, rMaskColor ) );
break;
}
}
OUTDEV_INIT();
if ( OUTDEV_PRINTER == meOutDevType )
{
ImplPrintMask( rBitmap, rMaskColor, rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel );
return;
}
const ImpBitmap* pImpBmp = rBitmap.ImplGetImpBitmap();
if ( pImpBmp )
{
SalTwoRect aPosAry;
aPosAry.mnSrcX = rSrcPtPixel.X();
aPosAry.mnSrcY = rSrcPtPixel.Y();
aPosAry.mnSrcWidth = rSrcSizePixel.Width();
aPosAry.mnSrcHeight = rSrcSizePixel.Height();
aPosAry.mnDestX = ImplLogicXToDevicePixel( rDestPt.X() );
aPosAry.mnDestY = ImplLogicYToDevicePixel( rDestPt.Y() );
aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() );
aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
// we don't want to mirror via cooridates
const sal_uLong nMirrFlags = ImplAdjustTwoRect( aPosAry, pImpBmp->ImplGetSize() );
// check if output is necessary
if( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
{
if( nMirrFlags )
{
Bitmap aTmp( rBitmap );
aTmp.Mirror( nMirrFlags );
mpGraphics->DrawMask( aPosAry, *aTmp.ImplGetImpBitmap()->ImplGetSalBitmap(),
ImplColorToSal( rMaskColor ) , this);
}
else
mpGraphics->DrawMask( aPosAry, *pImpBmp->ImplGetSalBitmap(),
ImplColorToSal( rMaskColor ), this );
}
}
// TODO: Use mask here
if( mpAlphaVDev )
{
const Bitmap& rMask( rBitmap.CreateMask( rMaskColor ) );
// #i25167# Restrict mask painting to _opaque_ areas
// of the mask, otherwise we spoil areas where no
// bitmap content was ever visible. Interestingly
// enough, this can be achieved by taking the mask as
// the transparency mask of itself
mpAlphaVDev->DrawBitmapEx( rDestPt,
rDestSize,
rSrcPtPixel,
rSrcSizePixel,
BitmapEx( rMask, rMask ) );
}
}
void OutputDevice::ImplPrintMask( const Bitmap& /*rMask*/, const Color& /*rMaskColor*/,
const Point& /*rDestPt*/, const Size& /*rDestSize*/,
const Point& /*rSrcPtPixel*/, const Size& /*rSrcSizePixel*/ )
{
// let's leave this for Printer
return;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -175,6 +175,10 @@ bool OutputDevice::ImplIsAntiparallel() const
return bRet;
}
void OutputDevice::ClipToPaintRegion(Rectangle& /*rDstRect*/)
{
}
bool OutputDevice::ImplSelectClipRegion( const Region& rRegion, SalGraphics* pGraphics )
{
DBG_TESTSOLARMUTEX();
......@@ -500,6 +504,283 @@ void OutputDevice::ImplDeInitOutDevData()
}
}
void OutputDevice::ImplDrawOutDevDirect( const OutputDevice* pSrcDev, SalTwoRect& rPosAry )
{
SalGraphics* pGraphics2;
if ( this == pSrcDev )
pGraphics2 = NULL;
else
{
if ( (GetOutDevType() != pSrcDev->GetOutDevType()) ||
(GetOutDevType() != OUTDEV_WINDOW) )
{
if ( !pSrcDev->mpGraphics )
{
if ( !((OutputDevice*)pSrcDev)->ImplGetGraphics() )
return;
}
pGraphics2 = pSrcDev->mpGraphics;
}
else
{
if ( ((Window*)this)->mpWindowImpl->mpFrameWindow == ((Window*)pSrcDev)->mpWindowImpl->mpFrameWindow )
pGraphics2 = NULL;
else
{
if ( !pSrcDev->mpGraphics )
{
if ( !((OutputDevice*)pSrcDev)->ImplGetGraphics() )
return;
}
pGraphics2 = pSrcDev->mpGraphics;
if ( !mpGraphics )
{
if ( !ImplGetGraphics() )
return;
}
DBG_ASSERT( mpGraphics && pSrcDev->mpGraphics,
"OutputDevice::DrawOutDev(): We need more than one Graphics" );
}
}
}
// #102532# Offset only has to be pseudo window offset
const Rectangle aSrcOutRect( Point( pSrcDev->mnOutOffX, pSrcDev->mnOutOffY ),
Size( pSrcDev->mnOutWidth, pSrcDev->mnOutHeight ) );
ImplAdjustTwoRect( rPosAry, aSrcOutRect );
if ( rPosAry.mnSrcWidth && rPosAry.mnSrcHeight && rPosAry.mnDestWidth && rPosAry.mnDestHeight )
{
// --- RTL --- if this is no window, but pSrcDev is a window
// mirroring may be required
// because only windows have a SalGraphicsLayout
// mirroring is performed here
if( (GetOutDevType() != OUTDEV_WINDOW) && pGraphics2 && (pGraphics2->GetLayout() & SAL_LAYOUT_BIDI_RTL) )
{
SalTwoRect aPosAry2 = rPosAry;
pGraphics2->mirror( aPosAry2.mnSrcX, aPosAry2.mnSrcWidth, pSrcDev );
mpGraphics->CopyBits( aPosAry2, pGraphics2, this, pSrcDev );
}
else
mpGraphics->CopyBits( rPosAry, pGraphics2, this, pSrcDev );
}
}
void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPt, const Size& rSrcSize )
{
if( ImplIsRecordLayout() )
return;
if ( ROP_INVERT == meRasterOp )
{
DrawRect( Rectangle( rDestPt, rDestSize ) );
return;
}
if ( mpMetaFile )
{
const Bitmap aBmp( GetBitmap( rSrcPt, rSrcSize ) );
mpMetaFile->AddAction( new MetaBmpScaleAction( rDestPt, rDestSize, aBmp ) );
}
OUTDEV_INIT();
SalTwoRect aPosAry;
aPosAry.mnSrcWidth = ImplLogicWidthToDevicePixel( rSrcSize.Width() );
aPosAry.mnSrcHeight = ImplLogicHeightToDevicePixel( rSrcSize.Height() );
aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() );
aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
{
aPosAry.mnSrcX = ImplLogicXToDevicePixel( rSrcPt.X() );
aPosAry.mnSrcY = ImplLogicYToDevicePixel( rSrcPt.Y() );
aPosAry.mnDestX = ImplLogicXToDevicePixel( rDestPt.X() );
aPosAry.mnDestY = ImplLogicYToDevicePixel( rDestPt.Y() );
const Rectangle aSrcOutRect( Point( mnOutOffX, mnOutOffY ),
Size( mnOutWidth, mnOutHeight ) );
ImplAdjustTwoRect( aPosAry, aSrcOutRect );
if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
mpGraphics->CopyBits( aPosAry, NULL, this, NULL );
}
if( mpAlphaVDev )
mpAlphaVDev->DrawOutDev( rDestPt, rDestSize, rSrcPt, rSrcSize );
}
void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPt, const Size& rSrcSize,
const OutputDevice& rOutDev )
{
if ( ImplIsRecordLayout() )
return;
if ( ROP_INVERT == meRasterOp )
{
DrawRect( Rectangle( rDestPt, rDestSize ) );
return;
}
if ( mpMetaFile )
{
const Bitmap aBmp( rOutDev.GetBitmap( rSrcPt, rSrcSize ) );
mpMetaFile->AddAction( new MetaBmpScaleAction( rDestPt, rDestSize, aBmp ) );
}
OUTDEV_INIT();
SalTwoRect aPosAry;
aPosAry.mnSrcX = rOutDev.ImplLogicXToDevicePixel( rSrcPt.X() );
aPosAry.mnSrcY = rOutDev.ImplLogicYToDevicePixel( rSrcPt.Y() );
aPosAry.mnSrcWidth = rOutDev.ImplLogicWidthToDevicePixel( rSrcSize.Width() );
aPosAry.mnSrcHeight = rOutDev.ImplLogicHeightToDevicePixel( rSrcSize.Height() );
aPosAry.mnDestX = ImplLogicXToDevicePixel( rDestPt.X() );
aPosAry.mnDestY = ImplLogicYToDevicePixel( rDestPt.Y() );
aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() );
aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
if( mpAlphaVDev )
{
if( rOutDev.mpAlphaVDev )
{
// alpha-blend source over destination
DrawBitmapEx( rDestPt, rDestSize, rOutDev.GetBitmapEx(rSrcPt, rSrcSize) );
}
else
{
ImplDrawOutDevDirect( &rOutDev, aPosAry );
// #i32109#: make destination rectangle opaque - source has no alpha
mpAlphaVDev->ImplFillOpaqueRectangle( Rectangle(rDestPt, rDestSize) );
}
}
else
{
if( rOutDev.mpAlphaVDev )
{
// alpha-blend source over destination
DrawBitmapEx( rDestPt, rDestSize, rOutDev.GetBitmapEx(rSrcPt, rSrcSize) );
}
else
{
// no alpha at all, neither in source nor destination device
ImplDrawOutDevDirect( &rOutDev, aPosAry );
}
}
}
void OutputDevice::CopyArea( const Point& rDestPt,
const Point& rSrcPt, const Size& rSrcSize,
sal_uInt16 nFlags )
{
if ( ImplIsRecordLayout() )
return;
RasterOp eOldRop = GetRasterOp();
SetRasterOp( ROP_OVERPAINT );
OUTDEV_INIT();
SalTwoRect aPosAry;
aPosAry.mnSrcWidth = ImplLogicWidthToDevicePixel( rSrcSize.Width() );
aPosAry.mnSrcHeight = ImplLogicHeightToDevicePixel( rSrcSize.Height() );
if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight )
{
aPosAry.mnSrcX = ImplLogicXToDevicePixel( rSrcPt.X() );
aPosAry.mnSrcY = ImplLogicYToDevicePixel( rSrcPt.Y() );
aPosAry.mnDestX = ImplLogicXToDevicePixel( rDestPt.X() );
aPosAry.mnDestY = ImplLogicYToDevicePixel( rDestPt.Y() );
aPosAry.mnDestWidth = aPosAry.mnSrcWidth;
aPosAry.mnDestHeight = aPosAry.mnSrcHeight;
const Rectangle aSrcOutRect( Point( mnOutOffX, mnOutOffY ),
Size( mnOutWidth, mnOutHeight ) );
ImplAdjustTwoRect( aPosAry, aSrcOutRect );
CopyAreaFinal ( aPosAry, nFlags );
}
SetRasterOp( eOldRop );
if( mpAlphaVDev )
mpAlphaVDev->CopyArea( rDestPt, rSrcPt, rSrcSize, nFlags );
}
void OutputDevice::CopyAreaFinal( SalTwoRect& aPosAry, sal_uInt32 /*nFlags*/)
{
if (aPosAry.mnSrcWidth == 0 || aPosAry.mnSrcHeight == 0 || aPosAry.mnDestWidth == 0 || aPosAry.mnDestHeight == 0)
return;
aPosAry.mnDestWidth = aPosAry.mnSrcWidth;
aPosAry.mnDestHeight = aPosAry.mnSrcHeight;
mpGraphics->CopyBits(aPosAry, NULL, this, NULL);
}
void OutputDevice::ImplDrawFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
const OutputDevice& rOutDev, const Region& rRegion )
{
GDIMetaFile* pOldMetaFile = mpMetaFile;
bool bOldMap = mbMap;
RasterOp eOldROP = GetRasterOp();
mpMetaFile = NULL;
mbMap = false;
SetRasterOp( ROP_OVERPAINT );
if ( !IsDeviceOutputNecessary() )
return;
if ( !mpGraphics )
{
if ( !ImplGetGraphics() )
return;
}
// ClipRegion zuruecksetzen
if ( rRegion.IsNull() )
mpGraphics->ResetClipRegion();
else
ImplSelectClipRegion( rRegion );
SalTwoRect aPosAry;
aPosAry.mnSrcX = rDevPt.X();
aPosAry.mnSrcY = rDevPt.Y();
aPosAry.mnSrcWidth = rDevSize.Width();
aPosAry.mnSrcHeight = rDevSize.Height();
aPosAry.mnDestX = rPt.X();
aPosAry.mnDestY = rPt.Y();
aPosAry.mnDestWidth = rDevSize.Width();
aPosAry.mnDestHeight = rDevSize.Height();
ImplDrawOutDevDirect( &rOutDev, aPosAry );
// Ensure that ClipRegion is recalculated and set
mbInitClipRegion = true;
SetRasterOp( eOldROP );
mbMap = bOldMap;
mpMetaFile = pOldMetaFile;
}
void OutputDevice::ImplGetFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
OutputDevice& rDev )
{
bool bOldMap = mbMap;
mbMap = false;
rDev.DrawOutDev( rDevPt, rDevSize, rPt, rDevSize, *this );
mbMap = bOldMap;
}
void OutputDevice::ImplInitLineColor()
{
DBG_TESTSOLARMUTEX();
......
......@@ -73,7 +73,7 @@
#include "graphite_features.hxx"
#endif
#include "../pdfwriter_impl.hxx"
#include "../gdi/pdfwriter_impl.hxx"
#include "com/sun/star/beans/PropertyValues.hpp"
#include "com/sun/star/i18n/XBreakIterator.hpp"
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <tools/debug.hxx>
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/window.hxx>
#include <vcl/metaact.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/virdev.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/outdev.hxx>
#include <vcl/image.hxx>
#include <bmpfast.hxx>
#include <salbmp.hxx>
#include <salgdi.hxx>
#include <impbmp.hxx>
#include <sallayout.hxx>
#include <image.h>
#include <outdev.h>
#include <window.h>
#include <outdata.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <boost/scoped_array.hpp>
extern const sal_uLong nVCLRLut[ 6 ];
extern const sal_uLong nVCLGLut[ 6 ];
extern const sal_uLong nVCLBLut[ 6 ];
extern const sal_uLong nVCLDitherLut[ 256 ];
extern const sal_uLong nVCLLut[ 256 ];
Color OutputDevice::GetPixel( const Point& rPt ) const
{
Color aColor;
if ( mpGraphics || ((OutputDevice*)this)->ImplGetGraphics() )
{
if ( mbInitClipRegion )
((OutputDevice*)this)->ImplInitClipRegion();
if ( !mbOutputClipped )
{
const long nX = ImplLogicXToDevicePixel( rPt.X() );
const long nY = ImplLogicYToDevicePixel( rPt.Y() );
const SalColor aSalCol = mpGraphics->GetPixel( nX, nY, this );
aColor.SetRed( SALCOLOR_RED( aSalCol ) );
aColor.SetGreen( SALCOLOR_GREEN( aSalCol ) );
aColor.SetBlue( SALCOLOR_BLUE( aSalCol ) );
}
}
return aColor;
}
void OutputDevice::DrawPixel( const Point& rPt )
{
if ( mpMetaFile )
mpMetaFile->AddAction( new MetaPointAction( rPt ) );
if ( !IsDeviceOutputNecessary() || !mbLineColor || ImplIsRecordLayout() )
return;
Point aPt = ImplLogicToDevicePixel( rPt );
if ( !mpGraphics )
{
if ( !ImplGetGraphics() )
return;
}
if ( mbInitClipRegion )
ImplInitClipRegion();
if ( mbOutputClipped )
return;
if ( mbInitLineColor )
ImplInitLineColor();
mpGraphics->DrawPixel( aPt.X(), aPt.Y(), this );
if( mpAlphaVDev )
mpAlphaVDev->DrawPixel( rPt );
}
void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
{
Color aColor = ImplDrawModeToColor( rColor );
if ( mpMetaFile )
mpMetaFile->AddAction( new MetaPixelAction( rPt, aColor ) );
if ( !IsDeviceOutputNecessary() || ImplIsColorTransparent( aColor ) || ImplIsRecordLayout() )
return;
Point aPt = ImplLogicToDevicePixel( rPt );
if ( !mpGraphics )
{
if ( !ImplGetGraphics() )
return;
}
if ( mbInitClipRegion )
ImplInitClipRegion();
if ( mbOutputClipped )
return;
mpGraphics->DrawPixel( aPt.X(), aPt.Y(), ImplColorToSal( aColor ), this );
if( mpAlphaVDev )
mpAlphaVDev->DrawPixel( rPt );
}
void OutputDevice::DrawPixel( const Polygon& rPts, const Color* pColors )
{
if ( !pColors )
DrawPixel( rPts, GetLineColor() );
else
{
DBG_ASSERT( pColors, "OutputDevice::DrawPixel: No color array specified" );
const sal_uInt16 nSize = rPts.GetSize();
if ( nSize )
{
if ( mpMetaFile )
for ( sal_uInt16 i = 0; i < nSize; i++ )
mpMetaFile->AddAction( new MetaPixelAction( rPts[ i ], pColors[ i ] ) );
if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
return;
if ( mpGraphics || ImplGetGraphics() )
{
if ( mbInitClipRegion )
ImplInitClipRegion();
if ( mbOutputClipped )
return;
for ( sal_uInt16 i = 0; i < nSize; i++ )
{
const Point aPt( ImplLogicToDevicePixel( rPts[ i ] ) );
mpGraphics->DrawPixel( aPt.X(), aPt.Y(), ImplColorToSal( pColors[ i ] ), this );
}
}
}
}
if( mpAlphaVDev )
mpAlphaVDev->DrawPixel( rPts, pColors );
}
void OutputDevice::DrawPixel( const Polygon& rPts, const Color& rColor )
{
if( rColor != COL_TRANSPARENT && ! ImplIsRecordLayout() )
{
const sal_uInt16 nSize = rPts.GetSize();
boost::scoped_array<Color> pColArray(new Color[ nSize ]);
for( sal_uInt16 i = 0; i < nSize; i++ )
pColArray[ i ] = rColor;
DrawPixel( rPts, pColArray.get() );
}
if( mpAlphaVDev )
mpAlphaVDev->DrawPixel( rPts, rColor );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <tools/debug.hxx>
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/window.hxx>
#include <vcl/metaact.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/virdev.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/outdev.hxx>
#include <vcl/image.hxx>
#include <bmpfast.hxx>
#include <salbmp.hxx>
#include <salgdi.hxx>
#include <impbmp.hxx>
#include <sallayout.hxx>
#include <image.h>
#include <outdev.h>
#include <window.h>
#include <outdata.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <boost/scoped_array.hpp>
void OutputDevice::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask,
const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel )
{
Point aPt;
Point aDestPt( LogicToPixel( rDestPt ) );
Size aDestSz( LogicToPixel( rDestSize ) );
Rectangle aSrcRect( rSrcPtPixel, rSrcSizePixel );
aSrcRect.Justify();
if( !rBmp.IsEmpty() && aSrcRect.GetWidth() && aSrcRect.GetHeight() && aDestSz.Width() && aDestSz.Height() )
{
Bitmap aPaint( rBmp ), aMask( rMask );
sal_uLong nMirrFlags = 0UL;
if( aMask.GetBitCount() > 1 )
aMask.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
// mirrored horizontically
if( aDestSz.Width() < 0L )
{
aDestSz.Width() = -aDestSz.Width();
aDestPt.X() -= ( aDestSz.Width() - 1L );
nMirrFlags |= BMP_MIRROR_HORZ;
}
// mirrored vertically
if( aDestSz.Height() < 0L )
{
aDestSz.Height() = -aDestSz.Height();
aDestPt.Y() -= ( aDestSz.Height() - 1L );
nMirrFlags |= BMP_MIRROR_VERT;
}
// source cropped?
if( aSrcRect != Rectangle( aPt, aPaint.GetSizePixel() ) )
{
aPaint.Crop( aSrcRect );
aMask.Crop( aSrcRect );
}
// destination mirrored
if( nMirrFlags )
{
aPaint.Mirror( nMirrFlags );
aMask.Mirror( nMirrFlags );
}
// we always want to have a mask
if( aMask.IsEmpty() )
{
aMask = Bitmap( aSrcRect.GetSize(), 1 );
aMask.Erase( Color( COL_BLACK ) );
}
// do painting
const long nSrcWidth = aSrcRect.GetWidth(), nSrcHeight = aSrcRect.GetHeight();
long nX, nY; // , nWorkX, nWorkY, nWorkWidth, nWorkHeight;
boost::scoped_array<long> pMapX(new long[ nSrcWidth + 1 ]);
boost::scoped_array<long> pMapY(new long[ nSrcHeight + 1 ]);
const bool bOldMap = mbMap;
mbMap = false;
// create forward mapping tables
for( nX = 0L; nX <= nSrcWidth; nX++ )
pMapX[ nX ] = aDestPt.X() + FRound( (double) aDestSz.Width() * nX / nSrcWidth );
for( nY = 0L; nY <= nSrcHeight; nY++ )
pMapY[ nY ] = aDestPt.Y() + FRound( (double) aDestSz.Height() * nY / nSrcHeight );
// walk through all rectangles of mask
const Region aWorkRgn(aMask.CreateRegion(COL_BLACK, Rectangle(Point(), aMask.GetSizePixel())));
RectangleVector aRectangles;
aWorkRgn.GetRegionRectangles(aRectangles);
for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
{
const Point aMapPt(pMapX[aRectIter->Left()], pMapY[aRectIter->Top()]);
const Size aMapSz(
pMapX[aRectIter->Right() + 1] - aMapPt.X(), // pMapX[L + W] -> L + ((R - L) + 1) -> R + 1
pMapY[aRectIter->Bottom() + 1] - aMapPt.Y()); // same for Y
Bitmap aBandBmp(aPaint);
aBandBmp.Crop(*aRectIter);
ImplDrawBitmap(aMapPt, aMapSz, Point(), aBandBmp.GetSizePixel(), aBandBmp, META_BMPSCALEPART_ACTION);
}
mbMap = bOldMap;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <tools/debug.hxx>
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/window.hxx>
#include <vcl/metaact.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/virdev.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/outdev.hxx>
#include <vcl/image.hxx>
#include <bmpfast.hxx>
#include <salbmp.hxx>
#include <salgdi.hxx>
#include <impbmp.hxx>
#include <sallayout.hxx>
#include <image.h>
#include <outdev.h>
#include <window.h>
#include <outdata.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <boost/scoped_array.hpp>
sal_uLong ImplAdjustTwoRect( SalTwoRect& rTwoRect, const Size& rSizePix )
{
sal_uLong nMirrFlags = 0;
if ( rTwoRect.mnDestWidth < 0 )
{
rTwoRect.mnSrcX = rSizePix.Width() - rTwoRect.mnSrcX - rTwoRect.mnSrcWidth;
rTwoRect.mnDestWidth = -rTwoRect.mnDestWidth;
rTwoRect.mnDestX -= rTwoRect.mnDestWidth-1;
nMirrFlags |= BMP_MIRROR_HORZ;
}
if ( rTwoRect.mnDestHeight < 0 )
{
rTwoRect.mnSrcY = rSizePix.Height() - rTwoRect.mnSrcY - rTwoRect.mnSrcHeight;
rTwoRect.mnDestHeight = -rTwoRect.mnDestHeight;
rTwoRect.mnDestY -= rTwoRect.mnDestHeight-1;
nMirrFlags |= BMP_MIRROR_VERT;
}
if( ( rTwoRect.mnSrcX < 0 ) || ( rTwoRect.mnSrcX >= rSizePix.Width() ) ||
( rTwoRect.mnSrcY < 0 ) || ( rTwoRect.mnSrcY >= rSizePix.Height() ) ||
( ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) > rSizePix.Width() ) ||
( ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) > rSizePix.Height() ) )
{
const Rectangle aSourceRect( Point( rTwoRect.mnSrcX, rTwoRect.mnSrcY ),
Size( rTwoRect.mnSrcWidth, rTwoRect.mnSrcHeight ) );
Rectangle aCropRect( aSourceRect );
aCropRect.Intersection( Rectangle( Point(), rSizePix ) );
if( aCropRect.IsEmpty() )
rTwoRect.mnSrcWidth = rTwoRect.mnSrcHeight = rTwoRect.mnDestWidth = rTwoRect.mnDestHeight = 0;
else
{
const double fFactorX = ( rTwoRect.mnSrcWidth > 1 ) ? (double) ( rTwoRect.mnDestWidth - 1 ) / ( rTwoRect.mnSrcWidth - 1 ) : 0.0;
const double fFactorY = ( rTwoRect.mnSrcHeight > 1 ) ? (double) ( rTwoRect.mnDestHeight - 1 ) / ( rTwoRect.mnSrcHeight - 1 ) : 0.0;
const long nDstX1 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Left() - rTwoRect.mnSrcX ) );
const long nDstY1 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Top() - rTwoRect.mnSrcY ) );
const long nDstX2 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Right() - rTwoRect.mnSrcX ) );
const long nDstY2 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Bottom() - rTwoRect.mnSrcY ) );
rTwoRect.mnSrcX = aCropRect.Left();
rTwoRect.mnSrcY = aCropRect.Top();
rTwoRect.mnSrcWidth = aCropRect.GetWidth();
rTwoRect.mnSrcHeight = aCropRect.GetHeight();
rTwoRect.mnDestX = nDstX1;
rTwoRect.mnDestY = nDstY1;
rTwoRect.mnDestWidth = nDstX2 - nDstX1 + 1;
rTwoRect.mnDestHeight = nDstY2 - nDstY1 + 1;
}
}
return nMirrFlags;
}
void ImplAdjustTwoRect( SalTwoRect& rTwoRect, const Rectangle& rValidSrcRect )
{
if( ( rTwoRect.mnSrcX < rValidSrcRect.Left() ) || ( rTwoRect.mnSrcX >= rValidSrcRect.Right() ) ||
( rTwoRect.mnSrcY < rValidSrcRect.Top() ) || ( rTwoRect.mnSrcY >= rValidSrcRect.Bottom() ) ||
( ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) > rValidSrcRect.Right() ) ||
( ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) > rValidSrcRect.Bottom() ) )
{
const Rectangle aSourceRect( Point( rTwoRect.mnSrcX, rTwoRect.mnSrcY ),
Size( rTwoRect.mnSrcWidth, rTwoRect.mnSrcHeight ) );
Rectangle aCropRect( aSourceRect );
aCropRect.Intersection( rValidSrcRect );
if( aCropRect.IsEmpty() )
rTwoRect.mnSrcWidth = rTwoRect.mnSrcHeight = rTwoRect.mnDestWidth = rTwoRect.mnDestHeight = 0;
else
{
const double fFactorX = ( rTwoRect.mnSrcWidth > 1 ) ? (double) ( rTwoRect.mnDestWidth - 1 ) / ( rTwoRect.mnSrcWidth - 1 ) : 0.0;
const double fFactorY = ( rTwoRect.mnSrcHeight > 1 ) ? (double) ( rTwoRect.mnDestHeight - 1 ) / ( rTwoRect.mnSrcHeight - 1 ) : 0.0;
const long nDstX1 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Left() - rTwoRect.mnSrcX ) );
const long nDstY1 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Top() - rTwoRect.mnSrcY ) );
const long nDstX2 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Right() - rTwoRect.mnSrcX ) );
const long nDstY2 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Bottom() - rTwoRect.mnSrcY ) );
rTwoRect.mnSrcX = aCropRect.Left();
rTwoRect.mnSrcY = aCropRect.Top();
rTwoRect.mnSrcWidth = aCropRect.GetWidth();
rTwoRect.mnSrcHeight = aCropRect.GetHeight();
rTwoRect.mnDestX = nDstX1;
rTwoRect.mnDestY = nDstY1;
rTwoRect.mnDestWidth = nDstX2 - nDstX1 + 1;
rTwoRect.mnDestHeight = nDstY2 - nDstY1 + 1;
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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