diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-02-15 13:14:32 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-04-03 11:57:08 +0200 |
commit | 86ea64f216819696cd86d1926aff0a138ace2baf (patch) | |
tree | db513803abc9dc255d27c0f08cba6d6d0c9ef1d9 /vcl/headless | |
parent | 994b41a6c69d20637dcb95894c385f5c0102d600 (diff) |
Support for native 32bit Bitmap in VCL and SVP (cairo) backend
This adds basic support for 32bit bitmaps for the SVP backend. For
other backends the support is disabled for now as we need to add it for
each backend separately and enable support.
When this patch is applied it is possible to a Bitmap with bit count
32, but currently no input filter uses this with the exception of the
new PngImageReader(libpng based), which is used only for the icons.
For a general support more things need to be implemented and tested:
- conversion back and fourth between 32-bit and 24-bit + 8bit alpha (or
other supported pairs)
- 'raw' export of the bitmap needs to be handeled properly (like in
SVM import/export) so it creates the correct image.
- input filters need to be checked and converted if this is necessary
- look for possible bugs when drawing transparent bitmaps
- check of UNO API
Change-Id: I7a7be0e6134dfdd9a7aeaef897131bb6e710ae7e
Reviewed-on: https://gerrit.libreoffice.org/69289
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/headless')
-rw-r--r-- | vcl/headless/svpgdi.cxx | 12 | ||||
-rw-r--r-- | vcl/headless/svpinst.cxx | 7 |
2 files changed, 12 insertions, 7 deletions
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 08cb2bfec940..3ec663c8706b 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -1624,7 +1624,7 @@ void SvpSalGraphics::drawBitmap(const SalTwoRect& rTR, const SalBitmap& rSourceB { SourceHelper aSurface(rSourceBitmap); cairo_surface_t* source = aSurface.getSurface(); - copySource(rTR, source); + copyWithOperator(rTR, source, CAIRO_OPERATOR_OVER); } void SvpSalGraphics::drawBitmap(const SalTwoRect& rTR, const BitmapBuffer* pBuffer, cairo_operator_t eOp) @@ -1749,11 +1749,10 @@ std::shared_ptr<SalBitmap> SvpSalGraphics::getBitmap( long nX, long nY, long nWi Color SvpSalGraphics::getPixel( long nX, long nY ) { #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - cairo_surface_t *target = cairo_surface_create_similar_image(m_pSurface, + cairo_surface_t *target = cairo_surface_create_similar_image(m_pSurface, CAIRO_FORMAT_ARGB32, 1, 1); #else - cairo_surface_t *target = cairo_image_surface_create( + cairo_surface_t *target = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1); #endif - CAIRO_FORMAT_ARGB32, 1, 1); cairo_t* cr = cairo_create(target); @@ -1769,11 +1768,10 @@ Color SvpSalGraphics::getPixel( long nX, long nY ) sal_uInt8 b = unpremultiply_table[a][data[SVP_CAIRO_BLUE]]; sal_uInt8 g = unpremultiply_table[a][data[SVP_CAIRO_GREEN]]; sal_uInt8 r = unpremultiply_table[a][data[SVP_CAIRO_RED]]; - Color nRet = Color(r, g, b); - + Color aColor(0xFF - a, r, g, b); cairo_surface_destroy(target); - return nRet; + return aColor; } namespace diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 49a64c7fa8bf..324d976cb95e 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -537,6 +537,13 @@ void SvpSalInstance::AddToRecentDocumentList(const OUString&, const OUString&, c { } +std::shared_ptr<vcl::BackendCapabilities> SvpSalInstance::GetBackendCapabilities() +{ + auto pBackendCapabilities = SalInstance::GetBackendCapabilities(); + pBackendCapabilities->mbSupportsBitmap32 = true; + return pBackendCapabilities; +} + //obviously doesn't actually do anything, it's just a nonfunctional stub #ifdef LIBO_HEADLESS |