You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ja...@apache.org on 2013/09/27 17:26:50 UTC
svn commit: r1526954 [33/34] - in /openoffice/branches/l10n40: ./
ext_sources/ extras/l10n/source/ast/ extras/l10n/source/cs/
extras/l10n/source/de/ extras/l10n/source/el/ extras/l10n/source/en-GB/
extras/l10n/source/es/ extras/l10n/source/eu/ extras/l...
Modified: openoffice/branches/l10n40/main/sw/source/ui/uno/unotxdoc.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sw/source/ui/uno/unotxdoc.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sw/source/ui/uno/unotxdoc.cxx (original)
+++ openoffice/branches/l10n40/main/sw/source/ui/uno/unotxdoc.cxx Fri Sep 27 15:26:24 2013
@@ -618,8 +618,16 @@ void SwXTextDocument::dispose(void) thro
-----------------------------------------------------------------------*/
void SwXTextDocument::close( sal_Bool bDeliverOwnership ) throw( util::CloseVetoException, RuntimeException )
{
- if(IsValid() && m_pHiddenViewFrame)
+ if ( IsValid() && m_pHiddenViewFrame )
+ {
+ ASSERT( false, "<SwXTextDocument::close(..)> - rendering data not cleaned up???" );
lcl_DisposeView( m_pHiddenViewFrame, pDocShell);
+ m_pHiddenViewFrame = 0;
+ // prevent crash described in #i108805
+ SfxItemSet *pSet = pDocShell->GetMedium()->GetItemSet();
+ pSet->Put( SfxBoolItem( SID_HIDDEN, sal_False ) );
+ }
+
SfxBaseModel::close(bDeliverOwnership);
}
/*-- 18.12.98 13:12:25---------------------------------------------------
@@ -1510,9 +1518,9 @@ SwXDrawPage* SwXTextDocument::GetDrawPag
-----------------------------------------------------------------------*/
void SwXTextDocument::Invalidate()
{
- bObjectValid = sal_False;
- if(xNumFmtAgg.is())
- {
+ bObjectValid = sal_False;
+ if(xNumFmtAgg.is())
+ {
const uno::Type& rTunnelType = ::getCppuType((Reference <XUnoTunnel>*)0);
Any aNumTunnel = xNumFmtAgg->queryAggregation(rTunnelType);
SvNumberFormatsSupplierObj* pNumFmt = 0;
@@ -1524,10 +1532,10 @@ void SwXTextDocument::Invalidate()
pNumFmt->SetNumberFormatter(0);
}
DBG_ASSERT(pNumFmt, "No number formatter available");
- }
- InitNewDoc();
- pDocShell = 0;
- aRefreshCont.Disposing();
+ }
+ InitNewDoc();
+ pDocShell = 0;
+ aRefreshCont.Disposing();
}
/* -----------------------------13.07.00 15:59--------------------------------
@@ -2661,24 +2669,41 @@ sal_Int32 SAL_CALL SwXTextDocument::getR
const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" );
bool bIsSwSrcView = false;
SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport );
-
- if (!bIsSwSrcView && !m_pRenderData)
- m_pRenderData = new SwRenderData;
- if (!m_pPrintUIOptions)
- m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView );
- bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions );
- // const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport );
-
+
SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport );
DBG_ASSERT( pDoc && pView, "doc or view shell missing!" );
- if (!pDoc || !pView)
+ if ( pDoc == 0 || pView == 0 )
+ {
return 0;
+ }
+
+ // clean up <RenderData> and <PrintUIOptions>
+ {
+ if ( m_pRenderData )
+ {
+ delete m_pRenderData;
+ m_pRenderData = 0;
+ }
+ if ( m_pPrintUIOptions )
+ {
+ delete m_pPrintUIOptions;
+ m_pPrintUIOptions = 0;
+ }
+ }
+
+ if ( !bIsSwSrcView )
+ {
+ m_pRenderData = new SwRenderData;
+ }
+ // new <PrintUIOptions>
+ m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView );
+ const bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions );
// save current UI options from the print dialog for the next call to that dialog
lcl_SavePrintUIOptionsToDocumentPrintData( *pDoc, *m_pPrintUIOptions, bIsPDFExport );
sal_Int32 nRet = 0;
- if (bIsSwSrcView)
+ if ( bIsSwSrcView )
{
SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView);
OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
@@ -2711,7 +2736,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getR
if (!pViewShell || !pViewShell->GetLayout())
return 0;
- if (bFormat)
+ if ( bFormat )
{
// #i38289
if( pViewShell->GetViewOptions()->getBrowseMode() )
@@ -2727,7 +2752,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getR
// We don't want that! Thus we disable updating of the view.
pViewShell->StartAction();
- if (pSwView)
+ if ( pSwView )
{
if (m_pRenderData && m_pRenderData->NeedNewViewOptionAdjust( *pViewShell ) )
m_pRenderData->ViewOptionAdjustStop();
@@ -2739,11 +2764,12 @@ sal_Int32 SAL_CALL SwXTextDocument::getR
m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell,
m_pPrintUIOptions, m_pRenderData, bIsPDFExport );
- if (pSwView)
+ if ( pSwView )
{
// PDF export should not make use of the SwPrtOptions
const SwPrintData *pPrtOptions = (bIsPDFExport)
- ? NULL : m_pRenderData->GetSwPrtOptions();
+ ? NULL
+ : m_pRenderData->GetSwPrtOptions();
m_pRenderData->ViewOptionAdjust( pPrtOptions );
}
@@ -2758,7 +2784,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getR
pRenderDocShell->EnableSetModified( sal_False );
bStateChanged = true;
}
-
+
// --> FME 2005-05-23 #122919# Force field update before PDF export:
pViewShell->ViewShell::UpdateFlds(sal_True);
// <--
@@ -2770,9 +2796,9 @@ sal_Int32 SAL_CALL SwXTextDocument::getR
//TODO: check what exatly needs to be done and make just one function for that
pViewShell->CalcLayout();
pViewShell->CalcPagesForPrint( pViewShell->GetPageCount() );
-
+
pViewShell->SetPDFExportOption( sal_False );
-
+
// enable view again
pViewShell->EndAction();
}
@@ -2854,10 +2880,7 @@ uno::Sequence< beans::PropertyValue > SA
if (!pDoc || !pView)
return uno::Sequence< beans::PropertyValue >();
- // due to #110067# (document page count changes sometimes during
- // PDF export/printing) we can not check for the upper bound properly.
- // Thus instead of throwing the exception we silently return.
- if (0 > nRenderer)
+ if ( nRenderer < 0 || nRenderer >= SAL_MAX_UINT16 )
throw IllegalArgumentException();
// TODO/mba: we really need a generic way to get the ViewShell!
@@ -2884,15 +2907,10 @@ uno::Sequence< beans::PropertyValue > SA
uno::Sequence< beans::PropertyValue > aRenderer;
if (m_pRenderData)
{
- // --> TL, OD 2010-09-07 #i114210#
- // determine the correct page number from the renderer index
- // --> OD 2010-10-01 #i114875
- // consider brochure print
- const sal_uInt16 nPage = bPrintProspect
- ? nRenderer + 1
- : m_pRenderData->GetPagesToPrint()[ nRenderer ];
- // <--
-
+ const sal_Int32 nPage = bPrintProspect
+ ? nRenderer + 1
+ : m_pRenderData->GetPagesToPrint()[ nRenderer ];
+
// get paper tray to use ...
sal_Int32 nPrinterPaperTray = -1;
if (! bPrintPaperFromSetup)
@@ -2928,19 +2946,6 @@ uno::Sequence< beans::PropertyValue > SA
aTmpSize = pPrinter->LogicToLogic( aTmpSize,
pPrinter->GetMapMode(), MapMode( MAP_100TH_MM ));
aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() );
- #if 0
- // #i115048# it seems users didn't like getting double the formatted page size
- // revert to "old" behavior scaling to the current paper size of the printer
- if (bPrintProspect)
- {
- // we just state what output size we would need
- // which may cause vcl to set that page size on the printer
- // (if available and not overriden by the user)
- aTmpSize = pVwSh->GetPageSize( nPage, bIsSkipEmptyPages );
- aPreferredPageSize = awt::Size ( TWIP_TO_MM100( 2 * aTmpSize.Width() ),
- TWIP_TO_MM100( aTmpSize.Height() ));
- }
- #else
if( bPrintProspect )
{
// just switch to an appropriate portrait/landscape format
@@ -2953,12 +2958,13 @@ uno::Sequence< beans::PropertyValue > SA
aPreferredPageSize.Height = aPageSize.Width;
}
}
- #endif
}
}
else
{
- aTmpSize = pVwSh->GetPageSize( nPage, bIsSkipEmptyPages );
+ ASSERT( nPage > 0 && nPage <= SAL_MAX_UINT16,
+ "<SwXTextDocument::getRenderer(..)> - unexpected value for the page number, it does not fit into sal_uInt16." );
+ aTmpSize = pVwSh->GetPageSize( static_cast< sal_uInt16 >(nPage), bIsSkipEmptyPages );
aPageSize = awt::Size ( TWIP_TO_MM100( aTmpSize.Width() ),
TWIP_TO_MM100( aTmpSize.Height() ));
}
@@ -2985,7 +2991,6 @@ uno::Sequence< beans::PropertyValue > SA
}
}
- // --> OD #i117783#
if ( bApplyPagePrintSettingsFromXPagePrintable )
{
const SwPagePreViewPrtData* pPagePrintSettings =
@@ -3040,7 +3045,6 @@ uno::Sequence< beans::PropertyValue > SA
bApplyPagePrintSettingsFromXPagePrintable = sal_False;
}
- // <--
m_pPrintUIOptions->appendPrintUIOptions( aRenderer );
@@ -3086,9 +3090,6 @@ SfxViewShell * SwXTextDocument::GuessVie
if (pView)
rbIsSwSrcView = pSwSrcView != 0;
return pView;
-// return pSwView ? dynamic_cast< SfxViewShell * >(pSwView) :
-// (pSwSrcView ? dynamic_cast< SfxViewShell * >(pSwSrcView) :
-// dynamic_cast< SfxViewShell * >(pSwPagePreView) );
}
@@ -3111,13 +3112,19 @@ void SAL_CALL SwXTextDocument::render(
const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" );
bool bIsSwSrcView = false;
SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport );
-
- DBG_ASSERT( m_pRenderData, "data should have been created already in getRendererCount..." );
- DBG_ASSERT( m_pPrintUIOptions, "data should have been created already in getRendererCount..." );
- if (!bIsSwSrcView && !m_pRenderData)
+
+ // error handling - avoid crash
+ if ( !bIsSwSrcView && m_pRenderData == NULL )
+ {
+ DBG_ASSERT( false, "data should have been created already in getRendererCount..." );
m_pRenderData = new SwRenderData;
- if (!m_pPrintUIOptions)
+ }
+ if ( m_pPrintUIOptions == 0 )
+ {
+ DBG_ASSERT( false, "data should have been created already in getRendererCount..." );
m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView );
+ }
+
m_pPrintUIOptions->processProperties( rxOptions );
const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false );
const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False );
@@ -3161,7 +3168,7 @@ void SAL_CALL SwXTextDocument::render(
else
pVwSh = ((SwPagePreView*)pView)->GetViewShell();
}
-
+
// get output device to use
OutputDevice * pOut = lcl_GetOutputDevice( *m_pPrintUIOptions );
@@ -3170,11 +3177,11 @@ void SAL_CALL SwXTextDocument::render(
const rtl::OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() );
const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage", sal_False );
bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport );
-
+
DBG_ASSERT(( pView->IsA(aSwViewTypeId) && m_pRenderData->IsViewOptionAdjust())
|| (!pView->IsA(aSwViewTypeId) && !m_pRenderData->IsViewOptionAdjust()),
"SwView / SwViewOptionAdjust_Impl availability mismatch" );
-
+
// since printing now also use the API for PDF export this option
// should be set for printing as well ...
pVwSh->SetPDFExportOption( sal_True );
@@ -3202,8 +3209,6 @@ void SAL_CALL SwXTextDocument::render(
else // normal printing and PDF export
pVwSh->PrintOrPDFExport( pOut, rSwPrtOptions, nRenderer );
- // --> FME 2004-10-08 #i35176#
- //
// After printing the last page, we take care for the links coming
// from the EditEngine. The links are generated during the painting
// process, but the destinations are still missing.
@@ -3212,41 +3217,17 @@ void SAL_CALL SwXTextDocument::render(
{
SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_True );
}
- // <--
-
- pVwSh->SetPDFExportOption( sal_False );
-
- // last page to be rendered? (not necessarily the last page of the document)
- // -> do clean-up of data
- if (bLastPage)
- {
- // #i96167# haggai: delete ViewOptionsAdjust here because it makes use
- // of the shell, which might get destroyed in lcl_DisposeView!
- if (m_pRenderData && m_pRenderData->IsViewOptionAdjust())
- m_pRenderData->ViewOptionAdjustStop();
-
- if (m_pRenderData && m_pRenderData->HasPostItData())
- m_pRenderData->DeletePostItData();
- if (m_pHiddenViewFrame)
- {
- lcl_DisposeView( m_pHiddenViewFrame, pDocShell );
- m_pHiddenViewFrame = 0;
-
- // prevent crash described in #i108805
- SwDocShell *pRenderDocShell = pDoc->GetDocShell();
- SfxItemSet *pSet = pRenderDocShell->GetMedium()->GetItemSet();
- pSet->Put( SfxBoolItem( SID_HIDDEN, sal_False ) );
- }
- }
+ pVwSh->SetPDFExportOption( sal_False );
}
}
}
}
- if( bLastPage )
+ // last page to be rendered? (not necessarily the last page of the document)
+ // -> do clean-up of data
+ if ( bLastPage )
{
- delete m_pRenderData; m_pRenderData = NULL;
- delete m_pPrintUIOptions; m_pPrintUIOptions = NULL;
+ CleanUpRenderingData();
}
}
/* -----------------------------03.10.04 -------------------------------------
@@ -3504,21 +3485,35 @@ uno::Sequence< lang::Locale > SAL_CALL S
return aLanguages;
}
-// #121125# react on ViewShell change; a reference to the ViewShell is
-// held in SwViewOptionAdjust_Impl, thus needs to be cleaned up
-void SwXTextDocument::ReactOnViewShellChange()
+// #121125#, #122868#
+// method to assure clean up of the rendering data to restore view options
+// and to loose hold reference to the ViewShell in SwViewOptionAdjust_Impl.
+// also perform clean up for the still existing hidden frame for PDF export from Page Preview
+void SwXTextDocument::CleanUpRenderingData()
{
- if(m_pRenderData)
+ if( m_pRenderData != NULL )
{
- delete m_pRenderData;
+ if ( m_pRenderData->HasPostItData() )
+ {
+ m_pRenderData->DeletePostItData();
+ }
+ delete m_pRenderData;
m_pRenderData = NULL;
}
- if(m_pPrintUIOptions)
+ if( m_pPrintUIOptions != NULL )
{
- delete m_pPrintUIOptions;
+ delete m_pPrintUIOptions;
m_pPrintUIOptions = NULL;
}
+
+ if ( IsValid() && m_pHiddenViewFrame )
+ {
+ lcl_DisposeView( m_pHiddenViewFrame, pDocShell);
+ m_pHiddenViewFrame = 0;
+ SfxItemSet *pSet = pDocShell->GetMedium()->GetItemSet();
+ pSet->Put( SfxBoolItem( SID_HIDDEN, sal_False ) );
+ }
}
/* -----------------25.10.99 11:06-------------------
Modified: openoffice/branches/l10n40/main/sw/source/ui/utlui/content.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sw/source/ui/utlui/content.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/sw/source/ui/utlui/content.cxx (original)
+++ openoffice/branches/l10n40/main/sw/source/ui/utlui/content.cxx Fri Sep 27 15:26:24 2013
@@ -416,7 +416,7 @@ void SwContentType::Init(sal_Bool* pbInv
if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() &&
(*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE )
{
- String sEntry = aFmtFld->GetFld()->GetPar2();
+ String sEntry = aFmtFld->GetField()->GetPar2();
RemoveNewline(sEntry);
SwPostItContent* pCnt = new SwPostItContent(
this,
@@ -427,25 +427,6 @@ void SwContentType::Init(sal_Bool* pbInv
nMemberCount++;
}
}
- /*
- // this code can be used once we want redline comments in the margin
- else // redcomment
- {
- SwRedline* pRedline = static_cast<SwRedline*>((*i)->GetBroadCaster());
- if ( pRedline->GetComment() != String(::rtl::OUString::createFromAscii("")) )
- {
- String sEntry = pRedline->GetComment();
- RemoveNewline(sEntry);
- SwPostItContent* pCnt = new SwPostItContent(
- this,
- sEntry, // hier steht der Text
- pRedline,
- nMemberCount);
- pMember->Insert(pCnt);
- nMemberCount++;
- }
- }
- */
}
}
//
@@ -783,7 +764,7 @@ void SwContentType::FillMemberList(sal_B
if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() &&
(*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE )
{
- String sEntry = aFmtFld->GetFld()->GetPar2();
+ String sEntry = aFmtFld->GetField()->GetPar2();
RemoveNewline(sEntry);
SwPostItContent* pCnt = new SwPostItContent(
this,
Modified: openoffice/branches/l10n40/main/sysui/desktop/icons/main.icns
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/sysui/desktop/icons/main.icns?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
Binary files - no diff available.
Modified: openoffice/branches/l10n40/main/unoil/climaker/version.txt
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/unoil/climaker/version.txt?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/unoil/climaker/version.txt (original)
+++ openoffice/branches/l10n40/main/unoil/climaker/version.txt Fri Sep 27 15:26:24 2013
@@ -19,8 +19,8 @@
#
#**************************************************************
-CLI_OOOTYPES_NEW_VERSION=1.0.8.0
-CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.7.0
-CLI_OOOTYPES_POLICY_VERSION=8.0.0.0
+CLI_OOOTYPES_NEW_VERSION=1.0.9.0
+CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.8.0
+CLI_OOOTYPES_POLICY_VERSION=9.0.0.0
CLI_OOOTYPES_POLICY_ASSEMBLY=policy.1.0.cli_oootypes
Modified: openoffice/branches/l10n40/main/vcl/inc/vcl/bitmapex.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/inc/vcl/bitmapex.hxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/vcl/inc/vcl/bitmapex.hxx (original)
+++ openoffice/branches/l10n40/main/vcl/inc/vcl/bitmapex.hxx Fri Sep 27 15:26:24 2013
@@ -393,25 +393,42 @@ public:
@param rTransformation
The back transformation for each pixel in (0 .. fWidth),(0 .. fHeight) to
local pixel coordiantes
+
+ @param bSmooth
+ Defines if pixel interpolation is to be used to create the result
*/
BitmapEx TransformBitmapEx(
double fWidth,
double fHeight,
- const basegfx::B2DHomMatrix& rTransformation) const;
+ const basegfx::B2DHomMatrix& rTransformation,
+ bool bSmooth = true) const;
/** Create transformed Bitmap
@param rTransformation
- The transformation from unit coordinates to target
+ The transformation from unit coordinates to the unit range
+
+ @param rVisibleRange
+ The relative visible range in unit coordinates, relative to (0,0,1,1) which
+ defines the whole target area
@param fMaximumArea
A limitation for the maximum size of pixels to use for the result
+ @param bSmooth
+ Defines if pixel interpolation is to be used to create the result
+
+ The traget size of the result bitmap is defined by transforming the given
+ rTargetRange with the given rTransformation; the area of the result is
+ linearly scaled to not exceed the given fMaximumArea
+
@return The transformed bitmap
*/
BitmapEx getTransformed(
const basegfx::B2DHomMatrix& rTransformation,
- double fMaximumArea = 500000.0) const;
+ const basegfx::B2DRange& rVisibleRange,
+ double fMaximumArea = 500000.0,
+ bool bSmooth = true) const;
/** Create ColorStack-modified version of this BitmapEx
Modified: openoffice/branches/l10n40/main/vcl/inc/vcl/bmpacc.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/inc/vcl/bmpacc.hxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/vcl/inc/vcl/bmpacc.hxx (original)
+++ openoffice/branches/l10n40/main/vcl/inc/vcl/bmpacc.hxx Fri Sep 27 15:26:24 2013
@@ -171,6 +171,16 @@ public:
inline BitmapColor GetColor( long nY, long nX ) const;
inline sal_uInt8 GetPixelIndex( long nY, long nX ) const;
inline sal_uInt8 GetLuminance( long nY, long nX ) const;
+
+ /** Get the interpolated color at coordinates fY, fX; if outside, return rFallback */
+ BitmapColor GetInterpolatedColorWithFallback( double fY, double fX, const BitmapColor& rFallback ) const;
+
+ /** Get the color at coordinates fY, fX; if outside, return rFallback. Automatically does the correct
+ inside/outside checks, e.g. static_cast< sal_uInt32 >(-0.25) *is* 0, not -1 and has to be outside */
+ BitmapColor GetColorWithFallback( double fY, double fX, const BitmapColor& rFallback ) const;
+
+ /** Get the color at coordinates nY, nX; if outside, return rFallback */
+ BitmapColor GetColorWithFallback( long nY, long nX, const BitmapColor& rFallback ) const;
};
// ---------------------
Modified: openoffice/branches/l10n40/main/vcl/os2/source/gdi/salprn.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/os2/source/gdi/salprn.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/vcl/os2/source/gdi/salprn.cxx (original)
+++ openoffice/branches/l10n40/main/vcl/os2/source/gdi/salprn.cxx Fri Sep 27 15:26:24 2013
@@ -57,32 +57,8 @@
#include <print.h>
#include <jobset.h>
-/*
-#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
-#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
-#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <comphelper/processfactory.hxx>
-*/
-
#include <malloc.h>
-/*
-#define _SV_SALPRN_CXX
-#include <tools/debug.hxx>
-#include <saldata.hxx>
-#include <salinst.h>
-#include <salgdi.h>
-#include <salframe.h>
-#include <vcl/salptype.hxx>
-#include <salprn.h>
-#include <vcl/print.h>
-#include <vcl/jobset.h>
-
-*/
-
#ifndef __H_FT2LIB
#include <os2/wingdi.h>
#include <ft2lib.h>
@@ -583,11 +559,15 @@ static void ImplFreeFormAndTrayList( Os2
static void ImplGetFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter, const ImplJobSetup* pSetupData )
{
+ // if not defined, suppose default orientation is portrait
+ Orientation orientation = ORIENTATION_PORTRAIT;
+
ImplFreeFormAndTrayList( pOs2SalInfoPrinter );
LONG alQuery[] =
{
0, 0, // First two members of QUERYSIZE
+ DJP_SJ_ORIENTATION, DJP_CURRENT,
DJP_CJ_FORM, DJP_ALL,
DJP_CJ_TRAYNAME, DJP_ALL,
DJP_NONE, DJP_NONE // EOL marker
@@ -638,7 +618,18 @@ static void ImplGetFormAndTrayList( Os2S
PQUERYTUPLE pTuple = pQuerySize->aTuples;
while ( DJP_NONE != pTuple->ulProperty )
{
- if ( pDJP->ulProperty == DJP_CJ_FORM )
+ if ( pDJP->ulProperty == DJP_SJ_ORIENTATION )
+ {
+ if ( pDJP->ulNumReturned )
+ {
+ PDJPT_ORIENTATION pElm = DJP_ELEMENTP( *pDJP, DJPT_ORIENTATION );
+ if ( (DJP_ORI_PORTRAIT == *pElm) || (DJP_ORI_REV_PORTRAIT == *pElm) )
+ orientation = ORIENTATION_PORTRAIT;
+ else
+ orientation = ORIENTATION_LANDSCAPE;
+ }
+ }
+ else if ( pDJP->ulProperty == DJP_CJ_FORM )
{
if ( pDJP->ulNumReturned )
{
@@ -649,11 +640,20 @@ static void ImplGetFormAndTrayList( Os2S
for( int i = 0; i < pDJP->ulNumReturned; i++, pElm++ )
{
ImplFormInfo* pInfo = new ImplFormInfo;
- pInfo->mnPaperWidth = pElm->hcInfo.cx;
- pInfo->mnPaperHeight = pElm->hcInfo.cy;
+ // AOO expects form size always in portrait mode
+ if (orientation == ORIENTATION_PORTRAIT)
+ {
+ pInfo->mnPaperWidth = pElm->hcInfo.cx;
+ pInfo->mnPaperHeight = pElm->hcInfo.cy;
+ }
+ else
+ {
+ pInfo->mnPaperWidth = pElm->hcInfo.cy;
+ pInfo->mnPaperHeight = pElm->hcInfo.cx;
+ }
#if OSL_DEBUG_LEVEL>0
- printf("ImplGetFormAndTrayList mnPaperWidth %d\n", pInfo->mnPaperWidth);
- printf("ImplGetFormAndTrayList mnPaperHeight %d\n", pInfo->mnPaperHeight);
+ debug_printf("ImplGetFormAndTrayList #%d: %d x %d",
+ i, pInfo->mnPaperWidth, pInfo->mnPaperHeight);
#endif
pInfo->mnId = pElm->djppsFormID;
pOs2SalInfoPrinter->mpFormArray[i] = pInfo;
@@ -865,6 +865,9 @@ static sal_Bool ImplSetOrientation( HDC
DJP_SJ_ORIENTATION, DJP_CURRENT,
DJP_NONE, DJP_NONE // EOL marker
};
+#if OSL_DEBUG_LEVEL>0
+ debug_printf( "ImplSetOrientation mhDC %x, %d", hPrinterDC, eOrientation);
+#endif
APIRET rc;
PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery;
@@ -1164,6 +1167,7 @@ Os2SalInfoPrinter::Os2SalInfoPrinter()
mpFormArray = NULL;
mnTrayCount = 0;
mpTrayArray = NULL;
+ m_bPapersInit = FALSE;
}
// -----------------------------------------------------------------------
@@ -1181,6 +1185,42 @@ Os2SalInfoPrinter::~Os2SalInfoPrinter()
// -----------------------------------------------------------------------
+void Os2SalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData )
+{
+#if OSL_DEBUG_LEVEL>0
+ debug_printf( "Os2SalInfoPrinter::InitPaperFormats pSetupData %x",
+ pSetupData);
+#endif
+
+ m_aPaperFormats.clear();
+ m_bPapersInit = true;
+
+ // init paperbinlist if empty
+ if ( !mnTrayCount )
+ ImplGetFormAndTrayList( this, pSetupData );
+
+ for( int i = 0; i < mnFormCount; i++)
+ {
+ PaperInfo aInfo( mpFormArray[i]->mnPaperWidth * 100,
+ mpFormArray[i]->mnPaperHeight * 100);
+#if OSL_DEBUG_LEVEL>0
+ debug_printf( "Os2SalInfoPrinter::InitPaperFormats #%d: %d x %d",
+ i, mpFormArray[i]->mnPaperWidth * 100,
+ mpFormArray[i]->mnPaperHeight * 100);
+#endif
+ m_aPaperFormats.push_back( aInfo );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int Os2SalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData )
+{
+ return 900;
+}
+
+// -----------------------------------------------------------------------
+
SalGraphics* Os2SalInfoPrinter::GetGraphics()
{
if ( mbGraphics )
@@ -1292,6 +1332,11 @@ sal_Bool Os2SalInfoPrinter::SetPrinterDa
sal_Bool Os2SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData )
{
+#if OSL_DEBUG_LEVEL>0
+ debug_printf( "Os2SalInfoPrinter::SetData nFlags %x, pSetupData %x",
+ nFlags, pSetupData);
+#endif
+
// needs DJP support
if ( !mbDJPSupported )
return FALSE;
@@ -1306,6 +1351,9 @@ sal_Bool Os2SalInfoPrinter::SetData( ULO
// set orientation
if ( nFlags & SAL_JOBSET_ORIENTATION )
{
+#if OSL_DEBUG_LEVEL>0
+ debug_printf( "Os2SalInfoPrinter::SetData meOrientation %d", pSetupData->meOrientation);
+#endif
if ( ImplSetOrientation( mhDC, pDrivData, pSetupData->meOrientation ) )
bOK = TRUE;
}
@@ -1687,6 +1735,9 @@ sal_Bool Os2SalPrinter::StartJob( const
// Can we print with DJP
mbPrintDJPSupported = ImplIsDriverPrintDJPEnabled( mhDC );
+#if OSL_DEBUG_LEVEL>0
+ debug_printf( "mbPrintDJPSupported %d", mbPrintDJPSupported);
+#endif
// JobName ermitteln und Job starten
PSZ pszJobName = NULL;
@@ -1697,9 +1748,10 @@ sal_Bool Os2SalPrinter::StartJob( const
nJobNameLen = jobName.Len();
}
rc = DevEscape( mhDC,
- DEVESC_STARTDOC,
+ mbPrintDJPSupported ? DEVESC_STARTDOC_WPROP : DEVESC_STARTDOC,
nJobNameLen, (PBYTE)pszJobName,
- 0, (PBYTE)NULL );
+ &((PDRIVDATA)(pSetupData->mpDriverData))->cb,
+ (PBYTE)(pSetupData->mpDriverData));
if ( rc != DEV_OK )
{
@@ -1770,6 +1822,13 @@ SalGraphics* Os2SalPrinter::StartPage( I
{
APIRET rc;
+#if OSL_DEBUG_LEVEL>0
+ debug_printf( "Os2SalPrinter::StartPage mhDC %x, mbFirstPage %d, bNewJobSetup %d",
+ mhDC, mbFirstPage, bNewJobSetup);
+ debug_printf( "Os2SalPrinter::StartPage pSetupData %x",
+ pSetupData);
+#endif
+
if ( mbFirstPage )
mbFirstPage = FALSE;
else
@@ -1840,6 +1899,10 @@ SalGraphics* Os2SalPrinter::StartPage( I
sal_Bool Os2SalPrinter::EndPage()
{
+#if OSL_DEBUG_LEVEL>0
+ debug_printf( "Os2SalPrinter::EndPage mhDC %x", mhDC);
+#endif
+
if ( mpGraphics )
{
// destroy SalGraphics
@@ -1857,14 +1920,3 @@ ULONG Os2SalPrinter::GetErrorCode()
{
return mnError;
}
-
-void Os2SalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData )
-{
- printf("Os2SalInfoPrinter::InitPaperFormats\n");
-}
-int Os2SalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData )
-{
- printf("Os2SalInfoPrinter::GetLandscapeAngle\n");
- return 0;
-}
-
Modified: openoffice/branches/l10n40/main/vcl/source/gdi/bitmapex.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/source/gdi/bitmapex.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/vcl/source/gdi/bitmapex.cxx (original)
+++ openoffice/branches/l10n40/main/vcl/source/gdi/bitmapex.cxx Fri Sep 27 15:26:24 2013
@@ -837,180 +837,87 @@ sal_uInt8 BitmapEx::GetTransparency(sal_
namespace
{
- void impSmoothPoint(BitmapColor& rValue, const basegfx::B2DPoint& rSource, sal_Int32 nIntX, sal_Int32 nIntY, BitmapReadAccess& rRead)
- {
- double fDeltaX(rSource.getX() - nIntX);
- double fDeltaY(rSource.getY() - nIntY);
- sal_Int32 nIndX(0L);
- sal_Int32 nIndY(0L);
-
- if(fDeltaX > 0.0 && nIntX + 1L < rRead.Width())
- {
- nIndX++;
- }
- else if(fDeltaX < 0.0 && nIntX >= 1L)
- {
- fDeltaX = -fDeltaX;
- nIndX--;
- }
-
- if(fDeltaY > 0.0 && nIntY + 1L < rRead.Height())
- {
- nIndY++;
- }
- else if(fDeltaY < 0.0 && nIntY >= 1L)
- {
- fDeltaY = -fDeltaY;
- nIndY--;
- }
-
- if(nIndX || nIndY)
- {
- const double fColorToReal(1.0 / 255.0);
- double fR(rValue.GetRed() * fColorToReal);
- double fG(rValue.GetGreen() * fColorToReal);
- double fB(rValue.GetBlue() * fColorToReal);
- double fRBottom(0.0), fGBottom(0.0), fBBottom(0.0);
-
- if(nIndX)
- {
- const double fMulA(fDeltaX * fColorToReal);
- double fMulB(1.0 - fDeltaX);
- const BitmapColor aTopPartner(rRead.GetColor(nIntY, nIntX + nIndX));
-
- fR = (fR * fMulB) + (aTopPartner.GetRed() * fMulA);
- fG = (fG * fMulB) + (aTopPartner.GetGreen() * fMulA);
- fB = (fB * fMulB) + (aTopPartner.GetBlue() * fMulA);
-
- if(nIndY)
- {
- fMulB *= fColorToReal;
- const BitmapColor aBottom(rRead.GetColor(nIntY + nIndY, nIntX));
- const BitmapColor aBottomPartner(rRead.GetColor(nIntY + nIndY, nIntX + nIndX));
-
- fRBottom = (aBottom.GetRed() * fMulB) + (aBottomPartner.GetRed() * fMulA);
- fGBottom = (aBottom.GetGreen() * fMulB) + (aBottomPartner.GetGreen() * fMulA);
- fBBottom = (aBottom.GetBlue() * fMulB) + (aBottomPartner.GetBlue() * fMulA);
- }
- }
-
- if(nIndY)
- {
- if(!nIndX)
- {
- const BitmapColor aBottom(rRead.GetColor(nIntY + nIndY, nIntX));
-
- fRBottom = aBottom.GetRed() * fColorToReal;
- fGBottom = aBottom.GetGreen() * fColorToReal;
- fBBottom = aBottom.GetBlue() * fColorToReal;
- }
-
- const double fMulB(1.0 - fDeltaY);
-
- fR = (fR * fMulB) + (fRBottom * fDeltaY);
- fG = (fG * fMulB) + (fGBottom * fDeltaY);
- fB = (fB * fMulB) + (fBBottom * fDeltaY);
- }
-
- rValue.SetRed((sal_uInt8)(fR * 255.0));
- rValue.SetGreen((sal_uInt8)(fG * 255.0));
- rValue.SetBlue((sal_uInt8)(fB * 255.0));
- }
- }
-
- Bitmap impTransformBitmap(
+ Bitmap impTransformBitmap(
const Bitmap& rSource,
const Size aDestinationSize,
const basegfx::B2DHomMatrix& rTransform,
bool bSmooth)
- {
+ {
Bitmap aDestination(aDestinationSize, 24);
BitmapWriteAccess* pWrite = aDestination.AcquireWriteAccess();
- if(pWrite)
- {
- const Size aContentSizePixel(rSource.GetSizePixel());
- BitmapReadAccess* pRead = (const_cast< Bitmap& >(rSource)).AcquireReadAccess();
-
- if(pRead)
- {
- const Size aDestinationSizePixel(aDestination.GetSizePixel());
- bool bWorkWithIndex(rSource.GetBitCount() <= 8);
- BitmapColor aOutside(BitmapColor(0xff, 0xff, 0xff));
-
- for(sal_Int32 y(0L); y < aDestinationSizePixel.getHeight(); y++)
- {
- for(sal_Int32 x(0L); x < aDestinationSizePixel.getWidth(); x++)
- {
- const basegfx::B2DPoint aSourceCoor(rTransform * basegfx::B2DPoint(x, y));
- const sal_Int32 nIntX(basegfx::fround(aSourceCoor.getX()));
+ if(pWrite)
+ {
+ //const Size aContentSizePixel(rSource.GetSizePixel());
+ BitmapReadAccess* pRead = (const_cast< Bitmap& >(rSource)).AcquireReadAccess();
- if(nIntX >= 0L && nIntX < aContentSizePixel.getWidth())
- {
- const sal_Int32 nIntY(basegfx::fround(aSourceCoor.getY()));
+ if(pRead)
+ {
+ const Size aDestinationSizePixel(aDestination.GetSizePixel());
+ const BitmapColor aOutside(BitmapColor(0xff, 0xff, 0xff));
- if(nIntY >= 0L && nIntY < aContentSizePixel.getHeight())
- {
- // inside pixel
- BitmapColor aValue;
-
- if(bWorkWithIndex)
- {
- aValue = pRead->GetPaletteColor(pRead->GetPixelIndex(nIntY, nIntX));
- }
- else
- {
- aValue = pRead->GetPixel(nIntY, nIntX);
- }
-
- if(bSmooth)
- {
- impSmoothPoint(aValue, aSourceCoor, nIntX, nIntY, *pRead);
- }
-
- pWrite->SetPixel(y, x, aValue);
- continue;
- }
- }
+ for(sal_Int32 y(0L); y < aDestinationSizePixel.getHeight(); y++)
+ {
+ for(sal_Int32 x(0L); x < aDestinationSizePixel.getWidth(); x++)
+ {
+ const basegfx::B2DPoint aSourceCoor(rTransform * basegfx::B2DPoint(x, y));
- // here are outside pixels. Complete mask
- if(bWorkWithIndex)
- {
- pWrite->SetPixel(y, x, aOutside);
- }
- }
- }
+ if(bSmooth)
+ {
+ pWrite->SetPixel(
+ y,
+ x,
+ pRead->GetInterpolatedColorWithFallback(
+ aSourceCoor.getY(),
+ aSourceCoor.getX(),
+ aOutside));
+ }
+ else
+ {
+ // this version does the correct <= 0.0 checks, so no need
+ // to do the static_cast< sal_Int32 > self and make an error
+ pWrite->SetPixel(
+ y,
+ x,
+ pRead->GetColorWithFallback(
+ aSourceCoor.getY(),
+ aSourceCoor.getX(),
+ aOutside));
+ }
+ }
+ }
- delete pRead;
- }
+ delete pRead;
+ }
- delete pWrite;
- }
+ delete pWrite;
+ }
rSource.AdaptBitCount(aDestination);
return aDestination;
- }
+ }
} // end of anonymous namespace
+
BitmapEx BitmapEx::TransformBitmapEx(
double fWidth,
double fHeight,
- const basegfx::B2DHomMatrix& rTransformation) const
+ const basegfx::B2DHomMatrix& rTransformation,
+ bool bSmooth) const
{
if(fWidth <= 1 || fHeight <= 1)
return BitmapEx();
// force destination to 24 bit, we want to smooth output
const Size aDestinationSize(basegfx::fround(fWidth), basegfx::fround(fHeight));
- static bool bDoSmoothAtAll(true);
- const Bitmap aDestination(impTransformBitmap(GetBitmap(), aDestinationSize, rTransformation, bDoSmoothAtAll));
+ const Bitmap aDestination(impTransformBitmap(GetBitmap(), aDestinationSize, rTransformation, bSmooth));
// create mask
if(IsTransparent())
{
if(IsAlpha())
{
- const Bitmap aAlpha(impTransformBitmap(GetAlpha().GetBitmap(), aDestinationSize, rTransformation, bDoSmoothAtAll));
+ const Bitmap aAlpha(impTransformBitmap(GetAlpha().GetBitmap(), aDestinationSize, rTransformation, bSmooth));
return BitmapEx(aDestination, AlphaMask(aAlpha));
}
else
@@ -1027,7 +934,9 @@ BitmapEx BitmapEx::TransformBitmapEx(
BitmapEx BitmapEx::getTransformed(
const basegfx::B2DHomMatrix& rTransformation,
- double fMaximumArea) const
+ const basegfx::B2DRange& rVisibleRange,
+ double fMaximumArea,
+ bool bSmooth) const
{
BitmapEx aRetval;
@@ -1040,20 +949,31 @@ BitmapEx BitmapEx::getTransformed(
if(!nSourceWidth || !nSourceHeight)
return aRetval;
- // Get dest range
+ // Get aOutlineRange
basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0);
+
aOutlineRange.transform(rTransformation);
- // get target size
- double fWidth(aOutlineRange.getWidth());
- double fHeight(aOutlineRange.getHeight());
+ // create visible range from it by moving from relative to absolute
+ basegfx::B2DRange aVisibleRange(rVisibleRange);
+
+ aVisibleRange.transform(
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ aOutlineRange.getRange(),
+ aOutlineRange.getMinimum()));
+
+ // get target size (which is visible range's size)
+ double fWidth(aVisibleRange.getWidth());
+ double fHeight(aVisibleRange.getHeight());
if(fWidth < 1.0 || fHeight < 1.0)
+ {
return aRetval;
+ }
// test if discrete size (pixel) maybe too big and limit it
const double fArea(fWidth * fHeight);
- const bool bNeedToReduce(fArea > fMaximumArea);
+ const bool bNeedToReduce(basegfx::fTools::more(fArea, fMaximumArea));
double fReduceFactor(1.0);
if(bNeedToReduce)
@@ -1074,8 +994,10 @@ BitmapEx BitmapEx::getTransformed(
// aOutlineRange
aTransform = rTransformation * aTransform;
- // substract top-left of aOutlineRange
- aTransform.translate(-aOutlineRange.getMinX(), -aOutlineRange.getMinY());
+ // substract top-left of absolute VisibleRange
+ aTransform.translate(
+ -aVisibleRange.getMinX(),
+ -aVisibleRange.getMinY());
// scale to target pixels (if needed)
if(bNeedToReduce)
@@ -1087,7 +1009,7 @@ BitmapEx BitmapEx::getTransformed(
aTransform.invert();
// create bitmap using source, destination and linear back-transformation
- aRetval = TransformBitmapEx(fWidth, fHeight, aTransform);
+ aRetval = TransformBitmapEx(fWidth, fHeight, aTransform, bSmooth);
return aRetval;
}
Modified: openoffice/branches/l10n40/main/vcl/source/gdi/bmpacc.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/source/gdi/bmpacc.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/vcl/source/gdi/bmpacc.cxx (original)
+++ openoffice/branches/l10n40/main/vcl/source/gdi/bmpacc.cxx Fri Sep 27 15:26:24 2013
@@ -324,6 +324,126 @@ sal_uInt16 BitmapReadAccess::GetBestPale
return( HasPalette() ? mpBuffer->maPalette.GetBestIndex( rBitmapColor ) : 0 );
}
+BitmapColor BitmapReadAccess::GetInterpolatedColorWithFallback( double fY, double fX, const BitmapColor& rFallback ) const
+{
+ // ask directly doubles >= 0.0 here to avoid rounded values of 0 at small negative
+ // double values, e.g. static_cast< sal_Int32 >(-0.25) is 0, not -1, but *has* to be outside (!)
+ if(mpBuffer && fX >= 0.0 && fY >= 0.0)
+ {
+ const sal_Int32 nX(static_cast< sal_Int32 >(fX));
+ const sal_Int32 nY(static_cast< sal_Int32 >(fY));
+
+ if(nX < mpBuffer->mnWidth && nY < mpBuffer->mnHeight)
+ {
+ // get base-return value from inside pixel
+ BitmapColor aRetval(GetColor(nY, nX));
+
+ // calculate deltas and indices for neighbour accesses
+ sal_Int16 nDeltaX((fX - (nX + 0.5)) * 255.0); // [-255 .. 255]
+ sal_Int16 nDeltaY((fY - (nY + 0.5)) * 255.0); // [-255 .. 255]
+ sal_Int16 nIndX(0);
+ sal_Int16 nIndY(0);
+
+ if(nDeltaX > 0)
+ {
+ nIndX = nX + 1;
+ }
+ else
+ {
+ nIndX = nX - 1;
+ nDeltaX = -nDeltaX;
+ }
+
+ if(nDeltaY > 0)
+ {
+ nIndY = nY + 1;
+ }
+ else
+ {
+ nIndY = nY - 1;
+ nDeltaY = -nDeltaY;
+ }
+
+ // get right/left neighbour
+ BitmapColor aXCol(rFallback);
+
+ if(nDeltaX && nIndX >= 0 && nIndX < mpBuffer->mnWidth)
+ {
+ aXCol = GetColor(nY, nIndX);
+ }
+
+ // get top/bottom neighbour
+ BitmapColor aYCol(rFallback);
+
+ if(nDeltaY && nIndY >= 0 && nIndY < mpBuffer->mnHeight)
+ {
+ aYCol = GetColor(nIndY, nX);
+ }
+
+ // get one of four edge neighbours
+ BitmapColor aXYCol(rFallback);
+
+ if(nDeltaX && nDeltaY && nIndX >=0 && nIndY >= 0 && nIndX < mpBuffer->mnWidth && nIndY < mpBuffer->mnHeight)
+ {
+ aXYCol = GetColor(nIndY, nIndX);
+ }
+
+ // merge return value with right/left neighbour
+ if(aXCol != aRetval)
+ {
+ aRetval.Merge(aXCol, 255 - nDeltaX);
+ }
+
+ // merge top/bottom neighbour with edge
+ if(aYCol != aXYCol)
+ {
+ aYCol.Merge(aXYCol, 255 - nDeltaX);
+ }
+
+ // merge return value with already merged top/bottom neighbour
+ if(aRetval != aYCol)
+ {
+ aRetval.Merge(aYCol, 255 - nDeltaY);
+ }
+
+ return aRetval;
+ }
+ }
+
+ return rFallback;
+}
+
+BitmapColor BitmapReadAccess::GetColorWithFallback( double fY, double fX, const BitmapColor& rFallback ) const
+{
+ // ask directly doubles >= 0.0 here to avoid rounded values of 0 at small negative
+ // double values, e.g. static_cast< sal_Int32 >(-0.25) is 0, not -1, but *has* to be outside (!)
+ if(mpBuffer && fX >= 0.0 && fY >= 0.0)
+ {
+ const sal_Int32 nX(static_cast< sal_Int32 >(fX));
+ const sal_Int32 nY(static_cast< sal_Int32 >(fY));
+
+ if(nX < mpBuffer->mnWidth && nY < mpBuffer->mnHeight)
+ {
+ return GetColor(nY, nX);
+ }
+ }
+
+ return rFallback;
+}
+
+BitmapColor BitmapReadAccess::GetColorWithFallback( long nY, long nX, const BitmapColor& rFallback ) const
+{
+ if(mpBuffer)
+ {
+ if(nX >= 0 && nY >= 0 && nX < mpBuffer->mnWidth && nY < mpBuffer->mnHeight)
+ {
+ return GetColor(nY, nX);
+ }
+ }
+
+ return rFallback;
+}
+
// ---------------------
// - BitmapWriteAccess -
// ---------------------
Modified: openoffice/branches/l10n40/main/vcl/source/gdi/dibtools.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/source/gdi/dibtools.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/vcl/source/gdi/dibtools.cxx (original)
+++ openoffice/branches/l10n40/main/vcl/source/gdi/dibtools.cxx Fri Sep 27 15:26:24 2013
@@ -388,12 +388,12 @@ void ImplDecodeRLE( sal_uInt8* pBuffer,
while ( !bEndDecoding && ( nY >= 0L ) );
}
-bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& rAcc, BitmapWriteAccess* pAccAlpha, bool bTopDown)
+bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& rAcc, BitmapWriteAccess* pAccAlpha, bool bTopDown, bool& rAlphaUsed)
{
const sal_uLong nAlignedWidth = AlignedWidth4Bytes(rHeader.nWidth * rHeader.nBitCount);
- sal_uInt32 nRMask(0);
- sal_uInt32 nGMask(0);
- sal_uInt32 nBMask(0);
+ sal_uInt32 nRMask(( rHeader.nBitCount == 16 ) ? 0x00007c00UL : 0x00ff0000UL);
+ sal_uInt32 nGMask(( rHeader.nBitCount == 16 ) ? 0x000003e0UL : 0x0000ff00UL);
+ sal_uInt32 nBMask(( rHeader.nBitCount == 16 ) ? 0x0000001fUL : 0x000000ffUL);
bool bNative(false);
bool bTCMask(!pAccAlpha && ((16 == rHeader.nBitCount) || (32 == rHeader.nBitCount)));
bool bRLE((RLE_8 == rHeader.nCompression && 8 == rHeader.nBitCount) || (RLE_4 == rHeader.nCompression && 4 == rHeader.nBitCount));
@@ -430,22 +430,13 @@ bool ImplReadDIBBits(SvStream& rIStm, DI
else
{
// Read color mask
- if(bTCMask)
- {
- if(BITFIELDS == rHeader.nCompression)
- {
- rIStm.SeekRel( -12L );
- rIStm >> nRMask;
- rIStm >> nGMask;
- rIStm >> nBMask;
- }
- else
- {
- nRMask = ( rHeader.nBitCount == 16 ) ? 0x00007c00UL : 0x00ff0000UL;
- nGMask = ( rHeader.nBitCount == 16 ) ? 0x000003e0UL : 0x0000ff00UL;
- nBMask = ( rHeader.nBitCount == 16 ) ? 0x0000001fUL : 0x000000ffUL;
- }
- }
+ if(bTCMask && BITFIELDS == rHeader.nCompression)
+ {
+ rIStm.SeekRel( -12L );
+ rIStm >> nRMask;
+ rIStm >> nGMask;
+ rIStm >> nBMask;
+ }
if(bRLE)
{
@@ -601,6 +592,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DI
aMask.GetColorAndAlphaFor32Bit( aColor, aAlpha, (sal_uInt8*) pTmp32++ );
rAcc.SetPixel( nY, nX, aColor );
pAccAlpha->SetPixelIndex(nY, nX, sal_uInt8(0xff) - aAlpha);
+ rAlphaUsed |= bool(0xff != aAlpha);
}
}
}
@@ -725,6 +717,8 @@ bool ImplReadDIBBody( SvStream& rIStm, B
}
// read bits
+ bool bAlphaUsed(false);
+
if(!pIStm->GetError())
{
if(nOffset)
@@ -732,7 +726,7 @@ bool ImplReadDIBBody( SvStream& rIStm, B
pIStm->SeekRel(nOffset - (pIStm->Tell() - nStmPos));
}
- bRet = ImplReadDIBBits(*pIStm, aHeader, *pAcc, pAccAlpha, bTopDown);
+ bRet = ImplReadDIBBits(*pIStm, aHeader, *pAcc, pAccAlpha, bTopDown, bAlphaUsed);
if(bRet && aHeader.nXPelsPerMeter && aHeader.nYPelsPerMeter)
{
@@ -758,6 +752,11 @@ bool ImplReadDIBBody( SvStream& rIStm, B
if(bAlphaPossible)
{
aNewBmpAlpha.ReleaseAccess(pAccAlpha);
+
+ if(!bAlphaUsed)
+ {
+ bAlphaPossible = false;
+ }
}
if(bRet)
@@ -1240,7 +1239,7 @@ bool ImplWriteDIBBody(const Bitmap& rBit
if(pAccAlpha) // only write DIBV5 when asked to do so
{
aHeader.nV5CSType = 0x57696E20; // LCS_WINDOWS_COLOR_SPACE
- aHeader.nV5Intent = 0x00000008; // LCS_GM_ABS_COLORIMETRIC
+ aHeader.nV5Intent = 0x00000004; // LCS_GM_IMAGES
rOStm << aHeader.nV5RedMask;
rOStm << aHeader.nV5GreenMask;
Modified: openoffice/branches/l10n40/main/vcl/source/gdi/outdev2.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/source/gdi/outdev2.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/vcl/source/gdi/outdev2.cxx (original)
+++ openoffice/branches/l10n40/main/vcl/source/gdi/outdev2.cxx Fri Sep 27 15:26:24 2013
@@ -43,6 +43,7 @@
#include <window.h>
#include <outdata.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
#define BAND_MAX_SIZE 512000
@@ -818,8 +819,9 @@ void OutputDevice::DrawTransformedBitmap
const bool bSheared(!basegfx::fTools::equalZero(fShearX));
const bool bMirroredX(basegfx::fTools::less(aScale.getX(), 0.0));
const bool bMirroredY(basegfx::fTools::less(aScale.getY(), 0.0));
+ static bool bForceToOwnTransformer(false);
- if(!bRotated && !bSheared && !bMirroredX && !bMirroredY)
+ if(!bForceToOwnTransformer && !bRotated && !bSheared && !bMirroredX && !bMirroredY)
{
// with no rotation, shear or mirroring it can be mapped to DrawBitmapEx
// do *not* execute the mirroring here, it's done in the fallback
@@ -840,7 +842,7 @@ void OutputDevice::DrawTransformedBitmap
const basegfx::B2DHomMatrix aFullTransform(GetViewTransformation() * rTransformation);
const bool bTryDirectPaint(!bInvert && !bBitmapChangedColor && !bMetafile && !bPrinter);
- if(bTryDirectPaint)
+ if(!bForceToOwnTransformer && bTryDirectPaint)
{
// try to paint directly
const basegfx::B2DPoint aNull(aFullTransform * basegfx::B2DPoint(0.0, 0.0));
@@ -873,7 +875,7 @@ void OutputDevice::DrawTransformedBitmap
if(!bDone)
{
// take the fallback when no rotate and shear, but mirror (else we would have done this above)
- if(!bRotated && !bSheared)
+ if(!bForceToOwnTransformer && !bRotated && !bSheared)
{
// with no rotation or shear it can be mapped to DrawBitmapEx
// do *not* execute the mirroring here, it's done in the fallback
@@ -886,14 +888,139 @@ void OutputDevice::DrawTransformedBitmap
// fallback; create transformed bitmap the hard way (back-transform
// the pixels) and paint
- basegfx::B2DRange aTargetRange(0.0, 0.0, 1.0, 1.0);
- const double fMaximumArea(bMetafile ? 800000.0 : 200000.0);
- const BitmapEx aTransformed(rBitmapEx.getTransformed(aFullTransform, fMaximumArea));
- aTargetRange.transform(rTransformation);
- const Point aDestPt(basegfx::fround(aTargetRange.getMinX()), basegfx::fround(aTargetRange.getMinY()));
- const Size aDestSize(basegfx::fround(aTargetRange.getWidth()), basegfx::fround(aTargetRange.getHeight()));
+ basegfx::B2DRange aVisibleRange(0.0, 0.0, 1.0, 1.0);
- DrawBitmapEx(aDestPt, aDestSize, aTransformed);
+ // limit maximum area to something looking good for non-pixel-based targets (metafile, printer)
+ // by using a fixed minimum (allow at least, but no need to utilize) for good smooting and an area
+ // dependent of original size for good quality when e.g. rotated/sheared. Still, limit to a maximum
+ // to avoid crashes/ressource problems (ca. 1500x3000 here)
+ const Size& rOriginalSizePixel(rBitmapEx.GetSizePixel());
+ const double fOrigArea(rOriginalSizePixel.Width() * rOriginalSizePixel.Height() * 0.5);
+ const double fOrigAreaScaled(bSheared || bRotated ? fOrigArea * 1.44 : fOrigArea);
+ double fMaximumArea(std::min(4500000.0, std::max(1000000.0, fOrigAreaScaled)));
+
+ if(!bMetafile && !bPrinter)
+ {
+ // limit TargetRange to existing pixels (if pixel device)
+ // first get discrete range of object
+ basegfx::B2DRange aFullPixelRange(aVisibleRange);
+
+ aFullPixelRange.transform(aFullTransform);
+
+ if(basegfx::fTools::equalZero(aFullPixelRange.getWidth()) || basegfx::fTools::equalZero(aFullPixelRange.getHeight()))
+ {
+ // object is outside of visible area
+ return;
+ }
+
+ // now get discrete target pixels; start with OutDev pixel size and evtl.
+ // intersect with active clipping area
+ basegfx::B2DRange aOutPixel(
+ 0.0,
+ 0.0,
+ GetOutputSizePixel().Width(),
+ GetOutputSizePixel().Height());
+
+ if(IsClipRegion())
+ {
+ const Rectangle aRegionRectangle(GetActiveClipRegion().GetBoundRect());
+
+ aOutPixel.intersect( // caution! Range from rectangle, one too much (!)
+ basegfx::B2DRange(
+ aRegionRectangle.Left(),
+ aRegionRectangle.Top(),
+ aRegionRectangle.Right() + 1,
+ aRegionRectangle.Bottom() + 1));
+ }
+
+ if(aOutPixel.isEmpty())
+ {
+ // no active output area
+ return;
+ }
+
+ // if aFullPixelRange is not completely inside of aOutPixel,
+ // reduction of target pixels is possible
+ basegfx::B2DRange aVisiblePixelRange(aFullPixelRange);
+
+ if(!aOutPixel.isInside(aFullPixelRange))
+ {
+ aVisiblePixelRange.intersect(aOutPixel);
+
+ if(aVisiblePixelRange.isEmpty())
+ {
+ // nothing in visible part, reduces to nothing
+ return;
+ }
+
+ // aVisiblePixelRange contains the reduced output area in
+ // discrete coordinates. To make it useful everywhere, make it relative to
+ // the object range
+ basegfx::B2DHomMatrix aMakeVisibleRangeRelative;
+
+ aVisibleRange = aVisiblePixelRange;
+ aMakeVisibleRangeRelative.translate(
+ -aFullPixelRange.getMinX(),
+ -aFullPixelRange.getMinY());
+ aMakeVisibleRangeRelative.scale(
+ 1.0 / aFullPixelRange.getWidth(),
+ 1.0 / aFullPixelRange.getHeight());
+ aVisibleRange.transform(aMakeVisibleRangeRelative);
+ }
+
+ // for pixel devices, do *not* limit size, else OutputDevice::ImplDrawAlpha
+ // will create another, badly scaled bitmap to do the job. Nonetheless, do a
+ // maximum clipping of something big (1600x1280x2). Add 1.0 to avoid rounding
+ // errors in rough estimations
+ const double fNewMaxArea(aVisiblePixelRange.getWidth() * aVisiblePixelRange.getHeight());
+
+ fMaximumArea = std::min(4096000.0, fNewMaxArea + 1.0);
+ }
+
+ if(!aVisibleRange.isEmpty())
+ {
+ static bool bDoSmoothAtAll(true);
+ BitmapEx aTransformed(rBitmapEx);
+
+ // #122923# when the result needs an alpha channel due to being rotated or sheared
+ // and thus uncovering areas, add these channels so that the own transformer (used
+ // in getTransformed) also creates a transformed alpha channel
+ if(!aTransformed.IsTransparent() && (bSheared || bRotated))
+ {
+ // parts will be uncovered, extend aTransformed with a mask bitmap
+ const Bitmap aContent(aTransformed.GetBitmap());
+#if defined(MACOSX)
+ AlphaMask aMaskBmp(aContent.GetSizePixel());
+ aMaskBmp.Erase(0);
+#else
+ Bitmap aMaskBmp(aContent.GetSizePixel(), 1);
+ aMaskBmp.Erase(Color(COL_BLACK)); // #122758# Initialize to non-transparent
+#endif
+ aTransformed = BitmapEx(aContent, aMaskBmp);
+ }
+
+ aTransformed = aTransformed.getTransformed(
+ aFullTransform,
+ aVisibleRange,
+ fMaximumArea,
+ bDoSmoothAtAll);
+ basegfx::B2DRange aTargetRange(0.0, 0.0, 1.0, 1.0);
+
+ // get logic object target range
+ aTargetRange.transform(rTransformation);
+
+ // get from unified/relative VisibleRange to logoc one
+ aVisibleRange.transform(
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ aTargetRange.getRange(),
+ aTargetRange.getMinimum()));
+
+ // extract point and size; do not remove size, the bitmap may have been prepared reduced by purpose
+ const Point aDestPt(basegfx::fround(aVisibleRange.getMinX()), basegfx::fround(aVisibleRange.getMinY()));
+ const Size aDestSize(basegfx::fround(aVisibleRange.getWidth()), basegfx::fround(aVisibleRange.getHeight()));
+
+ DrawBitmapEx(aDestPt, aDestSize, aTransformed);
+ }
}
}
Modified: openoffice/branches/l10n40/main/vcl/source/gdi/pngread.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/source/gdi/pngread.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/vcl/source/gdi/pngread.cxx (original)
+++ openoffice/branches/l10n40/main/vcl/source/gdi/pngread.cxx Fri Sep 27 15:26:24 2013
@@ -151,6 +151,15 @@ private:
sal_Bool mbpHYs; // sal_True if pysical size of pixel available
sal_Bool mbIgnoreGammaChunk;
+#ifdef DBG_UTIL
+ // do some checks in debug mode
+ sal_uInt32 mnAllocSizeScanline;
+ sal_uInt32 mnAllocSizeScanlineAlpha;
+#endif
+ // the temporary Scanline (and alpha) for direct scanline copy to Bitmap
+ sal_uInt8* mpScanline;
+ sal_uInt8* mpScanlineAlpha;
+
bool ReadNextChunk();
void ReadRemainingChunks();
void SkipRemainingChunks();
@@ -204,7 +213,13 @@ PNGReaderImpl::PNGReaderImpl( SvStream&
mbIDAT( sal_False ),
mbGamma ( sal_False ),
mbpHYs ( sal_False ),
- mbIgnoreGammaChunk ( sal_False )
+ mbIgnoreGammaChunk ( sal_False ),
+#ifdef DBG_UTIL
+ mnAllocSizeScanline(0),
+ mnAllocSizeScanlineAlpha(0),
+#endif
+ mpScanline(0),
+ mpScanlineAlpha(0)
{
// prepare the PNG data stream
mnOrigStreamMode = mrPNGStream.GetNumberFormatInt();
@@ -250,6 +265,9 @@ PNGReaderImpl::~PNGReaderImpl()
delete[] mpInflateInBuf;
delete[] mpScanPrior;
delete mpZCodec;
+
+ delete[] mpScanline;
+ delete[] mpScanlineAlpha;
}
// ------------------------------------------------------------------------
@@ -1358,110 +1376,251 @@ void PNGReaderImpl::ImplDrawScanline( sa
}
else // no palette => truecolor
{
- if( mbAlphaChannel ) // has RGB + alpha
- { // BMP_FORMAT_32BIT_TC_RGBA
- if ( mnPngDepth == 8 ) // maybe the source has 16 bit per sample
- {
- if ( mpColorTable != mpDefaultColorTable )
+ // #122985# Added fast-lane implementations using CopyScanline with direct supported mem formats
+ static bool bCkeckDirectScanline(true);
+
+ if( mbAlphaChannel )
+ {
+ // has RGB + alpha
+ if ( mnPngDepth == 8 ) // maybe the source has 16 bit per sample
+ {
+ // BMP_FORMAT_32BIT_TC_RGBA
+ // only use DirectScanline when we have no preview shifting stuff and accesses to content and alpha
+ const bool bDoDirectScanline(
+ bCkeckDirectScanline && !nXStart && 1 == nXAdd && !mnPreviewShift && mpAcc && mpMaskAcc);
+ const bool bCustomColorTable(mpColorTable != mpDefaultColorTable);
+
+ if(bDoDirectScanline)
{
- for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 )
- ImplSetAlphaPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ],
- mpColorTable[ pTmp[ 1 ] ],
- mpColorTable[ pTmp[ 2 ] ] ), pTmp[ 3 ] );
+ // allocate scanlines on demand, reused for next line
+ if(!mpScanline)
+ {
+#ifdef DBG_UTIL
+ mnAllocSizeScanline = maOrigSize.Width() * 3;
+#endif
+ mpScanline = new sal_uInt8[maOrigSize.Width() * 3];
+ }
+
+ if(!mpScanlineAlpha)
+ {
+#ifdef DBG_UTIL
+ mnAllocSizeScanlineAlpha = maOrigSize.Width();
+#endif
+ mpScanlineAlpha = new sal_uInt8[maOrigSize.Width()];
+ }
+ }
+
+ if(bDoDirectScanline)
+ {
+ OSL_ENSURE(mpScanline, "No Scanline allocated (!)");
+ OSL_ENSURE(mpScanlineAlpha, "No ScanlineAlpha allocated (!)");
+#ifdef DBG_UTIL
+ OSL_ENSURE(mnAllocSizeScanline >= maOrigSize.Width() * 3, "Allocated Scanline too small (!)");
+ OSL_ENSURE(mnAllocSizeScanlineAlpha >= maOrigSize.Width(), "Allocated ScanlineAlpha too small (!)");
+#endif
+ sal_uInt8* pScanline(mpScanline);
+ sal_uInt8* pScanlineAlpha(mpScanlineAlpha);
+
+ for(sal_Int32 nX(0); nX < maOrigSize.Width(); nX++, pTmp += 4)
+ {
+ // prepare content line as BGR by reordering when copying
+ // do not forget to invert alpha (source is alpha, target is opacity)
+ if(bCustomColorTable)
+ {
+ *pScanline++ = mpColorTable[pTmp[2]];
+ *pScanline++ = mpColorTable[pTmp[1]];
+ *pScanline++ = mpColorTable[pTmp[0]];
+ *pScanlineAlpha++ = ~pTmp[3];
+ }
+ else
+ {
+ *pScanline++ = pTmp[2];
+ *pScanline++ = pTmp[1];
+ *pScanline++ = pTmp[0];
+ *pScanlineAlpha++ = ~pTmp[3];
+ }
+ }
+
+ // copy scanlines directly to bitmaps for content and alpha; use the formats which
+ // are able to copy directly to BitmapBuffer
+ mpAcc->CopyScanline(nY, mpScanline, BMP_FORMAT_24BIT_TC_BGR, maOrigSize.Width() * 3);
+ mpMaskAcc->CopyScanline(nY, mpScanlineAlpha, BMP_FORMAT_8BIT_PAL, maOrigSize.Width());
}
else
{
-// if ( nXAdd == 1 && mnPreviewShift == 0 ) // copy raw line data if possible
-// {
-// int nLineBytes = 4 * maOrigSize.Width();
-// mpAcc->CopyScanline( nY, pTmp, BMP_FORMAT_32BIT_TC_RGBA, nLineBytes );
-// pTmp += nLineBytes;
-// }
-// else
+ for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 )
{
- for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 )
- ImplSetAlphaPixel( nY, nX, BitmapColor( pTmp[0], pTmp[1], pTmp[2] ), pTmp[3] );
+ if(bCustomColorTable)
+ {
+ ImplSetAlphaPixel(
+ nY,
+ nX,
+ BitmapColor(
+ mpColorTable[ pTmp[ 0 ] ],
+ mpColorTable[ pTmp[ 1 ] ],
+ mpColorTable[ pTmp[ 2 ] ]),
+ pTmp[ 3 ]);
+ }
+ else
+ {
+ ImplSetAlphaPixel(
+ nY,
+ nX,
+ BitmapColor(
+ pTmp[0],
+ pTmp[1],
+ pTmp[2]),
+ pTmp[3]);
+ }
}
}
- }
- else
- { // BMP_FORMAT_64BIT_TC_RGBA
- for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 8 )
- ImplSetAlphaPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ],
- mpColorTable[ pTmp[ 2 ] ],
- mpColorTable[ pTmp[ 4 ] ] ), pTmp[6] );
- }
- }
- else if( mbTransparent ) // has RGB + transparency
- { // BMP_FORMAT_24BIT_TC_RGB
- if ( mnPngDepth == 8 ) // maybe the source has 16 bit per sample
- {
- for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 )
- {
- sal_uInt8 nRed = pTmp[ 0 ];
- sal_uInt8 nGreen = pTmp[ 1 ];
- sal_uInt8 nBlue = pTmp[ 2 ];
- sal_Bool bTransparent = ( ( nRed == mnTransRed )
- && ( nGreen == mnTransGreen )
- && ( nBlue == mnTransBlue ) );
-
- ImplSetTranspPixel( nY, nX, BitmapColor( mpColorTable[ nRed ],
- mpColorTable[ nGreen ],
- mpColorTable[ nBlue ] ), bTransparent );
- }
- }
- else
- { // BMP_FORMAT_48BIT_TC_RGB
- for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 )
- {
- sal_uInt8 nRed = pTmp[ 0 ];
- sal_uInt8 nGreen = pTmp[ 2 ];
- sal_uInt8 nBlue = pTmp[ 4 ];
- sal_Bool bTransparent = ( ( nRed == mnTransRed )
- && ( nGreen == mnTransGreen )
- && ( nBlue == mnTransBlue ) );
-
- ImplSetTranspPixel( nY, nX, BitmapColor( mpColorTable[ nRed ],
- mpColorTable[ nGreen ],
- mpColorTable[ nBlue ] ), bTransparent );
- }
- }
- }
- else // has RGB but neither alpha nor transparency
- { // BMP_FORMAT_24BIT_TC_RGB
- if ( mnPngDepth == 8 ) // maybe the source has 16 bit per sample
- {
- if ( mpColorTable != mpDefaultColorTable )
+ }
+ else
+ {
+ // BMP_FORMAT_64BIT_TC_RGBA
+ for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 8 )
{
- for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 )
- ImplSetPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ],
- mpColorTable[ pTmp[ 1 ] ],
- mpColorTable[ pTmp[ 2 ] ] ) );
+ ImplSetAlphaPixel(
+ nY,
+ nX,
+ BitmapColor(
+ mpColorTable[ pTmp[ 0 ] ],
+ mpColorTable[ pTmp[ 2 ] ],
+ mpColorTable[ pTmp[ 4 ] ]),
+ pTmp[6]);
}
- else
+ }
+ }
+ else if( mbTransparent ) // has RGB + transparency
+ {
+ // BMP_FORMAT_24BIT_TC_RGB
+ // no support currently for DirectScanline, found no real usages in current PNGs, may be added on demand
+ if ( mnPngDepth == 8 ) // maybe the source has 16 bit per sample
+ {
+ for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 )
+ {
+ sal_uInt8 nRed = pTmp[ 0 ];
+ sal_uInt8 nGreen = pTmp[ 1 ];
+ sal_uInt8 nBlue = pTmp[ 2 ];
+ sal_Bool bTransparent = ( ( nRed == mnTransRed )
+ && ( nGreen == mnTransGreen )
+ && ( nBlue == mnTransBlue ) );
+
+ ImplSetTranspPixel( nY, nX, BitmapColor( mpColorTable[ nRed ],
+ mpColorTable[ nGreen ],
+ mpColorTable[ nBlue ] ), bTransparent );
+ }
+ }
+ else
+ {
+ // BMP_FORMAT_48BIT_TC_RGB
+ for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 )
{
- if( nXAdd == 1 && mnPreviewShift == 0 ) // copy raw line data if possible
+ sal_uInt8 nRed = pTmp[ 0 ];
+ sal_uInt8 nGreen = pTmp[ 2 ];
+ sal_uInt8 nBlue = pTmp[ 4 ];
+ sal_Bool bTransparent = ( ( nRed == mnTransRed )
+ && ( nGreen == mnTransGreen )
+ && ( nBlue == mnTransBlue ) );
+
+ ImplSetTranspPixel( nY, nX, BitmapColor( mpColorTable[ nRed ],
+ mpColorTable[ nGreen ],
+ mpColorTable[ nBlue ] ), bTransparent );
+ }
+ }
+ }
+ else // has RGB but neither alpha nor transparency
+ {
+ // BMP_FORMAT_24BIT_TC_RGB
+ // only use DirectScanline when we have no preview shifting stuff and access to content
+ const bool bDoDirectScanline(
+ bCkeckDirectScanline && !nXStart && 1 == nXAdd && !mnPreviewShift && mpAcc);
+ const bool bCustomColorTable(mpColorTable != mpDefaultColorTable);
+
+ if(bDoDirectScanline && !mpScanline)
+ {
+ // allocate scanlines on demand, reused for next line
+#ifdef DBG_UTIL
+ mnAllocSizeScanline = maOrigSize.Width() * 3;
+#endif
+ mpScanline = new sal_uInt8[maOrigSize.Width() * 3];
+ }
+
+ if ( mnPngDepth == 8 ) // maybe the source has 16 bit per sample
+ {
+ if(bDoDirectScanline)
+ {
+ OSL_ENSURE(mpScanline, "No Scanline allocated (!)");
+#ifdef DBG_UTIL
+ OSL_ENSURE(mnAllocSizeScanline >= maOrigSize.Width() * 3, "Allocated Scanline too small (!)");
+#endif
+ sal_uInt8* pScanline(mpScanline);
+
+ for(sal_Int32 nX(0); nX < maOrigSize.Width(); nX++, pTmp += 3)
{
- int nLineBytes = maOrigSize.Width() * 3;
- mpAcc->CopyScanline( nY, pTmp, BMP_FORMAT_24BIT_TC_RGB, nLineBytes );
- pTmp += nLineBytes;
+ // prepare content line as BGR by reordering when copying
+ if(bCustomColorTable)
+ {
+ *pScanline++ = mpColorTable[pTmp[2]];
+ *pScanline++ = mpColorTable[pTmp[1]];
+ *pScanline++ = mpColorTable[pTmp[0]];
+ }
+ else
+ {
+ *pScanline++ = pTmp[2];
+ *pScanline++ = pTmp[1];
+ *pScanline++ = pTmp[0];
+ }
}
- else
+
+ // copy scanline directly to bitmap for content; use the format which is able to
+ // copy directly to BitmapBuffer
+ mpAcc->CopyScanline(nY, mpScanline, BMP_FORMAT_24BIT_TC_BGR, maOrigSize.Width() * 3);
+ }
+ else
+ {
+ for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 )
{
- for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 )
- ImplSetPixel( nY, nX, BitmapColor( pTmp[0], pTmp[1], pTmp[2] ) );
+ if(bCustomColorTable)
+ {
+ ImplSetPixel(
+ nY,
+ nX,
+ BitmapColor(
+ mpColorTable[ pTmp[ 0 ] ],
+ mpColorTable[ pTmp[ 1 ] ],
+ mpColorTable[ pTmp[ 2 ] ]));
+ }
+ else
+ {
+ ImplSetPixel(
+ nY,
+ nX,
+ BitmapColor(
+ pTmp[0],
+ pTmp[1],
+ pTmp[2]));
+ }
}
}
- }
- else
- { // BMP_FORMAT_48BIT_TC_RGB
- for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 )
- ImplSetPixel( nY, nX, BitmapColor( mpColorTable[ pTmp[ 0 ] ],
- mpColorTable[ pTmp[ 2 ] ],
- mpColorTable[ pTmp[ 4 ] ] ) );
- }
- }
- }
+ }
+ else
+ {
+ // BMP_FORMAT_48BIT_TC_RGB
+ // no support currently for DirectScanline, found no real usages in current PNGs, may be added on demand
+ for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 )
+ {
+ ImplSetPixel(
+ nY,
+ nX,
+ BitmapColor(
+ mpColorTable[ pTmp[ 0 ] ],
+ mpColorTable[ pTmp[ 2 ] ],
+ mpColorTable[ pTmp[ 4 ] ]));
+ }
+ }
+ }
+ }
}
// ------------------------------------------------------------------------
Modified: openoffice/branches/l10n40/main/vcl/source/gdi/region.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/source/gdi/region.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/vcl/source/gdi/region.cxx (original)
+++ openoffice/branches/l10n40/main/vcl/source/gdi/region.cxx Fri Sep 27 15:26:24 2013
@@ -1274,9 +1274,10 @@ Rectangle Region::GetBoundRect() const
}
else
{
+ // #122149# corrected rounding, no need for ceil() and floor() here
return Rectangle(
- static_cast<sal_Int32>(floor(aRange.getMinX())), static_cast<sal_Int32>(floor(aRange.getMinY())),
- static_cast<sal_Int32>(ceil(aRange.getMaxX())), static_cast<sal_Int32>(ceil(aRange.getMaxY())));
+ basegfx::fround(aRange.getMinX()), basegfx::fround(aRange.getMinY()),
+ basegfx::fround(aRange.getMaxX()), basegfx::fround(aRange.getMaxY()));
}
}
Modified: openoffice/branches/l10n40/main/vcl/source/gdi/sallayout.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/source/gdi/sallayout.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/vcl/source/gdi/sallayout.cxx (original)
+++ openoffice/branches/l10n40/main/vcl/source/gdi/sallayout.cxx Fri Sep 27 15:26:24 2013
@@ -1869,12 +1869,7 @@ void MultiSalLayout::AdjustLayout( ImplL
for( n = 0; n < nLevel; ++n )
maFallbackRuns[n].ResetPos();
// get the next codepoint index that needs fallback
- // and limit it to the minindex..endindex bounds
int nActiveCharPos = nCharPos[0];
- if( nActiveCharPos < mnMinCharPos)
- nActiveCharPos = mnMinCharPos;
- else if( nActiveCharPos >= rArgs.mnEndCharPos )
- nActiveCharPos = rArgs.mnEndCharPos - 1;
// get the end index of the active run
int nLastRunEndChar = (vRtl[nActiveCharPos - mnMinCharPos])?
rArgs.mnEndCharPos : rArgs.mnMinCharPos - 1;
@@ -2083,8 +2078,6 @@ void MultiSalLayout::AdjustLayout( ImplL
}
}
}
-// if( !maFallbackRuns[i].PosIsInRun( nActiveCharPos ) )
-// maFallbackRuns[i].NextRun();
}
mpLayouts[0]->Simplify( true );
Modified: openoffice/branches/l10n40/main/vcl/source/gdi/salmisc.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/source/gdi/salmisc.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/vcl/source/gdi/salmisc.cxx (original)
+++ openoffice/branches/l10n40/main/vcl/source/gdi/salmisc.cxx Fri Sep 27 15:26:24 2013
@@ -428,13 +428,13 @@ BitmapBuffer* StretchAndConvert(
return NULL;
}
- // horizontal mapping table
- if( nDstDX != nSrcDX )
+ // horizontal mapping table
+ if( (nDstDX != nSrcDX) && (nDstDX != 0) )
{
- const double fFactorX = ( nDstDX > 1 ) ? (double) ( nSrcDX - 1 ) / ( nDstDX - 1 ) : 0.0;
+ const double fFactorX = (double)nSrcDX / nDstDX;
for( i = 0L; i < nDstDX; i++ )
- pMapX[ i ] = nSrcX + FRound( i * fFactorX );
+ pMapX[ i ] = nSrcX + static_cast<int>( i * fFactorX );
}
else
{
@@ -443,12 +443,12 @@ BitmapBuffer* StretchAndConvert(
}
// vertical mapping table
- if( nDstDY != nSrcDY )
+ if( (nDstDY != nSrcDY) && (nDstDY != 0) )
{
- const double fFactorY = ( nDstDY > 1 ) ? (double) ( nSrcDY - 1 ) / ( nDstDY - 1 ) : 0.0;
+ const double fFactorY = (double)nSrcDY / nDstDY;
for( i = 0L; i < nDstDY; i++ )
- pMapY[ i ] = nSrcY + FRound( i * fFactorY );
+ pMapY[ i ] = nSrcY + static_cast<int>( i * fFactorY );
}
else
{
Modified: openoffice/branches/l10n40/main/vcl/win/source/gdi/salbmp.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/win/source/gdi/salbmp.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff
==============================================================================
--- openoffice/branches/l10n40/main/vcl/win/source/gdi/salbmp.cxx (original)
+++ openoffice/branches/l10n40/main/vcl/win/source/gdi/salbmp.cxx Fri Sep 27 15:26:24 2013
@@ -313,22 +313,21 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreat
sal_uInt8* pSrcRGB(pRGB->mpBits);
const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3));
const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN);
+ const Gdiplus::Rect aAllRect(0, 0, nW, nH);
+ Gdiplus::BitmapData aGdiPlusBitmapData;
+ pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat24bppRGB, &aGdiPlusBitmapData);
+ // copy data to Gdiplus::Bitmap; format is BGR here in both cases, so memcpy is possible
for(sal_uInt32 y(0); y < nH; y++)
{
const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1);
+ sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride);
- for(sal_uInt32 x(0); x < nW; x++)
- {
- const sal_uInt8 nB(*pSrcRGB++);
- const sal_uInt8 nG(*pSrcRGB++);
- const sal_uInt8 nR(*pSrcRGB++);
-
- pRetval->SetPixel(x, nYInsert, Gdiplus::Color(nR, nG, nB));
- }
-
- pSrcRGB += nExtraRGB;
+ memcpy(targetPixels, pSrcRGB, nW * 3);
+ pSrcRGB += nW * 3 + nExtraRGB;
}
+
+ pRetval->UnlockBits(&aGdiPlusBitmapData);
}
}
@@ -443,24 +442,30 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreat
const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3));
const sal_uInt32 nExtraA(pA->mnScanlineSize - nW);
const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN);
+ const Gdiplus::Rect aAllRect(0, 0, nW, nH);
+ Gdiplus::BitmapData aGdiPlusBitmapData;
+ pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat32bppARGB, &aGdiPlusBitmapData);
+ // copy data to Gdiplus::Bitmap; format is BGRA; need to mix BGR from Bitmap and
+ // A from alpha, so inner loop is needed (who invented BitmapEx..?)
for(sal_uInt32 y(0); y < nH; y++)
{
const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1);
+ sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride);
for(sal_uInt32 x(0); x < nW; x++)
{
- const sal_uInt8 nB(*pSrcRGB++);
- const sal_uInt8 nG(*pSrcRGB++);
- const sal_uInt8 nR(*pSrcRGB++);
- const sal_uInt8 nA(0xff - *pSrcA++);
-
- pRetval->SetPixel(x, nYInsert, Gdiplus::Color(nA, nR, nG, nB));
+ *targetPixels++ = *pSrcRGB++;
+ *targetPixels++ = *pSrcRGB++;
+ *targetPixels++ = *pSrcRGB++;
+ *targetPixels++ = 0xff - *pSrcA++;
}
pSrcRGB += nExtraRGB;
pSrcA += nExtraA;
}
+
+ pRetval->UnlockBits(&aGdiPlusBitmapData);
}
}