summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/lib/init.cxx12
-rw-r--r--external/cairo/UnpackedTarball_cairo.mk1
-rw-r--r--external/cairo/cairo/cairo.GL_RGBA.patch41
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx22
-rw-r--r--libreofficekit/source/gtk/tilebuffer.cxx9
-rw-r--r--libreofficekit/source/gtk/tilebuffer.hxx17
-rw-r--r--vcl/Library_vcl.mk6
-rw-r--r--vcl/Library_vclplug_gtk3.mk1
-rw-r--r--vcl/generic/glyphs/gcach_ftyp.cxx272
-rw-r--r--vcl/generic/glyphs/gcach_rbmp.cxx251
-rw-r--r--vcl/headless/svpcairotextrender.cxx (renamed from vcl/unx/gtk3/gtk3cairotextrender.cxx)26
-rw-r--r--vcl/headless/svpcairotextrender.hxx (renamed from vcl/unx/gtk3/gtk3cairotextrender.hxx)2
-rw-r--r--vcl/headless/svpgdi.cxx31
-rw-r--r--vcl/headless/svpglyphcache.cxx71
-rw-r--r--vcl/headless/svpinst.cxx28
-rw-r--r--vcl/headless/svptextrender.cxx500
-rw-r--r--vcl/headless/svpvd.cxx7
-rw-r--r--vcl/inc/cairotextrender.hxx8
-rw-r--r--vcl/inc/generic/glyphcache.hxx29
-rw-r--r--vcl/inc/headless/svpbmp.hxx2
-rw-r--r--vcl/inc/headless/svpgdi.hxx11
-rw-r--r--vcl/inc/headless/svpinst.hxx10
-rw-r--r--vcl/inc/headless/svptextrender.hxx85
-rw-r--r--vcl/unx/generic/gdi/cairotextrender.cxx2
-rw-r--r--vcl/unx/gtk/gtksalframe.cxx2
-rw-r--r--vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx3
26 files changed, 222 insertions, 1227 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index cd2f82a34680..211371e49879 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -887,9 +887,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
#elif defined(ANDROID)
- InitSvpForLibreOfficeKit();
-
- ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), (sal_uInt16)32) ;
+ ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), (sal_uInt16)0) ;
boost::shared_array<sal_uInt8> aBuffer(pBuffer, NoDelete< sal_uInt8 >());
@@ -902,9 +900,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
#else
- InitSvpForLibreOfficeKit();
-
- ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), (sal_uInt16)32) ;
+ ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), (sal_uInt16)0) ;
// Set background to transparent by default.
memset(pBuffer, 0, nCanvasWidth * nCanvasHeight * 4);
@@ -915,7 +911,9 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
// Allocate a separate buffer for the alpha device.
std::vector<sal_uInt8> aAlpha(nCanvasWidth * nCanvasHeight);
memset(aAlpha.data(), 0, nCanvasWidth * nCanvasHeight);
- boost::shared_array<sal_uInt8> aAlphaBuffer(aAlpha.data(), NoDelete<sal_uInt8>());
+// TO_DO: enable alpha
+// boost::shared_array<sal_uInt8> aAlphaBuffer(aAlpha.data(), NoDelete<sal_uInt8>());
+ boost::shared_array<sal_uInt8> aAlphaBuffer;
pDevice->SetOutputSizePixelScaleOffsetAndBuffer(
Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
diff --git a/external/cairo/UnpackedTarball_cairo.mk b/external/cairo/UnpackedTarball_cairo.mk
index bb2a4c1842a3..2114982f020a 100644
--- a/external/cairo/UnpackedTarball_cairo.mk
+++ b/external/cairo/UnpackedTarball_cairo.mk
@@ -34,6 +34,7 @@ endif
ifeq ($(OS),ANDROID)
$(eval $(call gb_UnpackedTarball_add_patches,cairo,\
external/cairo/cairo/cairo-1.10.2.android.patch \
+ external/cairo/cairo/cairo.GL_RGBA.patch \
))
endif
diff --git a/external/cairo/cairo/cairo.GL_RGBA.patch b/external/cairo/cairo/cairo.GL_RGBA.patch
new file mode 100644
index 000000000000..d2afefdddd55
--- /dev/null
+++ b/external/cairo/cairo/cairo.GL_RGBA.patch
@@ -0,0 +1,41 @@
+--- misc/cairo-1.10.2/src/cairo-image-surface.c
++++ misc/cairo-1.10.2/src/cairo-image-surface.c
+@@ -99,9 +99,9 @@
+ _cairo_format_from_pixman_format (pixman_format_code_t pixman_format)
+ {
+ switch (pixman_format) {
+- case PIXMAN_a8r8g8b8:
++ case PIXMAN_a8b8g8r8: //tweaked
+ return CAIRO_FORMAT_ARGB32;
+- case PIXMAN_x8r8g8b8:
++ case PIXMAN_x8b8g8r8: //tweaked
+ return CAIRO_FORMAT_RGB24;
+ case PIXMAN_a8:
+ return CAIRO_FORMAT_A8;
+@@ -109,7 +109,7 @@
+ return CAIRO_FORMAT_A1;
+ case PIXMAN_r5g6b5:
+ return CAIRO_FORMAT_RGB16_565;
+- case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8: case PIXMAN_r8g8b8:
++ case PIXMAN_a8r8g8b8: case PIXMAN_x8r8g8b8: case PIXMAN_r8g8b8: //tweaked
+ case PIXMAN_b8g8r8: case PIXMAN_b5g6r5:
+ case PIXMAN_a1r5g5b5: case PIXMAN_x1r5g5b5: case PIXMAN_a1b5g5r5:
+ case PIXMAN_x1b5g5r5: case PIXMAN_a4r4g4b4: case PIXMAN_x4r4g4b4:
+@@ -297,7 +297,7 @@
+ ret = PIXMAN_a8;
+ break;
+ case CAIRO_FORMAT_RGB24:
+- ret = PIXMAN_x8r8g8b8;
++ ret = PIXMAN_x8b8g8r8; //tweaked
+ break;
+ case CAIRO_FORMAT_RGB16_565:
+ ret = PIXMAN_r5g6b5;
+@@ -305,7 +305,7 @@
+ case CAIRO_FORMAT_ARGB32:
+ case CAIRO_FORMAT_INVALID:
+ default:
+- ret = PIXMAN_a8r8g8b8;
++ ret = PIXMAN_a8b8g8r8; //tweaked
+ break;
+ }
+ return ret;
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index eebf6bc361e2..fe1a12ca2693 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -967,7 +967,7 @@ paintTileCallback(GObject* sourceObject, GAsyncResult* res, gpointer userData)
GError* error;
error = nullptr;
- GdkPixbuf* pPixBuf = static_cast<GdkPixbuf*>(paintTileFinish(pDocView, res, &error));
+ cairo_surface_t* pSurface = static_cast<cairo_surface_t*>(paintTileFinish(pDocView, res, &error));
if (error != nullptr)
{
if (error->domain == LOK_TILEBUFFER_ERROR &&
@@ -980,11 +980,11 @@ paintTileCallback(GObject* sourceObject, GAsyncResult* res, gpointer userData)
return;
}
- buffer->m_mTiles[index].setPixbuf(pPixBuf);
+ buffer->m_mTiles[index].setSurface(pSurface);
buffer->m_mTiles[index].valid = true;
gdk_threads_add_idle(queueDraw, GTK_WIDGET(pDocView));
- g_object_unref(pPixBuf);
+ cairo_surface_destroy(pSurface);
}
@@ -1045,8 +1045,8 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo)
g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
Tile& currentTile = priv->m_pTileBuffer->getTile(nRow, nColumn, task, priv->lokThreadPool);
- GdkPixbuf* pPixBuf = currentTile.getBuffer();
- gdk_cairo_set_source_pixbuf (pCairo, pPixBuf,
+ cairo_surface_t* pSurface = currentTile.getBuffer();
+ cairo_set_source_surface(pCairo, pSurface,
twipToPixel(aTileRectangleTwips.x, priv->m_fZoom),
twipToPixel(aTileRectangleTwips.y, priv->m_fZoom));
cairo_paint(pCairo);
@@ -1667,17 +1667,18 @@ paintTileInThread (gpointer data)
buffer->m_mTiles[index].valid)
return;
- GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels);
- if (!pPixBuf)
+ cairo_surface_t *pSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nTileSizePixels, nTileSizePixels);
+ if (cairo_surface_status(pSurface) != CAIRO_STATUS_SUCCESS)
{
+ cairo_surface_destroy(pSurface);
g_task_return_new_error(task,
LOK_TILEBUFFER_ERROR,
LOK_TILEBUFFER_MEMORY,
- "Error allocating memory to GdkPixbuf");
+ "Error allocating Surface");
return;
}
- unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf);
+ unsigned char* pBuffer = cairo_image_surface_get_data(pSurface);
GdkRectangle aTileRectangle;
aTileRectangle.x = pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom) * pLOEvent->m_nPaintTileY;
aTileRectangle.y = pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom) * pLOEvent->m_nPaintTileX;
@@ -1696,6 +1697,7 @@ paintTileInThread (gpointer data)
aTileRectangle.x, aTileRectangle.y,
pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom),
pixelToTwip(nTileSizePixels, pLOEvent->m_fPaintTileZoom));
+ cairo_surface_mark_dirty(pSurface);
// Its likely that while the tilebuffer has changed, one of the paint tile
// requests has passed the previous check at start of this function, and has
@@ -1711,7 +1713,7 @@ paintTileInThread (gpointer data)
return;
}
- g_task_return_pointer(task, pPixBuf, g_object_unref);
+ g_task_return_pointer(task, pSurface, (GDestroyNotify)cairo_surface_destroy);
}
diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx
index 675384c4582e..bded6b1ad853 100644
--- a/libreofficekit/source/gtk/tilebuffer.cxx
+++ b/libreofficekit/source/gtk/tilebuffer.cxx
@@ -28,18 +28,19 @@ float twipToPixel(float fInput, float zoom)
Tile class member functions
----------------------------
*/
-GdkPixbuf* Tile::getBuffer()
+cairo_surface_t* Tile::getBuffer()
{
return m_pBuffer;
}
-void Tile::setPixbuf(GdkPixbuf *buffer)
+void Tile::setSurface(cairo_surface_t *buffer)
{
if (m_pBuffer == buffer)
return;
- g_clear_object(&m_pBuffer);
+ if (m_pBuffer)
+ cairo_surface_destroy(m_pBuffer);
if (buffer != nullptr)
- g_object_ref(buffer);
+ cairo_surface_reference(buffer);
m_pBuffer = buffer;
}
diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx
index c8f401d38c0a..3d84dfb184e7 100644
--- a/libreofficekit/source/gtk/tilebuffer.hxx
+++ b/libreofficekit/source/gtk/tilebuffer.hxx
@@ -61,7 +61,8 @@ class Tile
Tile() : valid(false), m_pBuffer(nullptr) {}
~Tile()
{
- g_clear_object(&m_pBuffer);
+ if (m_pBuffer)
+ cairo_surface_destroy(m_pBuffer);
}
/**
@@ -70,14 +71,14 @@ class Tile
*/
bool valid;
- /// Function to get the pointer to enclosing GdkPixbuf
- GdkPixbuf* getBuffer();
+ /// Function to get the pointer to enclosing cairo_surface_t
+ cairo_surface_t* getBuffer();
/// Used to set the pixel buffer of this object
- void setPixbuf(GdkPixbuf*);
+ void setSurface(cairo_surface_t*);
private:
/// Pixel buffer data for this tile
- GdkPixbuf *m_pBuffer;
+ cairo_surface_t *m_pBuffer;
};
/**
@@ -95,9 +96,9 @@ class TileBuffer
: m_pLOKDocument(document)
, m_nWidth(columns)
{
- GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels);
- m_DummyTile.setPixbuf(pPixBuf);
- g_object_unref(pPixBuf);
+ cairo_surface_t *pSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nTileSizePixels, nTileSizePixels);
+ m_DummyTile.setSurface(pSurface);
+ cairo_surface_destroy(pSurface);
}
~TileBuffer() {}
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index e9db8fea26b7..25f2d855c46f 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -556,7 +556,6 @@ vcl_generic_code= \
vcl/generic/fontmanager/fontsubst \
vcl/generic/glyphs/gcach_ftyp \
vcl/generic/glyphs/gcach_layout \
- vcl/generic/glyphs/gcach_rbmp \
vcl/generic/glyphs/glyphcache \
vcl/generic/glyphs/scrptrun \
vcl/generic/fontmanager/fontcache \
@@ -577,7 +576,9 @@ vcl_headless_code= \
vcl_headless_freetype_code=\
vcl/headless/svpprn \
vcl/headless/svptext \
- vcl/headless/svptextrender \
+ vcl/headless/svpglyphcache \
+ vcl/unx/generic/gdi/cairotextrender \
+ vcl/headless/svpcairotextrender \
ifeq ($(USING_X11),TRUE)
$(eval $(call gb_Library_add_exception_objects,vcl,\
@@ -585,7 +586,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/unx/generic/plugadapt/salplug \
vcl/unx/generic/printer/jobdata \
vcl/unx/generic/printer/ppdparser \
- vcl/unx/generic/gdi/cairotextrender \
vcl/unx/generic/gdi/x11windowprovider \
vcl/unx/generic/window/screensaverinhibitor \
$(if $(filter TRUE,$(ENABLE_CUPS)),\
diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk
index e36dc21223e3..8a90c49b6b06 100644
--- a/vcl/Library_vclplug_gtk3.mk
+++ b/vcl/Library_vclplug_gtk3.mk
@@ -103,7 +103,6 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk3,\
vcl/unx/gtk3/gtk3gtksys \
vcl/unx/gtk3/gtk3fpicker \
vcl/unx/gtk3/cairo_gtk3_cairo \
- vcl/unx/gtk3/gtk3cairotextrender \
vcl/unx/gtk3/gtk3gtkprintwrapper \
vcl/unx/gtk3/gtk3salnativewidgets-gtk \
vcl/unx/gtk3/gtk3salprn-gtk \
diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index 2e874e51eccc..51bb542642e4 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -987,278 +987,6 @@ bool ServerFont::GetAntialiasAdvice() const
return bAdviseAA;
}
-bool ServerFont::GetGlyphBitmap1( sal_GlyphId aGlyphId, RawBitmap& rRawBitmap ) const
-{
- FT_Activate_Size( maSizeFT );
-
- int nGlyphFlags;
- SplitGlyphFlags( *this, aGlyphId, nGlyphFlags );
-
- FT_Int nLoadFlags = mnLoadFlags;
- // #i70930# force mono-hinting for monochrome text
- nLoadFlags &= ~0xF0000;
- nLoadFlags |= FT_LOAD_TARGET_MONO;
-
- if( mbArtItalic )
- nLoadFlags |= FT_LOAD_NO_BITMAP;
-
- // for 0/90/180/270 degree fonts enable hinting even if not advisable
- // non-hinted and non-antialiased bitmaps just look too ugly
- if( (mnCos==0 || mnSin==0) && (mnPrioAutoHint > 0) )
- nLoadFlags &= ~FT_LOAD_NO_HINTING;
-
- if( mnPrioEmbedded <= mnPrioAutoHint )
- nLoadFlags |= FT_LOAD_NO_BITMAP;
-
- FT_Error rc = FT_Load_Glyph( maFaceFT, aGlyphId, nLoadFlags );
-
- if( rc != FT_Err_Ok )
- return false;
-
- if (mbArtBold)
- FT_GlyphSlot_Embolden(maFaceFT->glyph);
-
- FT_Glyph pGlyphFT;
- rc = FT_Get_Glyph( maFaceFT->glyph, &pGlyphFT );
- if( rc != FT_Err_Ok )
- return false;
-
- int nAngle = ApplyGlyphTransform( nGlyphFlags, pGlyphFT, true );
-
- if( mbArtItalic )
- {
- FT_Matrix aMatrix;
- aMatrix.xx = aMatrix.yy = 0x10000L;
- aMatrix.xy = 0x6000L, aMatrix.yx = 0;
- FT_Glyph_Transform( pGlyphFT, &aMatrix, nullptr );
- }
-
- // Check for zero area bounding boxes as this crashes some versions of FT.
- // This also provides a handy short cut as much of the code following
- // becomes an expensive nop when a glyph covers no pixels.
- FT_BBox cbox;
- FT_Glyph_Get_CBox(pGlyphFT, ft_glyph_bbox_unscaled, &cbox);
-
- if( (cbox.xMax - cbox.xMin) == 0 || (cbox.yMax - cbox.yMin == 0) )
- {
- memset(&rRawBitmap, 0, sizeof rRawBitmap);
- FT_Done_Glyph( pGlyphFT );
- return true;
- }
-
- if( pGlyphFT->format != FT_GLYPH_FORMAT_BITMAP )
- {
- if( pGlyphFT->format == FT_GLYPH_FORMAT_OUTLINE )
- reinterpret_cast<FT_OutlineGlyphRec*>(pGlyphFT)->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
- FT_Render_Mode nRenderMode = FT_RENDER_MODE_MONO;
-
- rc = FT_Glyph_To_Bitmap( &pGlyphFT, nRenderMode, nullptr, true );
- if( rc != FT_Err_Ok )
- {
- FT_Done_Glyph( pGlyphFT );
- return false;
- }
- }
-
- const FT_BitmapGlyph pBmpGlyphFT = reinterpret_cast<const FT_BitmapGlyph>(pGlyphFT);
- // NOTE: autohinting in FT<=2.0.2 miscalculates the offsets below by +-1
- rRawBitmap.mnXOffset = +pBmpGlyphFT->left;
- rRawBitmap.mnYOffset = -pBmpGlyphFT->top;
-
- const FT_Bitmap& rBitmapFT = pBmpGlyphFT->bitmap;
- rRawBitmap.mnHeight = rBitmapFT.rows;
- rRawBitmap.mnBitCount = 1;
- rRawBitmap.mnWidth = rBitmapFT.width;
- rRawBitmap.mnScanlineSize = rBitmapFT.pitch;
-
- const sal_uLong nNeededSize = rRawBitmap.mnScanlineSize * rRawBitmap.mnHeight;
-
- if( rRawBitmap.mnAllocated < nNeededSize )
- {
- rRawBitmap.mnAllocated = 2*nNeededSize;
- rRawBitmap.mpBits.reset(new unsigned char[ rRawBitmap.mnAllocated ]);
- }
-
- if (!mbArtBold)
- {
- memcpy( rRawBitmap.mpBits.get(), rBitmapFT.buffer, nNeededSize );
- }
- else
- {
- memset( rRawBitmap.mpBits.get(), 0, nNeededSize );
- const unsigned char* pSrcLine = rBitmapFT.buffer;
- unsigned char* pDstLine = rRawBitmap.mpBits.get();
- for( int h = rRawBitmap.mnHeight; --h >= 0; )
- {
- memcpy( pDstLine, pSrcLine, rBitmapFT.pitch );
- pDstLine += rRawBitmap.mnScanlineSize;
- pSrcLine += rBitmapFT.pitch;
- }
-
- unsigned char* p = rRawBitmap.mpBits.get();
- for( sal_uLong y=0; y < rRawBitmap.mnHeight; y++ )
- {
- unsigned char nLastByte = 0;
- for( sal_uLong x=0; x < rRawBitmap.mnScanlineSize; x++ )
- {
- unsigned char nTmp = p[x] << 7;
- p[x] |= (p[x] >> 1) | nLastByte;
- nLastByte = nTmp;
- }
- p += rRawBitmap.mnScanlineSize;
- }
- }
-
- FT_Done_Glyph( pGlyphFT );
-
- // special case for 0/90/180/270 degree orientation
- switch( nAngle )
- {
- case -900:
- case +900:
- case +1800:
- case +2700:
- rRawBitmap.Rotate( nAngle );
- break;
- }
-
- return true;
-}
-
-bool ServerFont::GetGlyphBitmap8( sal_GlyphId aGlyphId, RawBitmap& rRawBitmap ) const
-{
- FT_Activate_Size( maSizeFT );
-
- int nGlyphFlags;
- SplitGlyphFlags( *this, aGlyphId, nGlyphFlags );
-
- FT_Int nLoadFlags = mnLoadFlags;
-
- if( mbArtItalic )
- nLoadFlags |= FT_LOAD_NO_BITMAP;
-
- if( (nGlyphFlags & GF_UNHINTED) || (mnPrioAutoHint < mnPrioAntiAlias) )
- nLoadFlags |= FT_LOAD_NO_HINTING;
-
- if( mnPrioEmbedded <= mnPrioAntiAlias )
- nLoadFlags |= FT_LOAD_NO_BITMAP;
-
- FT_Error rc = FT_Load_Glyph( maFaceFT, aGlyphId, nLoadFlags );
-
- if( rc != FT_Err_Ok )
- return false;
-
- if (mbArtBold)
- FT_GlyphSlot_Embolden(maFaceFT->glyph);
-
- FT_Glyph pGlyphFT;
- rc = FT_Get_Glyph( maFaceFT->glyph, &pGlyphFT );
- if( rc != FT_Err_Ok )
- return false;
-
- int nAngle = ApplyGlyphTransform( nGlyphFlags, pGlyphFT, true );
-
- if( mbArtItalic )
- {
- FT_Matrix aMatrix;
- aMatrix.xx = aMatrix.yy = 0x10000L;
- aMatrix.xy = 0x6000L, aMatrix.yx = 0;
- FT_Glyph_Transform( pGlyphFT, &aMatrix, nullptr );
- }
-
- if( pGlyphFT->format == FT_GLYPH_FORMAT_OUTLINE )
- reinterpret_cast<FT_OutlineGlyph>(pGlyphFT)->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
-
- bool bEmbedded = (pGlyphFT->format == FT_GLYPH_FORMAT_BITMAP);
- if( !bEmbedded )
- {
- rc = FT_Glyph_To_Bitmap( &pGlyphFT, FT_RENDER_MODE_NORMAL, nullptr, true );
- if( rc != FT_Err_Ok )
- {
- FT_Done_Glyph( pGlyphFT );
- return false;
- }
- }
-
- const FT_BitmapGlyph pBmpGlyphFT = reinterpret_cast<const FT_BitmapGlyph>(pGlyphFT);
- rRawBitmap.mnXOffset = +pBmpGlyphFT->left;
- rRawBitmap.mnYOffset = -pBmpGlyphFT->top;
-
- const FT_Bitmap& rBitmapFT = pBmpGlyphFT->bitmap;
- rRawBitmap.mnHeight = rBitmapFT.rows;
- rRawBitmap.mnWidth = rBitmapFT.width;
- rRawBitmap.mnBitCount = 8;
- rRawBitmap.mnScanlineSize = bEmbedded ? rBitmapFT.width : rBitmapFT.pitch;
- rRawBitmap.mnScanlineSize = (rRawBitmap.mnScanlineSize + 3) & -4;
-
- const sal_uLong nNeededSize = rRawBitmap.mnScanlineSize * rRawBitmap.mnHeight;
- if( rRawBitmap.mnAllocated < nNeededSize )
- {
- rRawBitmap.mnAllocated = 2*nNeededSize;
- rRawBitmap.mpBits.reset(new unsigned char[ rRawBitmap.mnAllocated ]);
- }
-
- const unsigned char* pSrc = rBitmapFT.buffer;
- unsigned char* pDest = rRawBitmap.mpBits.get();
- if( !bEmbedded )
- {
- unsigned int x;
- for( int y = rRawBitmap.mnHeight; --y >= 0 ; )
- {
- // note width is "int" in freetype 2.4.8 and "unsigned int" in 2.5.5
- for (x = 0; x < static_cast<unsigned int>(rBitmapFT.width); ++x)
- *(pDest++) = *(pSrc++);
- for(; x < rRawBitmap.mnScanlineSize; ++x )
- *(pDest++) = 0;
- }
- }
- else
- {
- unsigned int x;
- for( int y = rRawBitmap.mnHeight; --y >= 0 ; )
- {
- unsigned char nSrc = 0;
- // note width is "int" in freetype 2.4.8 and "unsigned int" in 2.5.5
- for (x = 0; x < static_cast<unsigned int>(rBitmapFT.width); ++x, nSrc+=nSrc)
- {
- if( (x & 7) == 0 )
- nSrc = *(pSrc++);
- *(pDest++) = (0x7F - nSrc) >> 8;
- }
- for(; x < rRawBitmap.mnScanlineSize; ++x )
- *(pDest++) = 0;
- }
- }
-
- if( !bEmbedded && mbUseGamma )
- {
- unsigned char* p = rRawBitmap.mpBits.get();
- for( sal_uLong y=0; y < rRawBitmap.mnHeight; y++ )
- {
- for( sal_uLong x=0; x < rRawBitmap.mnWidth; x++ )
- {
- p[x] = aGammaTable[ p[x] ];
- }
- p += rRawBitmap.mnScanlineSize;
- }
- }
-
- FT_Done_Glyph( pGlyphFT );
-
- // special case for 0/90/180/270 degree orientation
- switch( nAngle )
- {
- case -900:
- case +900:
- case +1800:
- case +2700:
- rRawBitmap.Rotate( nAngle );
- break;
- }
-
- return true;
-}
-
// determine unicode ranges in font
const FontCharMapPtr ServerFont::GetFontCharMap() const
diff --git a/vcl/generic/glyphs/gcach_rbmp.cxx b/vcl/generic/glyphs/gcach_rbmp.cxx
deleted file mode 100644
index 37f079c7548b..000000000000
--- a/vcl/generic/glyphs/gcach_rbmp.cxx
+++ /dev/null
@@ -1,251 +0,0 @@
-/* -*- 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 "generic/glyphcache.hxx"
-#include <string.h>
-
-RawBitmap::RawBitmap()
- : mnAllocated(0)
- , mnWidth(0)
- , mnHeight(0)
- , mnScanlineSize(0)
- , mnBitCount(0)
- , mnXOffset(0)
- , mnYOffset(0)
-{
-}
-
-RawBitmap::~RawBitmap()
-{}
-
-// used by 90 and 270 degree rotations on 8 bit deep bitmaps
-static void ImplRotate8_90( unsigned char* p1, const unsigned char* p2,
- int xmax, int ymax, int dx, int dy, int nPad )
-{
- for( int y = ymax; --y >= 0; p2 += dy )
- {
- for( int x = xmax; --x >= 0; p2 += dx )
- *(p1++) = *p2;
- for( int i = nPad; --i >= 0; )
- *(p1++) = 0;
- }
-}
-
-// used by inplace 180 degree rotation on 8 bit deep bitmaps
-static void ImplRotate8_180( unsigned char* p1, int xmax, int ymax, int nPad )
-{
- unsigned char* p2 = p1 + ymax * (xmax + nPad);
- for( int y = ymax/2; --y >= 0; )
- {
- p2 -= nPad;
- for( int x = xmax; --x >= 0; )
- {
- unsigned char cTmp = *(--p2);
- *p2 = *p1;
- *(p1++) = cTmp;
- }
- p1 += nPad;
- }
-
- // reverse middle line
- p2 -= nPad;
- while( p1 < p2 )
- {
- unsigned char cTmp = *(--p2);
- *p2 = *p1;
- *(p1++) = cTmp;
- }
-}
-
-// used by 90 or 270 degree rotations on 1 bit deep bitmaps
-static void ImplRotate1_90( unsigned char* p1, const unsigned char* p2,
- int xmax, int ymax, int dx, int nShift, int nDeltaShift, int nPad )
-{
- for( int y = ymax; --y >= 0; )
- {
- unsigned nTemp = 1;
- const unsigned char* p20 = p2;
- for( int x = xmax; --x >= 0; p2 += dx )
- {
- // build bitwise and store when byte finished
- nTemp += nTemp + ((*p2 >> nShift) & 1);
- if( nTemp >= 0x100U )
- {
- *(p1++) = (unsigned char)nTemp;
- nTemp = 1;
- }
- }
- p2 = p20;
-
- // store left aligned remainder if needed
- if( nTemp > 1 )
- {
- for(; nTemp < 0x100U; nTemp += nTemp ) ;
- *(p1++) = (unsigned char)nTemp;
- }
- // pad scanline with zeroes
- for( int i = nPad; --i >= 0;)
- *(p1++) = 0;
-
- // increase/decrease shift, but keep bound inside 0 to 7
- nShift += nDeltaShift;
- if( nShift != (nShift & 7) )
- p2 -= nDeltaShift;
- nShift &= 7;
- }
-}
-
-// used by 180 degrees rotations on 1 bit deep bitmaps
-static void ImplRotate1_180( unsigned char* p1, const unsigned char* p2,
- int xmax, int ymax, int nPad )
-{
- --p2;
- for( int y = ymax; --y >= 0; )
- {
- p2 -= nPad;
-
- unsigned nTemp = 1;
- unsigned nInp = (0x100 + *p2) >> (-xmax & 7);
- for( int x = xmax; --x >= 0; )
- {
- // build bitwise and store when byte finished
- nTemp += nTemp + (nInp & 1);
- if( nTemp >= 0x100 )
- {
- *(p1++) = (unsigned char)nTemp;
- nTemp = 1;
- }
- // update input byte if needed (and available)
- if( (nInp >>= 1) <= 1 && ((y != 0) || (x != 0)) )
- nInp = 0x100 + *(--p2);
- }
-
- // store left aligned remainder if needed
- if( nTemp > 1 )
- {
- for(; nTemp < 0x100; nTemp += nTemp ) ;
- *(p1++) = (unsigned char)nTemp;
- }
- // scanline pad is already clean
- p1 += nPad;
- }
-}
-
-bool RawBitmap::Rotate( int nAngle )
-{
- sal_uLong nNewScanlineSize = 0;
- sal_uLong nNewHeight = 0;
- sal_uLong nNewWidth = 0;
-
- // do inplace rotation or prepare double buffered rotation
- switch( nAngle )
- {
- case 0: // nothing to do
- case 3600:
- return true;
- default: // non rectangular angles not allowed
- return false;
- case 1800: // rotate by 180 degrees
- mnXOffset = -(mnXOffset + mnWidth);
- mnYOffset = -(mnYOffset + mnHeight);
- if( mnBitCount == 8 )
- {
- ImplRotate8_180( mpBits.get(), mnWidth, mnHeight, mnScanlineSize-mnWidth );
- return true;
- }
- nNewWidth = mnWidth;
- nNewHeight = mnHeight;
- nNewScanlineSize = mnScanlineSize;
- break;
- case +900: // left by 90 degrees
- case -900:
- case 2700: // right by 90 degrees
- nNewWidth = mnHeight;
- nNewHeight = mnWidth;
- if( mnBitCount==1 )
- nNewScanlineSize = (nNewWidth + 7) / 8;
- else
- nNewScanlineSize = (nNewWidth + 3) & -4;
- break;
- }
-
- unsigned int nBufSize = nNewHeight * nNewScanlineSize;
- unsigned char* pBuf = new unsigned char[ nBufSize ];
- if( !pBuf )
- return false;
-
- memset( pBuf, 0, nBufSize );
- int i;
-
- // dispatch non-inplace rotations
- switch( nAngle )
- {
- case 1800: // rotate by 180 degrees
- // we know we only need to deal with 1 bit depth
- ImplRotate1_180( pBuf, mpBits.get() + mnHeight * mnScanlineSize,
- mnWidth, mnHeight, mnScanlineSize - (mnWidth + 7) / 8 );
- break;
- case +900: // rotate left by 90 degrees
- i = mnXOffset;
- mnXOffset = mnYOffset;
- mnYOffset = -nNewHeight - i;
- if( mnBitCount == 8 )
- ImplRotate8_90( pBuf, mpBits.get() + mnWidth - 1,
- nNewWidth, nNewHeight, +mnScanlineSize, -1-mnHeight*mnScanlineSize,
- nNewScanlineSize - nNewWidth );
- else
- ImplRotate1_90( pBuf, mpBits.get() + (mnWidth - 1) / 8,
- nNewWidth, nNewHeight, +mnScanlineSize,
- (-mnWidth & 7), +1, nNewScanlineSize - (nNewWidth + 7) / 8 );
- break;
- case 2700: // rotate right by 90 degrees
- case -900:
- i = mnXOffset;
- mnXOffset = -(nNewWidth + mnYOffset);
- mnYOffset = i;
- if( mnBitCount == 8 )
- ImplRotate8_90( pBuf, mpBits.get() + mnScanlineSize * (mnHeight-1),
- nNewWidth, nNewHeight, -mnScanlineSize, +1+mnHeight*mnScanlineSize,
- nNewScanlineSize - nNewWidth );
- else
- ImplRotate1_90( pBuf, mpBits.get() + mnScanlineSize * (mnHeight-1),
- nNewWidth, nNewHeight, -mnScanlineSize,
- +7, -1, nNewScanlineSize - (nNewWidth + 7) / 8 );
- break;
- }
-
- mnWidth = nNewWidth;
- mnHeight = nNewHeight;
- mnScanlineSize = nNewScanlineSize;
-
- if( nBufSize < mnAllocated )
- {
- memcpy( mpBits.get(), pBuf, nBufSize );
- delete[] pBuf;
- }
- else
- {
- mpBits.reset(pBuf);
- mnAllocated = nBufSize;
- }
-
- return true;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk3/gtk3cairotextrender.cxx b/vcl/headless/svpcairotextrender.cxx
index 0171ef12b022..06abf0ccc48a 100644
--- a/vcl/unx/gtk3/gtk3cairotextrender.cxx
+++ b/vcl/headless/svpcairotextrender.cxx
@@ -7,7 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include "gtk3cairotextrender.hxx"
+#include "svpcairotextrender.hxx"
#include "headless/svpgdi.hxx"
SvpCairoTextRender::SvpCairoTextRender(SvpSalGraphics& rParent)
@@ -22,7 +22,13 @@ GlyphCache& SvpCairoTextRender::getPlatformGlyphCache()
cairo_t* SvpCairoTextRender::getCairoContext()
{
- return mrParent.getCairoContext();
+ cairo_t* pRet = mrParent.getCairoContext();
+ if (!pRet)
+ {
+ mxTmpSurface = mrParent.createSimpleMask();
+ pRet = SvpSalGraphics::createCairoContext(mxTmpSurface);
+ }
+ return pRet;
}
void SvpCairoTextRender::getSurfaceOffset(double& nDX, double& nDY)
@@ -36,8 +42,22 @@ void SvpCairoTextRender::clipRegion(cairo_t* cr)
mrParent.clipRegion(cr);
}
-void SvpCairoTextRender::drawSurface(cairo_t* /*cr*/)
+basebmp::BitmapDeviceSharedPtr SvpCairoTextRender::createSimpleMask()
{
+ return mrParent.createSimpleMask();
+}
+
+void SvpCairoTextRender::drawSurface(cairo_t*)
+{
+ //typically we have drawn directly to the real surface, in edge-cases of
+ //strange surface depths, we'll have drawn into a tmp surface, so flush
+ //it
+ if (mxTmpSurface)
+ {
+ // blend text color into target using the glyph's mask
+ mrParent.BlendTextColor(basebmp::Color(GetTextColor()), mxTmpSurface, basegfx::B2IPoint(0, 0));
+ mxTmpSurface.reset();
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk3/gtk3cairotextrender.hxx b/vcl/headless/svpcairotextrender.hxx
index 1a0a1ec3b871..daae42c51842 100644
--- a/vcl/unx/gtk3/gtk3cairotextrender.hxx
+++ b/vcl/headless/svpcairotextrender.hxx
@@ -17,6 +17,7 @@ class SvpSalGraphics;
class SvpCairoTextRender : public CairoTextRender
{
protected:
+ basebmp::BitmapDeviceSharedPtr mxTmpSurface;
SvpSalGraphics& mrParent;
public:
@@ -27,6 +28,7 @@ public:
virtual void getSurfaceOffset(double& nDX, double& nDY) override;
virtual void clipRegion(cairo_t* cr) override;
virtual void drawSurface(cairo_t* cr) override;
+ virtual basebmp::BitmapDeviceSharedPtr createSimpleMask() override;
};
#endif
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 9ed0870db5a2..05e673cda733 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -20,7 +20,7 @@
#include "headless/svpgdi.hxx"
#include "headless/svpbmp.hxx"
#ifndef IOS
-#include "headless/svptextrender.hxx"
+#include "svpcairotextrender.hxx"
#endif
#include "saldatabasic.hxx"
@@ -101,19 +101,33 @@ namespace
if (!rBuffer)
return false;
- if (rBuffer->getScanlineFormat() != basebmp::Format::ThirtyTwoBitTcMaskBGRX)
+ if (rBuffer->getScanlineFormat() != SVP_CAIRO_FORMAT
+ && rBuffer->getScanlineFormat() != basebmp::Format::OneBitLsbGrey)
return false;
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)
basegfx::B2IVector size = rBuffer->getSize();
sal_Int32 nStride = rBuffer->getScanlineStride();
- return (cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, size.getX()) == nStride);
+ cairo_format_t nFormat;
+ if (rBuffer->getScanlineFormat() == SVP_CAIRO_FORMAT)
+ nFormat = CAIRO_FORMAT_RGB24;
+ else
+ nFormat = CAIRO_FORMAT_A1;
+ return (cairo_format_stride_for_width(nFormat, size.getX()) == nStride);
#else
return false;
#endif
}
}
+#endif
+
+basebmp::BitmapDeviceSharedPtr SvpSalGraphics::createSimpleMask() const
+{
+ return basebmp::createBitmapDevice(m_aOrigDevice->getSize(), true, basebmp::Format::OneBitLsbGrey,
+ cairo_format_stride_for_width(CAIRO_FORMAT_A1, m_aOrigDevice->getSize().getX()));
+}
+
void SvpSalGraphics::clipRegion(cairo_t* cr)
{
RectangleVector aRectangles;
@@ -222,7 +236,7 @@ SvpSalGraphics::SvpSalGraphics() :
m_aDrawMode( basebmp::DrawMode::Paint ),
m_bClipSetup( false )
{
- m_xTextRenderImpl.reset(new SvpTextRender(*this));
+ m_xTextRenderImpl.reset(new SvpCairoTextRender(*this));
}
SvpSalGraphics::~SvpSalGraphics()
@@ -236,8 +250,6 @@ void SvpSalGraphics::setDevice( basebmp::BitmapDeviceSharedPtr& rDevice )
m_xTextRenderImpl->setDevice(rDevice);
}
-#endif
-
void SvpSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY )
{
rDPIX = rDPIY = 96;
@@ -949,9 +961,14 @@ cairo_t* SvpSalGraphics::createCairoContext(const basebmp::BitmapDeviceSharedPtr
sal_Int32 nStride = rBuffer->getScanlineStride();
basebmp::RawMemorySharedArray data = rBuffer->getBuffer();
+ cairo_format_t nFormat;
+ if (rBuffer->getScanlineFormat() == SVP_CAIRO_FORMAT)
+ nFormat = CAIRO_FORMAT_RGB24;
+ else
+ nFormat = CAIRO_FORMAT_A1;
cairo_surface_t *target =
cairo_image_surface_create_for_data(data.get(),
- CAIRO_FORMAT_RGB24,
+ nFormat,
size.getX(), size.getY(),
nStride);
cairo_t* cr = cairo_create(target);
diff --git a/vcl/headless/svpglyphcache.cxx b/vcl/headless/svpglyphcache.cxx
new file mode 100644
index 000000000000..833e750c66a4
--- /dev/null
+++ b/vcl/headless/svpglyphcache.cxx
@@ -0,0 +1,71 @@
+/* -*- 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 <sal/types.h>
+
+#include <cassert>
+
+#include <rtl/instance.hxx>
+#include <tools/debug.hxx>
+
+#include "generic/geninst.h"
+#include "generic/glyphcache.hxx"
+#include "headless/svpgdi.hxx"
+
+class SvpGlyphPeer : public GlyphCachePeer
+{
+public:
+ SvpGlyphPeer() {}
+};
+
+namespace
+{
+ struct GlyphCacheHolder
+ {
+ private:
+ SvpGlyphPeer* m_pSvpGlyphPeer;
+ GlyphCache* m_pSvpGlyphCache;
+ public:
+ GlyphCacheHolder()
+ {
+ m_pSvpGlyphPeer = new SvpGlyphPeer();
+ m_pSvpGlyphCache = new GlyphCache( *m_pSvpGlyphPeer );
+ }
+ GlyphCache& getGlyphCache()
+ {
+ return *m_pSvpGlyphCache;
+ }
+ ~GlyphCacheHolder()
+ {
+ delete m_pSvpGlyphCache;
+ delete m_pSvpGlyphPeer;
+ }
+ };
+
+ struct theGlyphCacheHolder :
+ public rtl::Static<GlyphCacheHolder, theGlyphCacheHolder>
+ {};
+}
+
+GlyphCache& SvpSalGraphics::getPlatformGlyphCache()
+{
+ return theGlyphCacheHolder::get().getGlyphCache();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index 9c941a069f07..fc2420010be3 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -31,12 +31,12 @@
#include "headless/svpdummies.hxx"
#include "headless/svpvd.hxx"
#ifdef IOS
-#include "headless/svpgdi.hxx"
#include "quartz/salbmp.h"
#include "quartz/salgdi.h"
#include "quartz/salvd.h"
#endif
#include "headless/svpbmp.hxx"
+#include "headless/svpgdi.hxx"
#include <salframe.hxx>
#include <svdata.hxx>
@@ -200,12 +200,12 @@ bool SvpSalInstance::CheckTimeout( bool bExecuteTimers )
SalFrame* SvpSalInstance::CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle )
{
- return new SvpSalFrame( this, nullptr, nStyle, SVP_DEFAULT_BITMAP_FORMAT, pParent );
+ return new SvpSalFrame( this, nullptr, nStyle, SVP_CAIRO_FORMAT, pParent );
}
SalFrame* SvpSalInstance::CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle )
{
- return new SvpSalFrame( this, pParent, nStyle, SVP_DEFAULT_BITMAP_FORMAT );
+ return new SvpSalFrame( this, pParent, nStyle, SVP_CAIRO_FORMAT );
}
void SvpSalInstance::DestroyFrame( SalFrame* pFrame )
@@ -416,20 +416,8 @@ void SvpSalTimer::Start( sal_uLong nMS )
m_pInstance->StartTimer( nMS );
}
-void SvpSalInstance::setBitCountFormatMapping( sal_uInt16 nBitCount,
- Format aFormat )
-{
- m_aBitCountFormatMap[nBitCount] = aFormat;
-}
-
Format SvpSalInstance::getFormatForBitCount( sal_uInt16 nBitCount )
{
- BitCountFormatMap::iterator aIt;
- if ( (aIt = m_aBitCountFormatMap.find( nBitCount )) != m_aBitCountFormatMap.end() )
- {
- return aIt->second;
- }
-
switch( nBitCount )
{
case 1:
@@ -444,18 +432,10 @@ Format SvpSalInstance::getFormatForBitCount( sal_uInt16 nBitCount )
#else
return Format::SixteenBitLsbTcMask;
#endif
- case 24:
- return Format::ThirtyTwoBitTcMaskBGRX;
case 32:
return Format::ThirtyTwoBitTcMaskBGRA;
- case 0:
-#ifdef ANDROID
- return Format::ThirtyTwoBitTcMaskRGBA;
-#else
- return Format::ThirtyTwoBitTcMaskBGRX;
-#endif
default:
- return SVP_DEFAULT_BITMAP_FORMAT;
+ return SVP_CAIRO_FORMAT;
}
}
diff --git a/vcl/headless/svptextrender.cxx b/vcl/headless/svptextrender.cxx
deleted file mode 100644
index c4bc49e827ab..000000000000
--- a/vcl/headless/svptextrender.cxx
+++ /dev/null
@@ -1,500 +0,0 @@
-/* -*- 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 <sal/types.h>
-
-#include <cassert>
-
-#include <basebmp/scanlineformats.hxx>
-#include <basegfx/polygon/b2dpolypolygon.hxx>
-#include <basegfx/range/b2drange.hxx>
-#include <basegfx/range/b2ibox.hxx>
-#include <rtl/instance.hxx>
-#include <tools/debug.hxx>
-#include <vcl/sysdata.hxx>
-#include <config_cairo_canvas.h>
-
-#include "generic/geninst.h"
-#include "generic/genpspgraphics.h"
-#include "generic/glyphcache.hxx"
-#include "headless/svpbmp.hxx"
-#include "headless/svpgdi.hxx"
-#include "headless/svptextrender.hxx"
-#include "impfont.hxx"
-#include "outfont.hxx"
-#include "PhysicalFontFace.hxx"
-
-class PhysicalFontCollection;
-
-using namespace basegfx;
-using namespace basebmp;
-
-class SvpGlyphPeer : public GlyphCachePeer
-{
-public:
- SvpGlyphPeer() {}
-
- BitmapDeviceSharedPtr GetGlyphBmp( ServerFont&, sal_GlyphId,
- basebmp::Format nBmpFormat, B2IPoint& rTargetPos );
-
-protected:
- virtual void RemovingFont( ServerFont& ) override;
- virtual void RemovingGlyph( GlyphData& ) override;
-
-};
-
-class SvpGcpHelper
-{
-public:
- RawBitmap maRawBitmap;
- BitmapDeviceSharedPtr maBitmapDev;
-};
-
-class SvpGlyphCache : public GlyphCache
-{
-public:
- explicit SvpGlyphCache( SvpGlyphPeer& rPeer ) : GlyphCache( rPeer) {}
- SvpGlyphPeer& GetPeer() { return reinterpret_cast<SvpGlyphPeer&>( mrPeer ); }
- static SvpGlyphCache& GetInstance();
-};
-
-namespace
-{
- struct GlyphCacheHolder
- {
- private:
- SvpGlyphPeer* m_pSvpGlyphPeer;
- SvpGlyphCache* m_pSvpGlyphCache;
- public:
- GlyphCacheHolder()
- {
- m_pSvpGlyphPeer = new SvpGlyphPeer();
- m_pSvpGlyphCache = new SvpGlyphCache( *m_pSvpGlyphPeer );
- }
- SvpGlyphCache& getGlyphCache()
- {
- return *m_pSvpGlyphCache;
- }
- ~GlyphCacheHolder()
- {
- delete m_pSvpGlyphCache;
- delete m_pSvpGlyphPeer;
- }
- };
-
- struct theGlyphCacheHolder :
- public rtl::Static<GlyphCacheHolder, theGlyphCacheHolder>
- {};
-}
-
-SvpGlyphCache& SvpGlyphCache::GetInstance()
-{
- return theGlyphCacheHolder::get().getGlyphCache();
-}
-
-BitmapDeviceSharedPtr SvpGlyphPeer::GetGlyphBmp( ServerFont& rServerFont,
- sal_GlyphId aGlyphId, basebmp::Format nBmpFormat, B2IPoint& rTargetPos )
-{
- GlyphData& rGlyphData = rServerFont.GetGlyphData( aGlyphId );
-
- if( rGlyphData.ExtDataRef().meInfo != nBmpFormat )
- {
- SvpGcpHelper* pGcpHelper = rGlyphData.ExtDataRef().mpData;
- bool bNew = pGcpHelper == nullptr;
- if( bNew )
- pGcpHelper = new SvpGcpHelper;
-
- // get glyph bitmap in matching format
- bool bFound = false;
- switch( nBmpFormat )
- {
- case Format::OneBitLsbGrey:
- bFound = rServerFont.GetGlyphBitmap1( aGlyphId, pGcpHelper->maRawBitmap );
- break;
- case Format::EightBitGrey:
- bFound = rServerFont.GetGlyphBitmap8( aGlyphId, pGcpHelper->maRawBitmap );
- break;
- default:
- OSL_FAIL( "SVP GCP::GetGlyphBmp(): illegal scanline format");
- // fall back to black&white mask
- nBmpFormat = Format::OneBitLsbGrey;
- bFound = false;
- break;
- }
-
- // return .notdef glyph if needed
- if( !bFound && (aGlyphId != 0) )
- {
- if( bNew )
- delete pGcpHelper;
- return GetGlyphBmp( rServerFont, 0, nBmpFormat, rTargetPos );
- }
-
- // construct alpha mask from raw bitmap
- if (pGcpHelper->maRawBitmap.mnScanlineSize && pGcpHelper->maRawBitmap.mnHeight)
- {
- const B2IVector aSize(
- pGcpHelper->maRawBitmap.mnScanlineSize,
- pGcpHelper->maRawBitmap.mnHeight );
- static PaletteMemorySharedVector aDummyPAL;
- pGcpHelper->maBitmapDev = createBitmapDevice( aSize, true, nBmpFormat, aSize.getX(), pGcpHelper->maRawBitmap.mpBits, aDummyPAL );
- }
-
- rGlyphData.ExtDataRef().meInfo = nBmpFormat;
- rGlyphData.ExtDataRef().mpData = pGcpHelper;
- }
-
- SvpGcpHelper* pGcpHelper = static_cast<SvpGcpHelper*>(
- rGlyphData.ExtDataRef().mpData);
- assert(pGcpHelper != nullptr);
- rTargetPos += B2IPoint( pGcpHelper->maRawBitmap.mnXOffset, pGcpHelper->maRawBitmap.mnYOffset );
- return pGcpHelper->maBitmapDev;
-}
-
-void SvpGlyphPeer::RemovingFont( ServerFont& )
-{
- // nothing to do: no font resources held in SvpGlyphPeer
-}
-
-void SvpGlyphPeer::RemovingGlyph( GlyphData& rGlyphData )
-{
- SvpGcpHelper* pGcpHelper = rGlyphData.ExtDataRef().mpData;
- rGlyphData.ExtDataRef().meInfo = basebmp::Format::NONE;
- rGlyphData.ExtDataRef().mpData = nullptr;
- delete pGcpHelper;
-}
-
-SvpTextRender::SvpTextRender(SvpSalGraphics& rParent)
- : m_rParent(rParent)
- , m_aTextColor(COL_BLACK)
- , m_eTextFmt(basebmp::Format::EightBitGrey)
-{
- for( int i = 0; i < MAX_FALLBACK; ++i )
- m_pServerFont[i] = nullptr;
-}
-
-sal_uInt16 SvpTextRender::SetFont( FontSelectPattern* pIFSD, int nFallbackLevel )
-{
- // release all no longer needed font resources
- for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i )
- {
- if( m_pServerFont[i] != nullptr )
- {
- // old server side font is no longer referenced
- SvpGlyphCache::GetInstance().UncacheFont( *m_pServerFont[i] );
- m_pServerFont[i] = nullptr;
- }
- }
-
- // return early if there is no new font
- if( !pIFSD )
- return 0;
-
- // handle the request for a non-native X11-font => use the GlyphCache
- ServerFont* pServerFont = SvpGlyphCache::GetInstance().CacheFont( *pIFSD );
- if( !pServerFont )
- return SAL_SETFONT_BADFONT;
-
- // check selected font
- if( !pServerFont->TestFont() )
- {
- SvpGlyphCache::GetInstance().UncacheFont( *pServerFont );
- return SAL_SETFONT_BADFONT;
- }
-
- // update SalGraphics font settings
- m_pServerFont[ nFallbackLevel ] = pServerFont;
- return SAL_SETFONT_USEDRAWTEXTARRAY;
-}
-
-void SvpTextRender::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel )
-{
- if( nFallbackLevel >= MAX_FALLBACK )
- return;
-
- if( m_pServerFont[nFallbackLevel] != nullptr )
- {
- long rDummyFactor;
- m_pServerFont[nFallbackLevel]->FetchFontMetric( *pMetric, rDummyFactor );
- }
-}
-
-const FontCharMapPtr SvpTextRender::GetFontCharMap() const
-{
- if( !m_pServerFont[0] )
- return nullptr;
-
- const FontCharMapPtr pFCMap = m_pServerFont[0]->GetFontCharMap();
- return pFCMap;
-}
-
-bool SvpTextRender::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
-{
- if (!m_pServerFont[0])
- return false;
-
- return m_pServerFont[0]->GetFontCapabilities(rFontCapabilities);
-}
-
-void SvpTextRender::GetDevFontList( PhysicalFontCollection* pFontCollection )
-{
- GlyphCache& rGC = SvpGlyphCache::GetInstance();
-
- psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
- psp::FastPrintFontInfo aInfo;
- ::std::list< psp::fontID > aList;
- rMgr.getFontList( aList );
- ::std::list< psp::fontID >::iterator it;
- for( it = aList.begin(); it != aList.end(); ++it )
- {
- if( !rMgr.getFontFastInfo( *it, aInfo ) )
- continue;
-
- // normalize face number to the GlyphCache
- int nFaceNum = rMgr.getFontFaceNumber( aInfo.m_nID );
-
- // inform GlyphCache about this font provided by the PsPrint subsystem
- ImplDevFontAttributes aDFA = GenPspGraphics::Info2DevFontAttributes( aInfo );
- aDFA.mnQuality += 4096;
- const OString& rFileName = rMgr.getFontFileSysPath( aInfo.m_nID );
- rGC.AddFontFile( rFileName, nFaceNum, aInfo.m_nID, aDFA );
- }
-
- // announce glyphcache fonts
- rGC.AnnounceFonts( pFontCollection );
-
- // register platform specific font substitutions if available
- SalGenericInstance::RegisterFontSubstitutors( pFontCollection );
-
- ImplGetSVData()->maGDIData.mbNativeFontConfig = true;
-}
-
-void SvpTextRender::ClearDevFontCache()
-{
- GlyphCache& rGC = SvpGlyphCache::GetInstance();
- rGC.ClearFontCache();
-}
-
-bool SvpTextRender::AddTempDevFont( PhysicalFontCollection* pFontCollection,
- const OUString& rFileURL,
- const OUString& rFontName )
-{
- return GenPspGraphics::AddTempDevFontHelper( pFontCollection, rFileURL, rFontName, SvpGlyphCache::GetInstance() );
-}
-
-bool SvpTextRender::CreateFontSubset(
- const OUString& rToFile,
- const PhysicalFontFace* pFont,
- const sal_GlyphId* pGlyphIds,
- const sal_uInt8* pEncoding,
- sal_Int32* pWidths,
- int nGlyphCount,
- FontSubsetInfo& rInfo
- )
-{
- // in this context the pFont->GetFontId() is a valid PSP
- // font since they are the only ones left after the PDF
- // export has filtered its list of subsettable fonts (for
- // which this method was created). The correct way would
- // be to have the GlyphCache search for the PhysicalFontFace pFont
- psp::fontID aFont = pFont->GetFontId();
-
- psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
- bool bSuccess = rMgr.createFontSubset( rInfo,
- aFont,
- rToFile,
- pGlyphIds,
- pEncoding,
- pWidths,
- nGlyphCount );
- return bSuccess;
-}
-
-const Ucs2SIntMap* SvpTextRender::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority)
-{
- // in this context the pFont->GetFontId() is a valid PSP
- // font since they are the only ones left after the PDF
- // export has filtered its list of subsettable fonts (for
- // which this method was created). The correct way would
- // be to have the GlyphCache search for the PhysicalFontFace pFont
- psp::fontID aFont = pFont->GetFontId();
- return GenPspGraphics::DoGetFontEncodingVector(aFont, pNonEncoded, ppPriority);
-}
-
-const void* SvpTextRender::GetEmbedFontData(
- const PhysicalFontFace* pFont,
- const sal_Ucs* pUnicodes,
- sal_Int32* pWidths,
- size_t nLen,
- FontSubsetInfo& rInfo,
- long* pDataLen
- )
-{
- // in this context the pFont->GetFontId() is a valid PSP
- // font since they are the only ones left after the PDF
- // export has filtered its list of subsettable fonts (for
- // which this method was created). The correct way would
- // be to have the GlyphCache search for the PhysicalFontFace pFont
- psp::fontID aFont = pFont->GetFontId();
- return GenPspGraphics::DoGetEmbedFontData( aFont, pUnicodes, pWidths, nLen, rInfo, pDataLen );
-}
-
-void SvpTextRender::FreeEmbedFontData( const void* pData, long nLen )
-{
- GenPspGraphics::DoFreeEmbedFontData( pData, nLen );
-}
-
-void SvpTextRender::GetGlyphWidths( const PhysicalFontFace* pFont,
- bool bVertical,
- Int32Vector& rWidths,
- Ucs2UIntMap& rUnicodeEnc )
-{
- // in this context the pFont->GetFontId() is a valid PSP
- // font since they are the only ones left after the PDF
- // export has filtered its list of subsettable fonts (for
- // which this method was created). The correct way would
- // be to have the GlyphCache search for the PhysicalFontFace pFont
- psp::fontID aFont = pFont->GetFontId();
- GenPspGraphics::DoGetGlyphWidths( aFont, bVertical, rWidths, rUnicodeEnc );
-}
-
-bool SvpTextRender::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect )
-{
- const int nLevel = aGlyphId >> GF_FONTSHIFT;
- if( nLevel >= MAX_FALLBACK )
- return false;
-
- ServerFont* pSF = m_pServerFont[ nLevel ];
- if( !pSF )
- return false;
-
- aGlyphId &= GF_IDXMASK;
- const GlyphMetric& rGM = pSF->GetGlyphMetric( aGlyphId );
- rRect = Rectangle( rGM.GetOffset(), rGM.GetSize() );
- return true;
-}
-
-bool SvpTextRender::GetGlyphOutline( sal_GlyphId aGlyphId, B2DPolyPolygon& rPolyPoly )
-{
- const int nLevel = aGlyphId >> GF_FONTSHIFT;
- if( nLevel >= MAX_FALLBACK )
- return false;
-
- const ServerFont* pSF = m_pServerFont[ nLevel ];
- if( !pSF )
- return false;
-
- aGlyphId &= GF_IDXMASK;
- if( pSF->GetGlyphOutline( aGlyphId, rPolyPoly ) )
- return true;
-
- return false;
-}
-
-SalLayout* SvpTextRender::GetTextLayout( ImplLayoutArgs&, int nFallbackLevel )
-{
- GenericSalLayout* pLayout = nullptr;
-
- if( m_pServerFont[ nFallbackLevel ] )
- pLayout = new ServerFontLayout( *m_pServerFont[ nFallbackLevel ] );
-
- return pLayout;
-}
-
-void SvpTextRender::DrawServerFontLayout( const ServerFontLayout& rSalLayout )
-{
- // iterate over all glyphs in the layout
- Point aPos;
- sal_GlyphId aGlyphId;
- SvpGlyphPeer& rGlyphPeer = SvpGlyphCache::GetInstance().GetPeer();
- for( int nStart = 0; rSalLayout.GetNextGlyphs( 1, &aGlyphId, aPos, nStart ); )
- {
- ServerFont& rFont = rSalLayout.GetServerFont();
- // get the glyph's alpha mask and adjust the drawing position
- aGlyphId &= GF_IDXMASK;
- B2IPoint aDstPoint( aPos.X(), aPos.Y() );
- BitmapDeviceSharedPtr aAlphaMask
- = rGlyphPeer.GetGlyphBmp(rFont, aGlyphId, m_eTextFmt, aDstPoint);
- if( !aAlphaMask ) // ignore empty glyphs
- continue;
-
- // blend text color into target using the glyph's mask
- m_rParent.BlendTextColor(m_aTextColor, aAlphaMask, aDstPoint);
- }
-}
-
-void SvpTextRender::SetTextColor( SalColor nSalColor )
-{
- m_aTextColor = basebmp::Color( nSalColor );
-}
-
-#if ENABLE_CAIRO_CANVAS
-
-SystemFontData SvpTextRender::GetSysFontData( int nFallbackLevel ) const
-{
- SystemFontData aSysFontData;
-
- if (nFallbackLevel >= MAX_FALLBACK) nFallbackLevel = MAX_FALLBACK - 1;
- if (nFallbackLevel < 0 ) nFallbackLevel = 0;
-
- if (m_pServerFont[nFallbackLevel] != nullptr)
- {
- ServerFont* rFont = m_pServerFont[nFallbackLevel];
- aSysFontData.nFontId = rFont->GetFtFace();
- aSysFontData.nFontFlags = rFont->GetLoadFlags();
- aSysFontData.bFakeBold = rFont->NeedsArtificialBold();
- aSysFontData.bFakeItalic = rFont->NeedsArtificialItalic();
- aSysFontData.bAntialias = rFont->GetAntialiasAdvice();
- aSysFontData.bVerticalCharacterType = rFont->GetFontSelData().mbVertical;
- }
-
- return aSysFontData;
-}
-
-#endif // ENABLE_CAIRO_CANVAS
-
-void SvpTextRender::setDevice( basebmp::BitmapDeviceSharedPtr& rDevice )
-{
- // determine matching bitmap format for masks
- basebmp::Format nDeviceFmt = rDevice ? rDevice->getScanlineFormat() : basebmp::Format::EightBitGrey;
- switch( nDeviceFmt )
- {
- case basebmp::Format::EightBitGrey:
- case basebmp::Format::SixteenBitLsbTcMask:
- case basebmp::Format::SixteenBitMsbTcMask:
- case basebmp::Format::TwentyFourBitTcMask:
- case basebmp::Format::ThirtyTwoBitTcMaskBGRX:
- case basebmp::Format::ThirtyTwoBitTcMaskBGRA:
- case basebmp::Format::ThirtyTwoBitTcMaskARGB:
- case basebmp::Format::ThirtyTwoBitTcMaskABGR:
- case basebmp::Format::ThirtyTwoBitTcMaskRGBA:
- m_eTextFmt = basebmp::Format::EightBitGrey;
- break;
- default:
- m_eTextFmt = basebmp::Format::OneBitLsbGrey;
- break;
- }
-}
-
-GlyphCache& SvpSalGraphics::getPlatformGlyphCache()
-{
- return SvpGlyphCache::GetInstance();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx
index fab2c153fa49..f861ac76a9d5 100644
--- a/vcl/headless/svpvd.cxx
+++ b/vcl/headless/svpvd.cxx
@@ -94,13 +94,6 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY,
return true;
}
-void InitSvpForLibreOfficeKit()
-{
- ImplSVData* pSVData = ImplGetSVData();
- SvpSalInstance* pSalInstance = static_cast< SvpSalInstance* >(pSVData->mpDefInst);
- pSalInstance->setBitCountFormatMapping( 32, ::basebmp::Format::ThirtyTwoBitTcMaskRGBA );
-}
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/cairotextrender.hxx b/vcl/inc/cairotextrender.hxx
index aad3220ff3a2..1ff7d94b85a5 100644
--- a/vcl/inc/cairotextrender.hxx
+++ b/vcl/inc/cairotextrender.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_VCL_INC_UNX_CAIROTEXTRENDER_HXX
#include "textrender.hxx"
+#include <basebmp/bitmapdevice.hxx>
#include <vcl/region.hxx>
#include <deque>
@@ -80,6 +81,10 @@ protected:
virtual cairo_t* getCairoContext() = 0;
virtual void getSurfaceOffset(double& nDX, double& nDY) = 0;
virtual void drawSurface(cairo_t* cr) = 0;
+ virtual basebmp::BitmapDeviceSharedPtr createSimpleMask()
+ {
+ return basebmp::BitmapDeviceSharedPtr();
+ }
bool setFont( const FontSelectPattern *pEntry, int nFallbackLevel );
@@ -126,7 +131,10 @@ public:
virtual bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ) override;
virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
virtual void DrawServerFontLayout( const ServerFontLayout& ) override;
+#if ENABLE_CAIRO_CANVAS
virtual SystemFontData GetSysFontData( int nFallbackLevel ) const override;
+#endif
+ SalColor GetTextColor() const { return mnTextColor; }
};
#endif
diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx
index 801ef4a25b55..eb708d6f8756 100644
--- a/vcl/inc/generic/glyphcache.hxx
+++ b/vcl/inc/generic/glyphcache.hxx
@@ -44,7 +44,6 @@ class GlyphData;
class GraphiteFaceWrapper;
class FontConfigFontOptions;
class PhysicalFontCollection;
-class RawBitmap;
class ServerFont;
class ServerFontLayout;
class ServerFontLayoutEngine;
@@ -153,12 +152,8 @@ public:
void SetLruValue( int n ) const { mnLruValue = n; }
long GetLruValue() const { return mnLruValue;}
- ExtGlyphData& ExtDataRef() { return maExtData; }
- const ExtGlyphData& ExtDataRef() const { return maExtData; }
-
private:
GlyphMetric maMetric;
- ExtGlyphData maExtData;
// used by GlyphCache for cache LRU algorithm
mutable long mnLruValue;
@@ -201,8 +196,6 @@ public:
sal_GlyphId FixupGlyphIndex( sal_GlyphId aGlyphId, sal_UCS4 ) const;
bool GetGlyphOutline( sal_GlyphId aGlyphId, ::basegfx::B2DPolyPolygon& ) const;
bool GetAntialiasAdvice() const;
- bool GetGlyphBitmap1( sal_GlyphId aGlyphId, RawBitmap& ) const;
- bool GetGlyphBitmap8( sal_GlyphId aGlyphId, RawBitmap& ) const;
private:
friend class GlyphCache;
@@ -330,28 +323,6 @@ public:
virtual void RemovingGlyph( GlyphData& ) {}
};
-class VCL_DLLPUBLIC RawBitmap
-{
-public:
- RawBitmap();
- ~RawBitmap();
-
- bool Rotate( int nAngle );
-
-public:
- basebmp::RawMemorySharedArray mpBits;
- sal_uLong mnAllocated;
-
- sal_uLong mnWidth;
- sal_uLong mnHeight;
-
- sal_uLong mnScanlineSize;
- sal_uLong mnBitCount;
-
- int mnXOffset;
- int mnYOffset;
-};
-
#endif // INCLUDED_VCL_INC_GENERIC_GLYPHCACHE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/headless/svpbmp.hxx b/vcl/inc/headless/svpbmp.hxx
index 4fd4dd258d7f..757f6d52e03a 100644
--- a/vcl/inc/headless/svpbmp.hxx
+++ b/vcl/inc/headless/svpbmp.hxx
@@ -27,8 +27,6 @@
#include <salbmp.hxx>
-#define SVP_DEFAULT_BITMAP_FORMAT basebmp::Format::ThirtyTwoBitTcMaskBGRX
-
class VCL_DLLPUBLIC SvpSalBitmap : public SalBitmap
{
basebmp::BitmapDeviceSharedPtr m_aBitmap;
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 2811764117c9..5320909791ff 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -34,6 +34,16 @@
#define SvpSalGraphics AquaSalGraphics
#else
+//Using formats that match cairo's formats. For android we patch cairo,
+//which is internal in that case, to swap the rgb components so that
+//cairo then matches the OpenGL GL_RGBA format so we can use it there
+//where we don't have GL_BGRA support.
+#ifdef ANDROID
+# define SVP_CAIRO_FORMAT basebmp::Format::ThirtyTwoBitTcMaskRGBA
+#else
+# define SVP_CAIRO_FORMAT basebmp::Format::ThirtyTwoBitTcMaskBGRX
+#endif
+
class GlyphCache;
class ServerFont;
typedef struct _cairo cairo_t;
@@ -56,6 +66,7 @@ public:
static GlyphCache& getPlatformGlyphCache();
void BlendTextColor(const basebmp::Color &rTextColor, const basebmp::BitmapDeviceSharedPtr &rAlphaMask,
const basegfx::B2IPoint &rDstPoint);
+ basebmp::BitmapDeviceSharedPtr createSimpleMask() const;
void setDevice(basebmp::BitmapDeviceSharedPtr& rDevice);
private:
diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx
index 5f9d9806e4b6..5d926f5ba469 100644
--- a/vcl/inc/headless/svpinst.hxx
+++ b/vcl/inc/headless/svpinst.hxx
@@ -30,7 +30,6 @@
#include <basebmp/scanlineformats.hxx>
#include <list>
-#include <map>
#include <time.h>
@@ -88,9 +87,6 @@ class VCL_DLLPUBLIC SvpSalInstance : public SalGenericInstance
void DoReleaseYield( int nTimeoutMS );
- typedef std::map< sal_uInt16, ::basebmp::Format > BitCountFormatMap;
- BitCountFormatMap m_aBitCountFormatMap;
-
public:
static SvpSalInstance* s_pDefaultInstance;
@@ -171,12 +167,6 @@ public:
virtual GenPspGraphics *CreatePrintGraphics() override;
- // We want to be able to select colourspace, i.e. ARGB vs RGBA vs BGRA etc.
- // -- as the rest of vcl always uses bit depths, it is perhaps simplest
- // to let us simply change the mapping of bitcount to format (which was
- // previously unchangeable).
- void setBitCountFormatMapping( sal_uInt16 nBitCount, ::basebmp::Format aFormat );
-
::basebmp::Format getFormatForBitCount( sal_uInt16 );
};
diff --git a/vcl/inc/headless/svptextrender.hxx b/vcl/inc/headless/svptextrender.hxx
deleted file mode 100644
index 43fd78d2f758..000000000000
--- a/vcl/inc/headless/svptextrender.hxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- 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 .
- */
-
-#ifndef INCLUDED_VCL_INC_HEADLESS_SVPTEXTRENDER_HXX
-#define INCLUDED_VCL_INC_HEADLESS_SVPTEXTRENDER_HXX
-
-#include "textrender.hxx"
-#include <vcl/region.hxx>
-#include <deque>
-#include <config_cairo_canvas.h>
-
-class VCL_DLLPUBLIC SvpTextRender : public TextRenderImpl
-{
-private:
- SvpSalGraphics& m_rParent;
- // These fields are used only when we use FreeType to draw into a
- // headless backend, i.e. not on iOS.
- basebmp::Color m_aTextColor;
- basebmp::Format m_eTextFmt;
- ServerFont* m_pServerFont[ MAX_FALLBACK ];
-public:
- SvpTextRender(SvpSalGraphics& rParent);
- virtual void setDevice(basebmp::BitmapDeviceSharedPtr& rDevice) override;
-
- virtual void SetTextColor( SalColor nSalColor ) override;
- virtual sal_uInt16 SetFont( FontSelectPattern*, int nFallbackLevel ) override;
- virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ) override;
- virtual const FontCharMapPtr GetFontCharMap() const override;
- virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
- virtual void GetDevFontList( PhysicalFontCollection* ) override;
- virtual void ClearDevFontCache() override;
- virtual bool AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
- virtual bool CreateFontSubset(
- const OUString& rToFile,
- const PhysicalFontFace*,
- const sal_GlyphId* pGlyphIDs,
- const sal_uInt8* pEncoding,
- sal_Int32* pWidths,
- int nGlyphs,
- FontSubsetInfo& rInfo) override;
-
- virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const**) override;
- virtual const void* GetEmbedFontData(
- const PhysicalFontFace*,
- const sal_Ucs* pUnicodes,
- sal_Int32* pWidths,
- size_t nLen,
- FontSubsetInfo& rInfo,
- long* pDataLen ) override;
-
- virtual void FreeEmbedFontData( const void* pData, long nDataLen ) override;
- virtual void GetGlyphWidths(
- const PhysicalFontFace*,
- bool bVertical,
- Int32Vector& rWidths,
- Ucs2UIntMap& rUnicodeEnc ) override;
-
- virtual bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ) override;
- virtual bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ) override;
- virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
- virtual void DrawServerFontLayout( const ServerFontLayout& ) override;
-#if ENABLE_CAIRO_CANVAS
- virtual SystemFontData GetSysFontData( int nFallbackLevel ) const override;
-#endif // ENABLE_CAIRO_CANVAS
-};
-
-#endif // INCLUDED_VCL_INC_HEADLESS_SVPTEXTRENDER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 7190adbb2f96..a78e56df167c 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -532,6 +532,7 @@ SalLayout* CairoTextRender::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackL
return pLayout;
}
+#if ENABLE_CAIRO_CANVAS
SystemFontData CairoTextRender::GetSysFontData( int nFallbackLevel ) const
{
SystemFontData aSysFontData;
@@ -552,6 +553,7 @@ SystemFontData CairoTextRender::GetSysFontData( int nFallbackLevel ) const
return aSysFontData;
}
+#endif
bool CairoTextRender::CreateFontSubset(
const OUString& rToFile,
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index 3a0ab9b4f61c..09ce9a089d81 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -1969,7 +1969,7 @@ void GtkSalFrame::AllocateFrame()
aFrameSize.setY( 1 );
int cairo_stride = cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, aFrameSize.getX());
m_aFrame = basebmp::createBitmapDevice(aFrameSize, true,
- basebmp::Format::ThirtyTwoBitTcMaskBGRX, cairo_stride);
+ SVP_CAIRO_FORMAT, cairo_stride);
m_aFrame->setDamageTracker(
basebmp::IBitmapDeviceDamageTrackerSharedPtr(new DamageTracker(*this)) );
SAL_INFO("vcl.gtk3", "allocated m_aFrame size of " << maGeometry.nWidth << " x " << maGeometry.nHeight);
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 7c25774a865f..3a991e63c715 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -17,7 +17,6 @@
#include <vcl/decoview.hxx>
#include <vcl/settings.hxx>
#include "fontmanager.hxx"
-#include "gtk3cairotextrender.hxx"
#include "cairo_gtk3_cairo.hxx"
#include <boost/optional.hpp>
@@ -1999,8 +1998,6 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
mpFrame( pFrame ),
mpWindow( pWindow )
{
- m_xTextRenderImpl.reset(new SvpCairoTextRender(*this));
-
if(style_loaded)
return;