summaryrefslogtreecommitdiffstats
path: root/vcl/headless
diff options
context:
space:
mode:
authorArmin Le Grand (Allotropia) <Armin.Le.Grand@me.com>2021-04-30 17:26:41 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2021-05-27 09:55:01 +0200
commit3526905a6245dfc6d2d5103eded6e20d1ed3e2a6 (patch)
tree912d3e5b8f1ea72eeac8037a4ad4acec73332e52 /vcl/headless
parentwasm sript: drop none-Writer modules (diff)
downloadcore-3526905a6245dfc6d2d5103eded6e20d1ed3e2a6.tar.gz
core-3526905a6245dfc6d2d5103eded6e20d1ed3e2a6.zip
wasm strip: squashed patches from Armin + fixes
In addition to the squashed patches, this patch * drops the global compiler defines in favour of a config header file, for better ccache usage * revers almost all header changes in favour for empty function calls (just keeĆ¼s the premultiply table drop) * some additional changes for unused function calls * adapts more component files, so building the services.db and the component_mao.cxx from the build still works Currently crashs with anything different then soffice --writer. Closing the document also crashes. fac2aeca4010 Wasm optional premultiply table replace ec9e2c81b4ec Wasm remove hunspell/hyphen optionally 302a6f6f777a Wasm LanguageGuess optional removal 55404a55984c Wasm oprtional autorecovery remove additions 640d53e1e7c1 Wasm optional EPUB removal 4a09f57c132c Wasm strip: remove UcpHelp eeebc1383df7 Wasm optional accessibility removal b95eaa630273 Additions/corrections to dbaccess wasm removal d8c11d72aa5a Wasm: Removed dbaccess optional f7d462b61c08 WASM Removal of clucene a1c508fc1c41 Stripped canvas/cppcanvas and related ebfb45f46319 Use more expressive ENABLE_WASM_STRIP markers a3519b1a41c8 Disable wpftcalc for wasm reduction fa86c5bc36f7 Chart wasm optional removal 90d9a8dee35a BackingWindow (RecentDocsView) optional removal 68e5f972b1a6 Deeper TipOfTheDay optional removal 4ed18d09ce07 Optional removal of more startup-modules ab8d809b6ab7 Remove RecoveryCore f82517838840 Remove RecoveryUI, correct spl stuff f38dca150d58 SplashScreen and Startup Not included: 10963e79ac7d Wasm optional reduce created locales Change-Id: Ib9c0f9452815910c0a2aceaf142ba1ad4a9cb0d7
Diffstat (limited to 'vcl/headless')
-rw-r--r--vcl/headless/svpgdi.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index c756c79ae60a..20f1c0b8a7d8 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -2203,7 +2203,9 @@ void SvpSalGraphics::drawMask( const SalTwoRect& rTR,
}
sal_Int32 nStride;
unsigned char *mask_data = aSurface.getBits(nStride);
+#ifndef ENABLE_WASM_STRIP_PREMULTIPLY
vcl::bitmap::lookup_table const & unpremultiply_table = vcl::bitmap::get_unpremultiply_table();
+#endif
for (tools::Long y = rTR.mnSrcY ; y < rTR.mnSrcY + rTR.mnSrcHeight; ++y)
{
unsigned char *row = mask_data + (nStride*y);
@@ -2211,9 +2213,15 @@ void SvpSalGraphics::drawMask( const SalTwoRect& rTR,
for (tools::Long x = rTR.mnSrcX; x < rTR.mnSrcX + rTR.mnSrcWidth; ++x)
{
sal_uInt8 a = data[SVP_CAIRO_ALPHA];
+#ifdef ENABLE_WASM_STRIP_PREMULTIPLY
+ sal_uInt8 b = vcl::bitmap::unpremultiply(a, data[SVP_CAIRO_BLUE]);
+ sal_uInt8 g = vcl::bitmap::unpremultiply(a, data[SVP_CAIRO_GREEN]);
+ sal_uInt8 r = vcl::bitmap::unpremultiply(a, data[SVP_CAIRO_RED]);
+#else
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]];
+#endif
if (r == 0 && g == 0 && b == 0)
{
data[0] = nMaskColor.GetBlue();
@@ -2316,12 +2324,20 @@ Color SvpSalGraphics::getPixel( tools::Long nX, tools::Long nY )
cairo_destroy(cr);
cairo_surface_flush(target);
+#ifndef ENABLE_WASM_STRIP_PREMULTIPLY
vcl::bitmap::lookup_table const & unpremultiply_table = vcl::bitmap::get_unpremultiply_table();
+#endif
unsigned char *data = cairo_image_surface_get_data(target);
sal_uInt8 a = data[SVP_CAIRO_ALPHA];
+#ifdef ENABLE_WASM_STRIP_PREMULTIPLY
+ sal_uInt8 b = vcl::bitmap::unpremultiply(a, data[SVP_CAIRO_BLUE]);
+ sal_uInt8 g = vcl::bitmap::unpremultiply(a, data[SVP_CAIRO_GREEN]);
+ sal_uInt8 r = vcl::bitmap::unpremultiply(a, data[SVP_CAIRO_RED]);
+#else
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]];
+#endif
Color aColor(ColorAlpha, a, r, g, b);
cairo_surface_destroy(target);
@@ -2596,9 +2612,11 @@ void SvpSalGraphics::releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, cons
if (nUnscaledExtentsBottom > target_surface_height)
nUnscaledExtentsBottom = target_surface_height;
+#ifndef ENABLE_WASM_STRIP_PREMULTIPLY
vcl::bitmap::lookup_table const & unpremultiply_table
= vcl::bitmap::get_unpremultiply_table();
vcl::bitmap::lookup_table const & premultiply_table = vcl::bitmap::get_premultiply_table();
+#endif
for (sal_Int32 y = nUnscaledExtentsTop; y < nUnscaledExtentsBottom; ++y)
{
unsigned char *true_row = target_surface_data + (nStride*y);
@@ -2609,6 +2627,17 @@ void SvpSalGraphics::releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, cons
{
sal_uInt8 a = true_data[SVP_CAIRO_ALPHA];
sal_uInt8 xor_a = xor_data[SVP_CAIRO_ALPHA];
+#ifdef ENABLE_WASM_STRIP_PREMULTIPLY
+ sal_uInt8 b = vcl::bitmap::unpremultiply(a, true_data[SVP_CAIRO_BLUE]) ^
+ vcl::bitmap::unpremultiply(xor_a, xor_data[SVP_CAIRO_BLUE]);
+ sal_uInt8 g = vcl::bitmap::unpremultiply(a, true_data[SVP_CAIRO_GREEN]) ^
+ vcl::bitmap::unpremultiply(xor_a, xor_data[SVP_CAIRO_GREEN]);
+ sal_uInt8 r = vcl::bitmap::unpremultiply(a, true_data[SVP_CAIRO_RED]) ^
+ vcl::bitmap::unpremultiply(xor_a, xor_data[SVP_CAIRO_RED]);
+ true_data[SVP_CAIRO_BLUE] = vcl::bitmap::premultiply(a, b);
+ true_data[SVP_CAIRO_GREEN] = vcl::bitmap::premultiply(a, g);
+ true_data[SVP_CAIRO_RED] = vcl::bitmap::premultiply(a, r);
+#else
sal_uInt8 b = unpremultiply_table[a][true_data[SVP_CAIRO_BLUE]] ^
unpremultiply_table[xor_a][xor_data[SVP_CAIRO_BLUE]];
sal_uInt8 g = unpremultiply_table[a][true_data[SVP_CAIRO_GREEN]] ^
@@ -2618,6 +2647,7 @@ void SvpSalGraphics::releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, cons
true_data[SVP_CAIRO_BLUE] = premultiply_table[a][b];
true_data[SVP_CAIRO_GREEN] = premultiply_table[a][g];
true_data[SVP_CAIRO_RED] = premultiply_table[a][r];
+#endif
true_data+=4;
xor_data+=4;
}