commit after rebase to DEV300m62
This commit is contained in:
@@ -44,6 +44,12 @@
|
||||
#include <tools/prewin.h>
|
||||
#include <windows.h>
|
||||
#include <tools/postwin.h>
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
#endif
|
||||
#include <vcl/sysdata.hxx>
|
||||
|
||||
|
@@ -49,7 +49,7 @@ DLLPRE =
|
||||
# --- X11 Mac build currently doesn't work with cairo -----------
|
||||
.IF "$(OS)" == "MACOSX" && "$(GUIBASE)" == "unx"
|
||||
@all:
|
||||
@echo "Cannot build cairocanvas with X11..."
|
||||
@echo "Cannot build cairocanvas with X11..."
|
||||
.ENDIF
|
||||
.ENDIF
|
||||
|
||||
@@ -65,7 +65,7 @@ CFLAGS+=-I$(SOLARINCDIR)/cairo
|
||||
.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
|
||||
CDEFS+= -DVERBOSE
|
||||
.ENDIF
|
||||
|
||||
.IF "$(L10N_framework)"==""
|
||||
SLOFILES = $(SLO)$/cairo_cachedbitmap.obj \
|
||||
$(SLO)$/cairo_cairo.obj \
|
||||
$(SLO)$/cairo_canvas.obj \
|
||||
@@ -97,7 +97,6 @@ SHL1STDLIBS+= -lcairo
|
||||
.IF "$(GUIBASE)"=="aqua"
|
||||
# native Mac OS X (Quartz)
|
||||
SLOFILES+= $(SLO)$/cairo_quartz_cairo.obj
|
||||
OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions
|
||||
CFLAGSCXX+=$(OBJCXXFLAGS)
|
||||
.ELSE # "$(GUIBASE)"=="aqua"
|
||||
|
||||
@@ -131,7 +130,7 @@ SHL1VERSIONMAP=exports.map
|
||||
DEF1NAME=$(SHL1TARGET)
|
||||
DEF1EXPORTFILE=exports.dxp
|
||||
|
||||
|
||||
.ENDIF
|
||||
# ==========================================================================
|
||||
|
||||
.INCLUDE : target.mk
|
||||
|
@@ -956,11 +956,43 @@ namespace dxcanvas
|
||||
{
|
||||
if(hr != D3DERR_DEVICELOST)
|
||||
return false;
|
||||
hr = mpDevice->Reset(&mad3dpp);
|
||||
if(SUCCEEDED(hr))
|
||||
return true;
|
||||
if(hr == D3DERR_DEVICELOST)
|
||||
return true;
|
||||
|
||||
// interestingly enough, sometimes the Reset() below
|
||||
// *still* causes DeviceLost errors. So, cycle until
|
||||
// DX was kind enough to really reset the device...
|
||||
do
|
||||
{
|
||||
mpVertexBuffer.reset();
|
||||
hr = mpDevice->Reset(&mad3dpp);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
IDirect3DVertexBuffer9 *pVB(NULL);
|
||||
DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1);
|
||||
if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices,
|
||||
D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
|
||||
aFVF,
|
||||
D3DPOOL_DEFAULT,
|
||||
&pVB,
|
||||
NULL)) )
|
||||
{
|
||||
throw lang::NoSupportException(
|
||||
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"Could not create DirectX device - out of memory!")),NULL);
|
||||
}
|
||||
mpVertexBuffer=COMReference<IDirect3DVertexBuffer9>(pVB);
|
||||
|
||||
// retry after the restore
|
||||
if(SUCCEEDED(mpSwapChain->Present(&aRect,&aRect,NULL,NULL,0)))
|
||||
return true;
|
||||
}
|
||||
|
||||
TimeValue aTimeout;
|
||||
aTimeout.Seconds=1;
|
||||
aTimeout.Nanosec=0;
|
||||
osl_waitThread(&aTimeout);
|
||||
}
|
||||
while(hr == D3DERR_DEVICELOST);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,8 @@
|
||||
#include "dx_surfacegraphics.hxx"
|
||||
#include "dx_impltools.hxx"
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
namespace dxcanvas
|
||||
{
|
||||
namespace
|
||||
@@ -75,11 +77,12 @@ namespace dxcanvas
|
||||
tools::setupGraphics( *pGraphics );
|
||||
pRet.reset(pGraphics,
|
||||
GraphicsDeleter(rSurface, aHDC));
|
||||
return pRet;
|
||||
}
|
||||
else
|
||||
rSurface->ReleaseDC( aHDC );
|
||||
}
|
||||
|
||||
return pRet;
|
||||
throw uno::RuntimeException();
|
||||
}
|
||||
}
|
||||
|
@@ -97,25 +97,18 @@
|
||||
|
||||
#undef DrawText
|
||||
|
||||
// Needed for #?$&/@ gdiplus header
|
||||
#ifndef max
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#define __WORKAROUND_MAX_DEFINED__
|
||||
#endif
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#define __WORKAROUND_MIN_DEFINED__
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
using ::std::max;
|
||||
using ::std::min;
|
||||
#endif
|
||||
|
||||
#include <gdiplus.h>
|
||||
|
||||
#ifdef __WORKAROUND_MAX_DEFINED__
|
||||
#undef max
|
||||
#ifdef min
|
||||
# undef min
|
||||
#endif
|
||||
|
||||
#ifdef __WORKAROUND_MIN_DEFINED__
|
||||
#undef min
|
||||
#ifdef max
|
||||
# undef max
|
||||
#endif
|
||||
|
||||
namespace dxcanvas
|
||||
|
@@ -37,7 +37,7 @@ ENABLE_EXCEPTIONS = TRUE
|
||||
|
||||
.INCLUDE : settings.mk
|
||||
DLLPRE =
|
||||
|
||||
.IF "$(L10N_framework)"==""
|
||||
SLOFILES = \
|
||||
$(SLO)$/cf_service.obj
|
||||
|
||||
@@ -55,6 +55,6 @@ SHL1LIBS = $(SLB)$/$(TARGET).lib
|
||||
SHL1DEF = $(MISC)$/$(SHL1TARGET).def
|
||||
|
||||
DEF1NAME = $(SHL1TARGET)
|
||||
|
||||
.ENDIF
|
||||
.INCLUDE : target.mk
|
||||
|
||||
|
@@ -45,7 +45,7 @@ DLLPRE =
|
||||
.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
|
||||
CDEFS+= -DVERBOSE
|
||||
.ENDIF
|
||||
|
||||
.IF "$(L10N_framework)"==""
|
||||
SLOFILES = $(SLO)$/null_canvasbitmap.obj \
|
||||
$(SLO)$/null_canvascustomsprite.obj \
|
||||
$(SLO)$/null_canvasfont.obj \
|
||||
@@ -68,7 +68,7 @@ SHL1VERSIONMAP=exports.map
|
||||
|
||||
DEF1NAME=$(SHL1TARGET)
|
||||
DEF1EXPORTFILE=exports.dxp
|
||||
|
||||
.ENDIF
|
||||
# ==========================================================================
|
||||
|
||||
.INCLUDE : target.mk
|
||||
|
@@ -45,7 +45,7 @@ DLLPRE =
|
||||
.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
|
||||
CDEFS+= -DVERBOSE
|
||||
.ENDIF
|
||||
|
||||
.IF "$(L10N_framework)"==""
|
||||
SLOFILES = $(SLO)$/simplecanvasimpl.obj
|
||||
|
||||
SHL1TARGET=$(TARGET).uno
|
||||
@@ -60,6 +60,7 @@ SHL1VERSIONMAP=exports.map
|
||||
|
||||
DEF1NAME=$(SHL1TARGET)
|
||||
DEF1EXPORTFILE=exports.dxp
|
||||
.ENDIF
|
||||
|
||||
# ==========================================================================
|
||||
|
||||
|
@@ -51,7 +51,7 @@ CDEFS+= -DPROFILER
|
||||
#CFLAGS +:= /Ox /Ot # THIS IS IMPORTANT
|
||||
|
||||
|
||||
|
||||
.IF "$(L10N_framework)"==""
|
||||
SLOFILES = \
|
||||
$(SLO)$/cachedprimitivebase.obj \
|
||||
$(SLO)$/canvascustomspritehelper.obj \
|
||||
@@ -95,7 +95,7 @@ DEFLIB1NAME =$(TARGET)
|
||||
.IF "$(GUI)" == "WNT"
|
||||
SHL1STDLIBS += $(WINMMLIB) $(KERNEL32LIB)
|
||||
.ENDIF
|
||||
|
||||
.ENDIF
|
||||
|
||||
# ==========================================================================
|
||||
|
||||
|
@@ -127,8 +127,19 @@ namespace vclcanvas
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
|
||||
// TODO(F1)
|
||||
return rendering::FontMetrics();
|
||||
OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
|
||||
VirtualDevice aVDev( rOutDev );
|
||||
aVDev.SetFont(getVCLFont());
|
||||
const ::FontMetric& aMetric( aVDev.GetFontMetric() );
|
||||
|
||||
return rendering::FontMetrics(
|
||||
aMetric.GetAscent(),
|
||||
aMetric.GetDescent(),
|
||||
aMetric.GetIntLeading(),
|
||||
aMetric.GetExtLeading(),
|
||||
0,
|
||||
aMetric.GetDescent() / 2.0,
|
||||
aMetric.GetAscent() / 2.0);
|
||||
}
|
||||
|
||||
uno::Sequence< double > SAL_CALL CanvasFont::getAvailableSizes( ) throw (uno::RuntimeException)
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include <tools/diagnose_ex.h>
|
||||
#include <canvas/canvastools.hxx>
|
||||
|
||||
#include <com/sun/star/rendering/CompositeOperation.hpp>
|
||||
#include <com/sun/star/rendering/TextDirection.hpp>
|
||||
|
||||
#include <vcl/metric.hxx>
|
||||
@@ -42,6 +43,7 @@
|
||||
|
||||
#include <basegfx/matrix/b2dhommatrix.hxx>
|
||||
#include <basegfx/numeric/ftools.hxx>
|
||||
#include <basegfx/tools/canvastools.hxx>
|
||||
|
||||
#include "impltools.hxx"
|
||||
#include "textlayout.hxx"
|
||||
@@ -116,16 +118,104 @@ namespace vclcanvas
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
|
||||
// TODO(F1)
|
||||
return uno::Sequence< uno::Reference< rendering::XPolyPolygon2D > >();
|
||||
OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
|
||||
VirtualDevice aVDev( rOutDev );
|
||||
aVDev.SetFont( mpFont->getVCLFont() );
|
||||
|
||||
setupLayoutMode( aVDev, mnTextDirection );
|
||||
|
||||
const rendering::ViewState aViewState(
|
||||
geometry::AffineMatrix2D(1,0,0, 0,1,0),
|
||||
NULL);
|
||||
|
||||
rendering::RenderState aRenderState (
|
||||
geometry::AffineMatrix2D(1,0,0,0,1,0),
|
||||
NULL,
|
||||
uno::Sequence<double>(4),
|
||||
rendering::CompositeOperation::SOURCE);
|
||||
|
||||
::boost::scoped_array< sal_Int32 > aOffsets(new sal_Int32[maLogicalAdvancements.getLength()]);
|
||||
setupTextOffsets(aOffsets.get(), maLogicalAdvancements, aViewState, aRenderState);
|
||||
|
||||
uno::Sequence< uno::Reference< rendering::XPolyPolygon2D> > aOutlineSequence;
|
||||
::basegfx::B2DPolyPolygonVector aOutlines;
|
||||
if (aVDev.GetTextOutlines(
|
||||
aOutlines,
|
||||
maText.Text,
|
||||
::canvas::tools::numeric_cast<USHORT>(maText.StartPosition),
|
||||
::canvas::tools::numeric_cast<USHORT>(maText.StartPosition),
|
||||
::canvas::tools::numeric_cast<USHORT>(maText.Length),
|
||||
FALSE,
|
||||
0,
|
||||
aOffsets.get()))
|
||||
{
|
||||
aOutlineSequence.realloc(aOutlines.size());
|
||||
sal_Int32 nIndex (0);
|
||||
for (::basegfx::B2DPolyPolygonVector::const_iterator
|
||||
iOutline(aOutlines.begin()),
|
||||
iEnd(aOutlines.end());
|
||||
iOutline!=iEnd;
|
||||
++iOutline)
|
||||
{
|
||||
aOutlineSequence[nIndex++] = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
|
||||
mxDevice,
|
||||
*iOutline);
|
||||
}
|
||||
}
|
||||
|
||||
return aOutlineSequence;
|
||||
}
|
||||
|
||||
uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryInkMeasures( ) throw (uno::RuntimeException)
|
||||
{
|
||||
tools::LocalGuard aGuard;
|
||||
|
||||
// TODO(F1)
|
||||
return uno::Sequence< geometry::RealRectangle2D >();
|
||||
|
||||
OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
|
||||
VirtualDevice aVDev( rOutDev );
|
||||
aVDev.SetFont( mpFont->getVCLFont() );
|
||||
|
||||
setupLayoutMode( aVDev, mnTextDirection );
|
||||
|
||||
const rendering::ViewState aViewState(
|
||||
geometry::AffineMatrix2D(1,0,0, 0,1,0),
|
||||
NULL);
|
||||
|
||||
rendering::RenderState aRenderState (
|
||||
geometry::AffineMatrix2D(1,0,0,0,1,0),
|
||||
NULL,
|
||||
uno::Sequence<double>(4),
|
||||
rendering::CompositeOperation::SOURCE);
|
||||
|
||||
::boost::scoped_array< sal_Int32 > aOffsets(new sal_Int32[maLogicalAdvancements.getLength()]);
|
||||
setupTextOffsets(aOffsets.get(), maLogicalAdvancements, aViewState, aRenderState);
|
||||
|
||||
MetricVector aMetricVector;
|
||||
uno::Sequence<geometry::RealRectangle2D> aBoundingBoxes;
|
||||
if (aVDev.GetGlyphBoundRects(
|
||||
Point(0,0),
|
||||
maText.Text,
|
||||
::canvas::tools::numeric_cast<USHORT>(maText.StartPosition),
|
||||
::canvas::tools::numeric_cast<USHORT>(maText.Length),
|
||||
::canvas::tools::numeric_cast<USHORT>(maText.StartPosition),
|
||||
aMetricVector))
|
||||
{
|
||||
aBoundingBoxes.realloc(aMetricVector.size());
|
||||
sal_Int32 nIndex (0);
|
||||
for (MetricVector::const_iterator
|
||||
iMetric(aMetricVector.begin()),
|
||||
iEnd(aMetricVector.end());
|
||||
iMetric!=iEnd;
|
||||
++iMetric)
|
||||
{
|
||||
aBoundingBoxes[nIndex++] = geometry::RealRectangle2D(
|
||||
iMetric->getX(),
|
||||
iMetric->getY(),
|
||||
iMetric->getX() + iMetric->getWidth(),
|
||||
iMetric->getY() + iMetric->getHeight());
|
||||
}
|
||||
}
|
||||
return aBoundingBoxes;
|
||||
}
|
||||
|
||||
uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryMeasures( ) throw (uno::RuntimeException)
|
||||
@@ -171,7 +261,7 @@ namespace vclcanvas
|
||||
|
||||
setupLayoutMode( aVDev, mnTextDirection );
|
||||
|
||||
const sal_Int32 nAboveBaseline( -aMetric.GetIntLeading() - aMetric.GetAscent() );
|
||||
const sal_Int32 nAboveBaseline( /*-aMetric.GetIntLeading()*/ - aMetric.GetAscent() );
|
||||
const sal_Int32 nBelowBaseline( aMetric.GetDescent() );
|
||||
|
||||
if( maLogicalAdvancements.getLength() )
|
||||
|
Reference in New Issue
Block a user