[Libreoffice-commits] core.git: Branch 'feature/nativealpha' - 1965 commits - accessibility/inc accessibility/source android/source animations/source avmedia/source basctl/source basegfx/CppunitTest_basegfx.mk basegfx/source basic/inc basic/qa basic/source binaryurp/source bin/bffvalidator.sh.in bin/find-most-common-warn-messages.py bin/gbuild-to-ide bin/odfvalidator.sh.in bin/unpack-sources bin/update_pch_autotune.sh bin/upload_symbols.py bridges/Library_cpp_uno.mk bridges/source canvas/source chart2/CppunitTest_chart2_common_functors.mk chart2/CppunitTest_chart2_export.mk chart2/CppunitTest_chart2_import.mk chart2/CppunitTest_chart2_trendcalculators.mk chart2/CppunitTest_chart2_xshape.mk chart2/Library_chartcontroller.mk chart2/Library_chartcore.mk chart2/qa chart2/source chart2/uiconfig cli_ure/Executable_climaker.mk cli_ure/Library_cli_cppuhelper_native.mk cli_ure/Library_cli_uno.mk codemaker/source comphelper/CppunitTest_comphelper_syntaxhighlight_test.mk comphelper/CppunitTest_comphelper_te st.mk comphelper/CppunitTest_comphelper_threadpool_test.mk comphelper/CppunitTest_comphelper_variadictemplates_test.mk comphelper/Module_comphelper.mk comphelper/qa comphelper/source comphelper/util compilerplugins/clang compilerplugins/Makefile-clang.mk config_host/config_features.h.in config_host.mk.in configmgr/qa configmgr/source configure.ac connectivity/CppunitTest_connectivity_ado.mk connectivity/CppunitTest_connectivity_mork.mk connectivity/qa connectivity/source connectivity/workben cppcanvas/CppunitTest_cppcanvas_emfplus.mk cppcanvas/CppunitTest_cppcanvas_test.mk cppcanvas/source cppuhelper/source cppu/source cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk dbaccess/Library_dbu.mk dbaccess/source dbaccess/win32 desktop/CppunitTest_desktop_app.mk desktop/CppunitTest_desktop_lib.mk desktop/Executable_minidump_upload.mk desktop/inc desktop/Library_crashreport.mk desktop/Library_sofficeapp.mk desktop/Module_desktop.mk desktop/qa desktop/README.vars desktop/source desktop/unx desktop/win32 dictionaries distro-configs/Jenkins distro-configs/LibreOfficeLinux.conf distro-configs/LibreOfficeWin32.conf distro-configs/LibreOfficeWin64.conf download.lst drawinglayer/CppunitTest_drawinglayer_border.mk drawinglayer/source dtrans/source editeng/CppunitTest_editeng_borderline.mk editeng/CppunitTest_editeng_core.mk editeng/CppunitTest_editeng_lookuptree.mk editeng/qa editeng/source embeddedobj/source extensions/CppunitTest_extensions_test_update.mk extensions/Module_extensions.mk extensions/source external/breakpad external/coinmp external/curl external/expat external/icu external/jpeg-turbo external/lcms2 external/libcmis external/libexttextcat external/libmwaw external/libxmlsec external/libzmf external/lpsolve external/mdds external/Module_external.mk external/more_fonts external/nss external/python3 external/python33 extras/Module_extras.mk extras/Package_palettes.mk extras/Package_tpllayoutimpr.mk extras/Package_tplpresnt.mk extras/source filter/Co nfiguration_filter.mk filter/CppunitTest_filter_dxf_test.mk filter/CppunitTest_filter_eps_test.mk filter/CppunitTest_filter_met_test.mk filter/CppunitTest_filter_pcd_test.mk filter/CppunitTest_filter_pcx_test.mk filter/CppunitTest_filter_pict_test.mk filter/CppunitTest_filter_ppm_test.mk filter/CppunitTest_filter_psd_test.mk filter/CppunitTest_filter_ras_test.mk filter/CppunitTest_filter_tga_test.mk filter/CppunitTest_filter_tiff_test.mk filter/Library_icg.mk filter/source filter/uiconfig forms/source formula/source formula/uiconfig fpicker/source fpicker/uiconfig framework/inc framework/Library_fwe.mk framework/Library_fwl.mk framework/source .gitignore helpcompiler/inc helpcontent2 hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk hwpfilter/source i18nlangtag/CppunitTest_i18nlangtag_test_languagetag.mk i18nlangtag/source i18npool/CppunitTest_i18npool_test_breakiterator.mk i18npool/CppunitTest_i18npool_test_characterclassification.mk i18npool/CppunitTest_i18npool_test_ordinalsuffix .mk i18npool/CppunitTest_i18npool_test_textsearch.mk i18npool/inc i18npool/qa i18npool/source icon-themes/breeze icon-themes/galaxy icon-themes/sifr icon-themes/tango idlc/inc idlc/source idl/inc idl/source include/basegfx include/basic include/canvas include/com include/comphelper include/connectivity include/cppuhelper include/dbaccess include/desktop include/drawinglayer include/editeng include/filter include/formula include/framework include/LibreOfficeKit include/o3tl include/onlineupdate include/oox include/opencl include/package include/registry include/rsc include/rtl include/sal include/salhelper include/sax include/sfx2 include/sot include/svl include/svtools include/svx include/test include/toolkit include/tools include/ucbhelper include/unotools include/vbahelper include/vcl include/xmloff io/source jurt/com jvmfwk/inc jvmfwk/plugins jvmfwk/source l10ntools/inc l10ntools/source librelogo/source libreofficekit/Package_selectionhandles.mk libreofficekit/qa libreofficekit/s ource lingucomponent/source linguistic/source linguistic/workben lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk lotuswordpro/source Makefile.fetch Makefile.in mysqlc/source odk/examples offapi/com offapi/UnoApi_offapi.mk officecfg/Configuration_officecfg.mk officecfg/files.mk officecfg/registry onlineupdate/Executable_mar.mk onlineupdate/Executable_updater.mk onlineupdate/Module_onlineupdate.mk onlineupdate/source onlineupdate/StaticLibrary_libmar.mk oox/CppunitTest_oox_tokenmap.mk oox/CppunitTest_oox_vba_compression.mk oox/CppunitTest_oox_vba_encryption.mk oox/source opencl/inc opencl/Library_opencl.mk opencl/source package/CppunitTest_package2_test.mk package/inc package/source postprocess/CppunitTest_services.mk postprocess/CustomTarget_registry.mk pyuno/Library_pythonloader.mk pyuno/source qadevOOo/objdsc qadevOOo/runner qadevOOo/tests readlicense_oo/license reportdesign/source RepositoryExternal.mk Repository.mk RepositoryModule_host.mk rsc/inc rsc/source sal/cpprt sal/cppunittester sal/inc sal/osl sal/qa sal/rtl sax/CppunitTest_sax.mk sax/CppunitTest_sax_parser.mk sax/CppunitTest_sax_xmlimport.mk sax/Library_expwrap.mk sax/qa sax/source scaddins/source sccomp/CppunitTest_sccomp_lpsolver.mk sc/CppunitTest_sc_annotationobj.mk sc/CppunitTest_sc_annotationshapeobj.mk sc/CppunitTest_sc_annotationsobj.mk sc/CppunitTest_sc_bugfix_test.mk sc/CppunitTest_sc_cellrangeobj.mk sc/CppunitTest_sc_check_xcell_ranges_query.mk sc/CppunitTest_sc_condformats.mk sc/CppunitTest_sc_copypaste.mk sc/CppunitTest_sc_core.mk sc/CppunitTest_sc_databaserangeobj.mk sc/CppunitTest_sc_datapilotfieldobj.mk sc/CppunitTest_sc_datapilottableobj.mk sc/CppunitTest_sc_editfieldobj_cell.mk sc/CppunitTest_sc_editfieldobj_header.mk sc/CppunitTest_sc_filters_test.mk sc/CppunitTest_sc_html_export_test.mk sc/CppunitTest_sc_modelobj.mk sc/CppunitTest_sc_namedrangeobj.mk sc/CppunitTest_sc_namedrangesobj.mk sc/CppunitTest_sc_new_cond_format_api.mk sc/CppunitTest_sc_opencl_test.mk sc/Cppunit Test_sc_outlineobj.mk sc/CppunitTest_sc_perfobj.mk sc/CppunitTest_sc_recordchanges.mk sc/CppunitTest_sc_styleloaderobj.mk sc/CppunitTest_sc_subsequent_export_test.mk sc/CppunitTest_sc_subsequent_filters_test.mk sc/CppunitTest_sc_tablesheetobj.mk sc/CppunitTest_sc_tablesheetsobj.mk sc/CppunitTest_sc_tiledrendering.mk sc/CppunitTest_sc_ucalc.mk sc/inc sc/Library_sc.mk sc/Module_sc.mk scp2/inc scp2/source sc/Package_opencl.mk sc/qa scripting/source sc/sdi sc/source sc/uiconfig sd/CppunitTest_sd_export_ooxml1.mk sd/CppunitTest_sd_export_ooxml2.mk sd/CppunitTest_sd_export_tests.mk sd/CppunitTest_sd_filters_test.mk sd/CppunitTest_sd_html_export_tests.mk sd/CppunitTest_sd_import_tests.mk sd/CppunitTest_sd_misc_tests.mk sd/CppunitTest_sd_svg_export_tests.mk sd/CppunitTest_sd_tiledrendering.mk sd/CppunitTest_sd_uimpress.mk sdext/CppunitTest_sdext_pdfimport.mk sdext/source sd/inc sd/Library_sd.mk sd/Module_sd.mk sd/qa sd/sdi sd/source sd/uiconfig sd/UIConfig_simpress.mk sd/xml setup_native/sc ripts setup_native/source sfx2/classification sfx2/inc sfx2/Library_sfx.mk sfx2/Package_classification.mk sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk shell/inc shell/source slideshow/CppunitTest_slideshow.mk slideshow/source slideshow/test smoketest/CppunitTest_smoketest.mk solenv/bin solenv/doc solenv/gbuild solenv/gdb soltools/mkdepend sot/CppunitTest_sot_test_sot.mk sot/source starmath/CppunitTest_starmath_import.mk starmath/CppunitTest_starmath_qa_cppunit.mk starmath/inc starmath/Library_sm.mk starmath/qa starmath/source stoc/source svgio/CppunitTest_svgio.mk svgio/qa svgio/source svl/CppunitTest_svl_itempool.mk svl/CppunitTest_svl_items.mk svl/CppunitTest_svl_notify.mk svl/CppunitTest_svl_qa_cppunit.mk svl/CppunitTest_svl_urihelper.mk svl/qa svl/source svtools/CppunitTest_svtools_graphic.mk svtools/CppunitTest_svtools_html.mk svtools/inc svtools/Library_svt.mk svtools/qa svtools/source svtools/uiconfig svx/AllLangResTarget_svx.mk svx/CppunitTest_svx_unit.mk svx/inc svx/Libra ry_svxcore.mk svx/Library_svx.mk svx/qa svx/README svx/sdi svx/source svx/uiconfig svx/UIConfig_svx.mk sw/CppunitTest_sw_docbookexport.mk sw/CppunitTest_sw_filters_test.mk sw/CppunitTest_sw_globalfilter.mk sw/CppunitTest_sw_htmlexport.mk sw/CppunitTest_sw_mailmerge.mk sw/CppunitTest_sw_odfexport.mk sw/CppunitTest_sw_odfimport.mk sw/CppunitTest_sw_ooxmlfieldexport.mk sw/CppunitTest_sw_ooxmlimport.mk sw/CppunitTest_sw_ooxmlw14export.mk sw/CppunitTest_sw_rtfexport.mk sw/CppunitTest_sw_rtfimport.mk sw/CppunitTest_sw_tiledrendering.mk sw/CppunitTest_sw_uiwriter.mk sw/CppunitTest_sw_uwriter.mk sw/CppunitTest_sw_ww8export.mk sw/CppunitTest_sw_ww8import.mk sw/inc sw/Library_sw.mk sw/ooxmlexport_setup.mk sw/qa sw/sdi sw/source sw/uiconfig sw/UIConfig_swriter.mk sysui/desktop test/source testtools/source toolkit/source tools/CppunitTest_tools_test.mk tools/inc tools/Library_tl.mk tools/qa tools/source translations ucb/CppunitTest_ucb_webdav_local_neon.mk ucbhelper/source ucb/source uitest/cal c_tests uitest/demo_ui uitest/impress_tests uitest/__init__.py uitest/libreoffice uitest/Makefile uitest/math_tests uitest/Module_uitest.mk uitest/README uitest/test_main.py uitest/uitest uitest/UITest_calc_demo.mk uitest/UITest_demo_ui.mk uitest/UITest_impress_demo.mk uitest/UITest_math_demo.mk uitest/UITest_writer_demo.mk uitest/writer_tests UnoControls/source unoidl/source unotools/CppunitTest_unotools_fontdefs.mk unotools/Library_utl.mk unotools/source unoxml/CppunitTest_unoxml_domtest.mk unoxml/source uui/source uui/uiconfig vbahelper/source vcl/CppunitTest_vcl_bitmap_test.mk vcl/CppunitTest_vcl_blocklistparser_test.mk vcl/CppunitTest_vcl_complextext.mk vcl/CppunitTest_vcl_filters_test.mk vcl/CppunitTest_vcl_fontcharmap.mk vcl/CppunitTest_vcl_fontmetric.mk vcl/CppunitTest_vcl_font.mk vcl/CppunitTest_vcl_lifecycle.mk vcl/CppunitTest_vcl_mapmode.mk vcl/CppunitTest_vcl_outdev.mk vcl/CppunitTest_vcl_png_test.mk vcl/CppunitTest_vcl_timer.mk vcl/CppunitTest_vcl_wmf_test.mk vcl/headle ss vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/Module_vcl.mk vcl/opengl vcl/osx vcl/qa vcl/quartz vcl/source vcl/unx vcl/vcl.unx.component vcl/vcl.windows.component vcl/win vcl/workben wizards/com writerfilter/CppunitTest_writerfilter_misc.mk writerfilter/CppunitTest_writerfilter_rtftok.mk writerfilter/source writerperfect/CppunitTest_writerperfect_calc.mk writerperfect/CppunitTest_writerperfect_draw.mk writerperfect/CppunitTest_writerperfect_impress.mk writerperfect/CppunitTest_writerperfect_stream.mk writerperfect/CppunitTest_writerperfect_writer.mk writerperfect/inc writerperfect/Library_wpftdraw.mk writerperfect/qa writerperfect/source xmlhelp/source xmloff/CppunitTest_xmloff_uxmloff.mk xmloff/inc xmloff/source xmlscript/source xmlsecurity/CppunitTest_qa_certext.mk xmlsecurity/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Sun Jul 24 15:02:49 UTC 2016
Rebased ref, commits from common ancestor:
commit 78ccd3bf3a4dc051bb91a7c4f5646292109202bb
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jul 24 22:14:27 2016 +0900
vcl: use same bitdepth when performing super scaling
Change-Id: I379c4aa9aa83470961fa972eec8cdb67261f749c
diff --git a/vcl/source/bitmap/bitmapscalesuper.cxx b/vcl/source/bitmap/bitmapscalesuper.cxx
index ff01aae..ddb3a85 100644
--- a/vcl/source/bitmap/bitmapscalesuper.cxx
+++ b/vcl/source/bitmap/bitmapscalesuper.cxx
@@ -937,7 +937,7 @@ bool BitmapScaleSuper::filter(Bitmap& rBitmap)
Bitmap::ScopedReadAccess pReadAccess(rBitmap);
- Bitmap aOutBmp(Size(nDstW, nDstH), 24);
+ Bitmap aOutBmp(Size(nDstW, nDstH), rBitmap.GetBitCount());
Bitmap::ScopedWriteAccess pWriteAccess(aOutBmp);
const long nStartY = 0;
commit bfff0e691326dcf78e6505149ea1c9b06e0a1913
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Tue Jun 28 16:39:57 2016 +0800
BitmapProcessor: support 32-bit bitmap in createLightImage
Change-Id: If28c715f9737f34b9d71c1342cae88fcc69231dd
diff --git a/vcl/source/bitmap/BitmapProcessor.cxx b/vcl/source/bitmap/BitmapProcessor.cxx
index 1a89da5..e64fd2a 100644
--- a/vcl/source/bitmap/BitmapProcessor.cxx
+++ b/vcl/source/bitmap/BitmapProcessor.cxx
@@ -17,7 +17,9 @@ BitmapEx BitmapProcessor::createLightImage(const BitmapEx& rBitmapEx)
const Size aSize(rBitmapEx.GetSizePixel());
Bitmap aBitmap(rBitmapEx.GetBitmap());
- Bitmap aDarkBitmap(aSize, 24);
+ int nBitcount = aBitmap.GetBitCount() == 32 ? 32 : 24;
+
+ Bitmap aDarkBitmap(aSize, nBitcount);
BitmapReadAccess* pRead(aBitmap.AcquireReadAccess());
BitmapWriteAccess* pWrite(aDarkBitmap.AcquireWriteAccess());
commit 442b8c04b4e213ac6224ea8a34c7cfd0db44f9fd
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 26 11:31:07 2016 +0800
vcl: Test for PngReader - reading of various PNG formats
Change-Id: I2469751806e03c791c1882a32c31c090d7dac39f
diff --git a/vcl/CppunitTest_vcl_png_test.mk b/vcl/CppunitTest_vcl_png_test.mk
new file mode 100644
index 0000000..1f88209
--- /dev/null
+++ b/vcl/CppunitTest_vcl_png_test.mk
@@ -0,0 +1,52 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,vcl_png_test))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,vcl_png_test, \
+ vcl/qa/cppunit/png/PngFilterTest \
+))
+
+$(eval $(call gb_CppunitTest_set_include,vcl_png_test,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/vcl/inc \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,vcl_png_test, \
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ svt \
+ test \
+ tl \
+ unotest \
+ vcl \
+ utl \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,vcl_png_test,\
+ udkapi \
+ offapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,vcl_png_test))
+$(eval $(call gb_CppunitTest_use_vcl,vcl_png_test))
+
+$(eval $(call gb_CppunitTest_use_components,vcl_png_test,\
+ configmgr/source/configmgr \
+ i18npool/util/i18npool \
+ ucb/source/core/ucb1 \
+ unotools/util/utl \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,vcl_png_test))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 03c884c..a5c3f0f 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -107,6 +107,7 @@ $(eval $(call gb_Module_add_check_targets,vcl,\
CppunitTest_vcl_outdev \
CppunitTest_vcl_app_test \
CppunitTest_vcl_wmf_test \
+ CppunitTest_vcl_png_test \
))
diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx b/vcl/qa/cppunit/png/PngFilterTest.cxx
new file mode 100644
index 0000000..14e32a6
--- /dev/null
+++ b/vcl/qa/cppunit/png/PngFilterTest.cxx
@@ -0,0 +1,136 @@
+/* -*- 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 <test/bootstrapfixture.hxx>
+#include <vcl/filter/PngReader.hxx>
+#include <vcl/bitmapaccess.hxx>
+
+using namespace css;
+
+class PngFilterTest : public test::BootstrapFixture
+{
+ OUString maDataUrl;
+
+ OUString getFullUrl(const OUString& sFileName)
+ {
+ return m_directories.getURLFromSrc(maDataUrl) + sFileName;
+ }
+
+public:
+ PngFilterTest() :
+ BootstrapFixture(true, false),
+ maDataUrl("/vcl/qa/cppunit/png/data/")
+ {}
+
+ void testPng();
+
+ CPPUNIT_TEST_SUITE(PngFilterTest);
+ CPPUNIT_TEST(testPng);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void PngFilterTest::testPng()
+{
+ for (const OUString& aFileName: { OUString("rect-1bit-pal.png") })
+ {
+ SvFileStream aFileStream(getFullUrl(aFileName), StreamMode::READ);
+
+ Graphic aGraphic;
+ vcl::PngReader aPngReader(aFileStream);
+ aPngReader.Read(aGraphic);
+
+ Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap();
+ {
+ Bitmap::ScopedReadAccess pAccess(aBitmap);
+ CPPUNIT_ASSERT_EQUAL(32, int(pAccess->GetBitCount()));
+ CPPUNIT_ASSERT_EQUAL(4l, pAccess->Width());
+ CPPUNIT_ASSERT_EQUAL(4l, pAccess->Height());
+
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(0,0)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(3,3)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(3,0)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(0,3)).GetColor());
+
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00000000), Color(pAccess->GetPixel(1,1)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00000000), Color(pAccess->GetPixel(1,2)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00000000), Color(pAccess->GetPixel(2,1)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00000000), Color(pAccess->GetPixel(2,2)).GetColor());
+ }
+ }
+ for (const OUString& aFileName: { OUString("color-rect-8bit-RGB.png"), OUString("color-rect-4bit-pal.png") })
+ {
+ SvFileStream aFileStream(getFullUrl(aFileName), StreamMode::READ);
+
+ Graphic aGraphic;
+ vcl::PngReader aPngReader(aFileStream);
+ aPngReader.Read(aGraphic);
+
+ Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap();
+ {
+ Bitmap::ScopedReadAccess pAccess(aBitmap);
+ CPPUNIT_ASSERT_EQUAL(32, int(pAccess->GetBitCount()));
+ CPPUNIT_ASSERT_EQUAL(4l, pAccess->Width());
+ CPPUNIT_ASSERT_EQUAL(4l, pAccess->Height());
+
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(0,0)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(3,3)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(3,0)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(0,3)).GetColor());
+
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00FF0000), Color(pAccess->GetPixel(1,1)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x0000FF00), Color(pAccess->GetPixel(1,2)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x000000FF), Color(pAccess->GetPixel(2,1)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFF00), Color(pAccess->GetPixel(2,2)).GetColor());
+ }
+ }
+ for (const OUString& aFileName: { OUString("alpha-rect-8bit-RGBA.png") })
+ {
+ SvFileStream aFileStream(getFullUrl(aFileName), StreamMode::READ);
+
+ Graphic aGraphic;
+ vcl::PngReader aPngReader(aFileStream);
+ aPngReader.Read(aGraphic);
+
+ Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap();
+ {
+ Bitmap::ScopedReadAccess pAccess(aBitmap);
+ CPPUNIT_ASSERT_EQUAL(32, int(pAccess->GetBitCount()));
+ CPPUNIT_ASSERT_EQUAL(4l, pAccess->Width());
+ CPPUNIT_ASSERT_EQUAL(4l, pAccess->Height());
+
+ printf("%08X\n", Color(pAccess->GetPixel(1,1)).GetColor());
+
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x80FFFFFF), Color(pAccess->GetPixel(0,0)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x80FFFFFF), Color(pAccess->GetPixel(3,3)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x80FFFFFF), Color(pAccess->GetPixel(3,0)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x80FFFFFF), Color(pAccess->GetPixel(0,3)).GetColor());
+
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x40FF0000), Color(pAccess->GetPixel(1,1)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0xC000FF00), Color(pAccess->GetPixel(1,2)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0xC00000FF), Color(pAccess->GetPixel(2,1)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x40FFFF00), Color(pAccess->GetPixel(2,2)).GetColor());
+ }
+ }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PngFilterTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qa/cppunit/png/data/alpha-rect-8bit-RGBA.png b/vcl/qa/cppunit/png/data/alpha-rect-8bit-RGBA.png
new file mode 100644
index 0000000..1e90e1a
Binary files /dev/null and b/vcl/qa/cppunit/png/data/alpha-rect-8bit-RGBA.png differ
diff --git a/vcl/qa/cppunit/png/data/color-rect-4bit-pal.png b/vcl/qa/cppunit/png/data/color-rect-4bit-pal.png
new file mode 100644
index 0000000..740eede
Binary files /dev/null and b/vcl/qa/cppunit/png/data/color-rect-4bit-pal.png differ
diff --git a/vcl/qa/cppunit/png/data/color-rect-8bit-RGB.png b/vcl/qa/cppunit/png/data/color-rect-8bit-RGB.png
new file mode 100644
index 0000000..727859d
Binary files /dev/null and b/vcl/qa/cppunit/png/data/color-rect-8bit-RGB.png differ
diff --git a/vcl/qa/cppunit/png/data/rect-1bit-pal.png b/vcl/qa/cppunit/png/data/rect-1bit-pal.png
new file mode 100644
index 0000000..cf7ac3e
Binary files /dev/null and b/vcl/qa/cppunit/png/data/rect-1bit-pal.png differ
commit 9fd7eb03aa6a3004a911bba17627d8c339cd0bc1
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 26 11:25:01 2016 +0800
vcl: Support converting to 32-bit bitmap
Change-Id: Ic1c252fcc23ba6b8581c89f17f7fd62eb501e888
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 46fa6c5..a03a50c 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1072,6 +1072,11 @@ void Bitmap::ImplAdaptBitCount(Bitmap& rNew) const
rNew.Convert(BMP_CONVERSION_24BIT);
break;
}
+ case 32:
+ {
+ rNew.Convert(BMP_CONVERSION_32BIT);
+ break;
+ }
default:
{
OSL_ENSURE(false, "BitDepth adaption failed (!)");
commit 6219932841dcdfbebc7f1ed525d479c5ee255f02
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 26 11:21:15 2016 +0800
svx: add support for 32-bit bitmaps to toolbar color icon
A color icon (like background or font color) has an additional
rectangle which shows the current selected color as a colored
rectangle. Because it didn't support 32-bit colors correctly, the
background of the icon was always white. This fixes this issue.
Change-Id: I045e03f45937ba9394ba2590bc3d2228a4cd9cfe
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index c773a1c..8082b5c 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -96,12 +96,23 @@ namespace svx
if ((maCurColor != aColor) || (aColor == COL_BLACK) ||
bSizeChanged || bDisplayModeChanged || bForceUpdate )
{
+ BitmapEx aSource(aImage.GetBitmapEx());
+ BitmapEx aBmpEx;
+
// create an empty bitmap, and copy the original bitmap inside
// (so that it grows in case the original bitmap was smaller)
sal_uInt8 nAlpha = 255;
- BitmapEx aBmpEx(Bitmap(aItemSize, 24), AlphaMask(aItemSize, &nAlpha));
- BitmapEx aSource(aImage.GetBitmapEx());
+ if (aSource.GetBitmap().GetBitCount() == 32)
+ {
+ aBmpEx = BitmapEx(Bitmap(aItemSize, 32));
+
+ }
+ else
+ {
+ aBmpEx = BitmapEx(Bitmap(aItemSize, 24), AlphaMask(aItemSize, &nAlpha));
+ }
+
long nWidth = std::min(aItemSize.Width(), aSource.GetSizePixel().Width());
long nHeight = std::min(aItemSize.Height(), aSource.GetSizePixel().Height());
commit 7e5b28ed934e0efc40bff24173ed90c0246e8587
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 26 11:18:50 2016 +0800
Use the libpng based PngReader for reading "Image" resources
This adds support for reading "Image" resources (maily icons for
menus, toolbars,..).
Change-Id: I50200b70bb2d73dd23524138ab7c853d4884d18c
diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx
index 1f7f1ec..6c53ffd 100644
--- a/vcl/source/image/ImplImageTree.cxx
+++ b/vcl/source/image/ImplImageTree.cxx
@@ -45,6 +45,8 @@
#include <vcl/svapp.hxx>
#include <vcldemo-debug.hxx>
+#include <vcl/filter/PngReader.hxx>
+
#include <vcl/BitmapProcessor.hxx>
#include <vcl/BitmapTools.hxx>
@@ -82,9 +84,8 @@ void loadImageFromStream(std::shared_ptr<SvStream> const & xStream, OUString con
{
if (rPath.endsWith(".png"))
{
- vcl::PNGReader aPNGReader(*xStream);
- aPNGReader.SetIgnoreGammaChunk( true );
- rBitmap = aPNGReader.Read();
+ vcl::PngReader aPNGReader(*xStream);
+ aPNGReader.Read(rBitmap);
}
else if (rPath.endsWith(".svg"))
{
commit 3378a6808b44ade99c11e34975c88a14c6d8a6da
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 26 11:13:13 2016 +0800
vcl: PngReader which uses libpng for PNG decoding
We already need libpng for some of the dependencies and in LO
itself (splash). However in vcl we have our own implementation
for reading and writing PNG images. This adds a PNG reader that
uses libpng and always decodes to a 32-bit RGBA bitmap, however
it doesn't replace the existing PNGReader - yet.
Change-Id: I95663886ea599603bb3d18826b0a640596ce3724
diff --git a/include/vcl/filter/PngReader.hxx b/include/vcl/filter/PngReader.hxx
new file mode 100644
index 0000000..957539c
--- /dev/null
+++ b/include/vcl/filter/PngReader.hxx
@@ -0,0 +1,40 @@
+/* -*- 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/.
+ *
+ */
+
+#include <vcl/graph.hxx>
+#include <vcl/dllapi.h>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+
+#ifndef INCLUDED_VCL_SOURCE_FILTER_PNG_PNGREADER_HXX
+#define INCLUDED_VCL_SOURCE_FILTER_PNG_PNGREADER_HXX
+
+namespace vcl
+{
+
+class VCL_DLLPUBLIC PngReader
+{
+ SvStream& mrStream;
+ css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator;
+
+public:
+ PngReader(SvStream& rStream);
+
+ virtual ~PngReader()
+ {}
+
+ bool Read(BitmapEx& rBitmap);
+ bool Read(Graphic& rGraphic);
+};
+
+} // namespace vcl
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 0b26fdf..52d0cd9 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -121,6 +121,7 @@ $(eval $(call gb_Library_use_externals,vcl,\
icuuc \
lcms2 \
mdds_headers \
+ png \
))
ifneq ($(ENABLE_OPENGL)$(if $(filter ANDROID,$(OS)),TRUE),)
$(eval $(call gb_Library_use_externals,vcl,\
@@ -373,6 +374,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/filter/jpeg/JpegReader \
vcl/source/filter/jpeg/JpegWriter \
vcl/source/filter/jpeg/JpegTransform \
+ vcl/source/filter/png/PngReader \
vcl/source/filter/wmf/emfwr \
vcl/source/filter/wmf/enhwmf \
vcl/source/filter/wmf/winmtf \
diff --git a/vcl/source/filter/png/PngReader.cxx b/vcl/source/filter/png/PngReader.cxx
new file mode 100644
index 0000000..6470aa1
--- /dev/null
+++ b/vcl/source/filter/png/PngReader.cxx
@@ -0,0 +1,180 @@
+/* -*- 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/.
+ *
+ */
+
+#include <vcl/filter/PngReader.hxx>
+
+#include <png.h>
+
+#include <vcl/bitmapaccess.hxx>
+
+namespace
+{
+
+void lclReadStream(png_structp pPng, png_bytep pOutBytes, png_size_t nBytesToRead)
+{
+ png_voidp pIO = png_get_io_ptr(pPng);
+
+ if (pIO == nullptr)
+ return;
+
+ SvStream* pStream = reinterpret_cast<SvStream*>(pIO);
+
+ sal_Size nBytesRead = pStream->ReadBytes(pOutBytes, nBytesToRead);
+
+ if (nBytesRead != nBytesToRead)
+ png_error(pPng, "Error reading");
+}
+
+bool reader(SvStream& rStream, Bitmap& rBitmap)
+{
+ enum { PNG_SIGNATURE_SIZE = 8 };
+
+ sal_uInt8 aHeader[PNG_SIGNATURE_SIZE];
+ rStream.ReadBytes(aHeader, PNG_SIGNATURE_SIZE);
+
+ if (png_sig_cmp(aHeader, 0, PNG_SIGNATURE_SIZE))
+ return false;
+
+ png_structp pPng = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
+ if (!pPng)
+ return false;
+
+ png_infop pInfo = png_create_info_struct(pPng);
+ if (!pInfo)
+ {
+ png_destroy_read_struct(&pPng, nullptr, nullptr);
+ return false;
+ }
+
+ if (setjmp(png_jmpbuf(pPng)))
+ {
+ png_destroy_read_struct(&pPng, &pInfo, nullptr);
+ return false;
+ }
+
+ png_set_read_fn(pPng, &rStream, lclReadStream);
+
+ png_set_crc_action(pPng, PNG_CRC_WARN_USE, PNG_CRC_WARN_DISCARD);
+
+ png_set_sig_bytes(pPng, PNG_SIGNATURE_SIZE);
+
+ png_read_info(pPng, pInfo);
+
+ png_uint_32 width = 0;
+ png_uint_32 height = 0;
+ int bitDepth = 0;
+ int colorType = -1;
+ int interlace = -1;
+
+ png_uint_32 returnValue = png_get_IHDR(pPng, pInfo, &width, &height, &bitDepth, &colorType, &interlace, nullptr, nullptr);
+
+ if (returnValue != 1)
+ {
+ png_destroy_read_struct(&pPng, &pInfo, nullptr);
+ return false;
+ }
+
+ Bitmap aBitmap(Size(width, height), 32);
+
+ png_set_bgr(pPng);
+
+ if (colorType == PNG_COLOR_TYPE_PALETTE)
+ png_set_palette_to_rgb(pPng);
+
+ if (colorType == PNG_COLOR_TYPE_GRAY)
+ png_set_expand_gray_1_2_4_to_8(pPng);
+
+ if (png_get_valid(pPng, pInfo, PNG_INFO_tRNS))
+ png_set_tRNS_to_alpha(pPng);
+
+
+ if (bitDepth == 16)
+ png_set_scale_16(pPng);
+
+ if (bitDepth < 8)
+ png_set_packing(pPng);
+
+ if (colorType == PNG_COLOR_TYPE_GRAY || colorType == PNG_COLOR_TYPE_GRAY_ALPHA)
+ {
+ png_set_gray_to_rgb(pPng);
+ }
+
+ png_set_filler(pPng, 0xFF, PNG_FILLER_AFTER);
+
+ int nNumberOfPasses = png_set_interlace_handling(pPng);
+
+ png_read_update_info(pPng, pInfo);
+ returnValue = png_get_IHDR(pPng, pInfo, &width, &height, &bitDepth, &colorType, nullptr, nullptr, nullptr);
+
+ if (returnValue != 1)
+ {
+ png_destroy_read_struct(&pPng, &pInfo, nullptr);
+ return false;
+ }
+
+ if (bitDepth != 8 || !(colorType == PNG_COLOR_TYPE_RGB ||
+ colorType == PNG_COLOR_TYPE_RGB_ALPHA))
+ {
+ png_destroy_read_struct(&pPng, &pInfo, nullptr);
+ return false;
+ }
+
+ {
+ Bitmap::ScopedWriteAccess pWriteAccess(aBitmap);
+
+ for (int pass = 0; pass < nNumberOfPasses; pass++)
+ {
+ for (png_uint_32 y = 0; y < height; y++)
+ {
+ Scanline pScanline = pWriteAccess->GetScanline(y);
+ png_read_rows(pPng, &pScanline, nullptr, 1);
+ }
+ }
+ }
+
+ png_read_end(pPng, pInfo);
+
+ png_destroy_read_struct(&pPng, &pInfo, nullptr);
+
+ rBitmap = aBitmap;
+
+ return true;
+}
+
+} // anonymous namespace
+
+namespace vcl
+{
+
+PngReader::PngReader(SvStream& rStream)
+ : mrStream(rStream)
+{}
+
+bool PngReader::Read(BitmapEx& rBitmap)
+{
+ Bitmap aBitmap;
+ if (!reader(mrStream, aBitmap))
+ return false;
+ rBitmap = BitmapEx(aBitmap);
+ return true;
+}
+
+bool PngReader::Read(Graphic& rGraphic)
+{
+ Bitmap aBitmap;
+ if (!reader(mrStream, aBitmap))
+ return false;
+ rGraphic = Graphic(aBitmap);
+ return true;
+}
+
+} // namespace vcl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 5b73e3deaa094c6ab24c4483aa3c6baa506f7dfb
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 26 11:01:58 2016 +0800
BitmapProcessor: support creating a "disabled" RGBA bitmap
Change-Id: I782514808a767084f159b5956a0bda898f0eb48e
diff --git a/vcl/source/bitmap/BitmapProcessor.cxx b/vcl/source/bitmap/BitmapProcessor.cxx
index 91b46bc..1a89da5 100644
--- a/vcl/source/bitmap/BitmapProcessor.cxx
+++ b/vcl/source/bitmap/BitmapProcessor.cxx
@@ -77,7 +77,25 @@ BitmapEx BitmapProcessor::createDisabledImage(const BitmapEx& rBitmapEx)
BitmapEx aReturnBitmap;
- if (rBitmapEx.IsTransparent())
+ if (rBitmapEx.GetBitmap().GetBitCount() == 32)
+ {
+ if (pRead && pGrey && pGreyAlpha)
+ {
+ for (long nY = 0; nY < aSize.Height(); ++nY)
+ {
+ for (long nX = 0; nX < aSize.Width(); ++nX)
+ {
+ BitmapColor aColor = pRead->GetPixel(nY, nX);
+ const sal_uInt8 nLum(aColor.GetLuminance());
+ const sal_uInt8 nAlpha(std::min(aColor.GetAlpha() + 178ul, 255ul));
+ BitmapColor aGreyValue(nLum, nLum, nLum, nAlpha);
+ pGrey->SetPixel(nY, nX, aGreyValue);
+ }
+ }
+ }
+ aReturnBitmap = BitmapEx(aGrey);
+ }
+ else if (rBitmapEx.IsTransparent())
{
AlphaMask aBitmapAlpha(rBitmapEx.GetAlpha());
BitmapReadAccess* pReadAlpha(aBitmapAlpha.AcquireReadAccess());
commit 4aa4ac48753e2ec0bdc912af77f418293854632f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 26 10:53:12 2016 +0800
use DrawOutDev from dialcontrol, explicitly set background
When drawing the dialcontrol's VirtualDevices we can use the more
direct DrawOutDev instead of the DrawBitmapEx. This should avoid
creating a BitmapEx and draw directly.
In addition, explicitly set the initial background even if it will
be overdrawn or changed later.
Change-Id: I06f05ac18c556fc7918709b5d3e88e30ed4d50d6
diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx
index 7067ab7..abb6c72 100644
--- a/svx/source/dialog/dialcontrol.cxx
+++ b/svx/source/dialog/dialcontrol.cxx
@@ -56,7 +56,7 @@ void DialControlBmp::CopyBackground( const DialControlBmp& rSrc )
SetSize(rSrc.maRect.GetSize());
mbEnabled = rSrc.mbEnabled;
Point aPos;
- DrawBitmapEx( aPos, rSrc.GetBitmapEx( aPos, maRect.GetSize() ) );
+ DrawOutDev(aPos, maRect.GetSize(), aPos, maRect.GetSize(), rSrc);
}
void DialControlBmp::DrawBackground( const Size& rSize, bool bEnabled )
@@ -144,7 +144,7 @@ const Color& DialControlBmp::GetButtonFillColor( bool bMain ) const
void DialControlBmp::Init()
{
SetSettings(mrParent.GetSettings());
- SetBackground();
+ SetBackground(Wallpaper(COL_WHITE));
}
void DialControlBmp::SetSize( const Size& rSize )
@@ -276,7 +276,7 @@ void DialControl::Resize()
void DialControl::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
Point aPos;
- rRenderContext.DrawBitmapEx(aPos, mpImpl->mxBmpBuffered->GetBitmapEx(aPos, mpImpl->maWinSize));
+ rRenderContext.DrawOutDev(aPos, mpImpl->maWinSize, aPos, mpImpl->maWinSize, *mpImpl->mxBmpBuffered.get());
}
void DialControl::StateChanged( StateChangedType nStateChange )
commit bbe2c1f39047b47980c49340dab70b25bc998bd1
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 19 10:13:28 2016 +0800
svp: premultiply the buffer when drawing a 32-bit bitmap
Cairo uses premultiplied alpha for RGBA bitmap buffers. As our
bitmap buffer doesn't currently do this, we have to do it just
before we draw a bitmap.
Change-Id: I551ba6d589b7339b2e081452c2720b39e7278b68
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index d683580..921322f 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -85,6 +85,16 @@ namespace
aDamageRect.intersect(getClipBox(cr));
return aDamageRect;
}
+
+ static sal_uInt8 unpremultiply(sal_uInt8 c, sal_uInt8 a)
+ {
+ return (a > 0) ? (c * 255 + a / 2) / a : 0;
+ }
+
+ static sal_uInt8 premultiply(sal_uInt8 c, sal_uInt8 a)
+ {
+ return (c * a + 127) / 255;
+ }
}
#ifndef IOS
@@ -103,6 +113,28 @@ bool SvpSalGraphics::blendAlphaBitmap( const SalTwoRect&, const SalBitmap&, cons
namespace
{
+ void premultiplyBuffer(int width, int height, int stride, unsigned char* data)
+ {
+ for (int y = 0; y < height; ++y)
+ {
+ unsigned int* row = reinterpret_cast<unsigned int*>(data + y * stride);
+ for (int x = 0; x < width; ++x)
+ {
+ unsigned int px = row[x];
+ unsigned char a = (px & 0xff000000) >> 24;
+ unsigned char r = (px & 0x00ff0000) >> 16;
+ unsigned char g = (px & 0x0000ff00) >> 8;
+ unsigned char b = (px & 0x000000ff);
+
+ r = premultiply(r, a);
+ g = premultiply(g, a);
+ b = premultiply(b, a);
+
+ row[x] = (a << 24) | (r << 16) | (g << 8) | b;
+ }
+ }
+ }
+
class SourceHelper
{
public:
@@ -127,7 +159,25 @@ namespace
source = SvpSalGraphics::createCairoSurface(aTmpBmp.GetBuffer());
}
else
- source = SvpSalGraphics::createCairoSurface(rSrcBmp.GetBuffer());
+ {
+ const BitmapBuffer* pSrc = rSrcBmp.GetBuffer();
+ if (pSrc->mnColorChannelBitCount == 32)
+ {
+ aTmpBmp.Create(rSrcBmp);
+ source = SvpSalGraphics::createCairoSurface(aTmpBmp.GetBuffer());
+ cairo_surface_flush(source);
+ int w = cairo_image_surface_get_width(source);
+ int h = cairo_image_surface_get_height(source);
+ int stride = cairo_image_surface_get_stride(source);
+ unsigned char* data = cairo_image_surface_get_data(source);
+ premultiplyBuffer(w, h, stride, data);
+ cairo_surface_mark_dirty(source);
+ }
+ else
+ {
+ source = SvpSalGraphics::createCairoSurface(rSrcBmp.GetBuffer());
+ }
+ }
}
~SourceHelper()
{
@@ -1030,16 +1080,6 @@ void SvpSalGraphics::drawBitmap( const SalTwoRect& rTR,
drawAlphaBitmap(rTR, rSourceBitmap, rTransparentBitmap);
}
-static sal_uInt8 unpremultiply(sal_uInt8 c, sal_uInt8 a)
-{
- return (a > 0) ? (c * 255 + a / 2) / a : 0;
-}
-
-static sal_uInt8 premultiply(sal_uInt8 c, sal_uInt8 a)
-{
- return (c * a + 127) / 255;
-}
-
void SvpSalGraphics::drawMask( const SalTwoRect& rTR,
const SalBitmap& rSalBitmap,
SalColor nMaskColor )
commit 3c556517e4b6c3a1c77aa41fa2e97fd862796b98
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 12 16:55:33 2016 +0900
Support native alpha in outdev / virdev + support in headless
This adds support for native alpha surface (RGBA) to OutputDevice
and VirtualDevice. Mainly this removes restrictions that set the
alpha value to opaque (1.0f). All the functions still use a
separate "alpha" device for now.
As the headless backend already uses a 32-bit surface there was
not a big change necessary to make it work.
Change-Id: Ic2f2319a006764395d70b64c473749cd6d47f812
diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx
index b9eb6ae..37b1329 100644
--- a/include/vcl/salgtype.hxx
+++ b/include/vcl/salgtype.hxx
@@ -33,11 +33,14 @@ enum class DeviceFormat {
};
typedef sal_uInt32 SalColor;
-#define MAKE_SALCOLOR( r, g, b ) ((SalColor)(((sal_uInt32)((sal_uInt8)(b))))|(((sal_uInt32)((sal_uInt8)(g)))<<8)|(((sal_uInt32)((sal_uInt8)(r)))<<16))
+
+#define MAKE_SALCOLOR(r, g, b) MAKE_SALCOLOR_ALPHA(r, g, b, 0xFF)
+#define MAKE_SALCOLOR_ALPHA(r, g, b, a) ((SalColor)(((sal_uInt32)((sal_uInt8)(b))))|(((sal_uInt32)((sal_uInt8)(g)))<<8)|(((sal_uInt32)((sal_uInt8)(r)))<<16)|(((sal_uInt32)((sal_uInt8)(a)))<<24))
+#define SALCOLOR_ALPHA( n ) ((sal_uInt8)((n)>>24))
#define SALCOLOR_RED( n ) ((sal_uInt8)((n)>>16))
#define SALCOLOR_GREEN( n ) ((sal_uInt8)(((sal_uInt16)(n)) >> 8))
#define SALCOLOR_BLUE( n ) ((sal_uInt8)(n))
-#define SALCOLOR_NONE (~(SalColor)0)
+#define SALCOLOR_NONE ((SalColor)0)
// must equal to class Point
struct SalPoint
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 7482a68..d683580 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -890,7 +890,7 @@ void SvpSalGraphics::applyColor(cairo_t *cr, SalColor aColor)
cairo_set_source_rgba(cr, SALCOLOR_RED(aColor)/255.0,
SALCOLOR_GREEN(aColor)/255.0,
SALCOLOR_BLUE(aColor)/255.0,
- 1.0);
+ SALCOLOR_ALPHA(aColor)/255.0);
}
else
{
@@ -1105,7 +1105,7 @@ void SvpSalGraphics::drawMask( const SalTwoRect& rTR,
SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeight )
{
SvpSalBitmap* pBitmap = new SvpSalBitmap();
- pBitmap->Create(Size(nWidth, nHeight), 32, BitmapPalette());
+ pBitmap->Create(Size(nWidth, nHeight), 24, BitmapPalette());
cairo_surface_t* target = SvpSalGraphics::createCairoSurface(pBitmap->GetBuffer());
cairo_t* cr = cairo_create(target);
@@ -1129,10 +1129,12 @@ SalColor SvpSalGraphics::getPixel( long nX, long nY )
unsigned char *surface_data = cairo_image_surface_get_data(m_pSurface);
unsigned char *row = surface_data + (nStride*nY);
unsigned char *data = row + (nX * 4);
- sal_uInt8 b = unpremultiply(data[SVP_CAIRO_BLUE], data[SVP_CAIRO_ALPHA]);
- sal_uInt8 g = unpremultiply(data[SVP_CAIRO_GREEN], data[SVP_CAIRO_ALPHA]);
- sal_uInt8 r = unpremultiply(data[SVP_CAIRO_RED], data[SVP_CAIRO_ALPHA]);
- return MAKE_SALCOLOR(r, g, b);
+ sal_uInt8 alpha = data[SVP_CAIRO_ALPHA];
+ sal_uInt8 b = unpremultiply(data[SVP_CAIRO_BLUE], alpha);
+ sal_uInt8 g = unpremultiply(data[SVP_CAIRO_GREEN], alpha);
+ sal_uInt8 r = unpremultiply(data[SVP_CAIRO_RED], alpha);
+ SalColor aSalColor = MAKE_SALCOLOR_ALPHA(r, g, b, alpha);
+ return aSalColor;
}
namespace
diff --git a/vcl/inc/outdata.hxx b/vcl/inc/outdata.hxx
index f48f0f9..a92f739 100644
--- a/vcl/inc/outdata.hxx
+++ b/vcl/inc/outdata.hxx
@@ -23,9 +23,25 @@
#include <tools/color.hxx>
#include <vcl/salgtype.hxx>
+inline Color ImplSalToColor(SalColor aSalColor)
+{
+ Color aColor = Color(0xFF - SALCOLOR_ALPHA(aSalColor),
+ SALCOLOR_RED(aSalColor),
+ SALCOLOR_GREEN(aSalColor),
+ SALCOLOR_BLUE(aSalColor));
+ return aColor;
+}
+
inline SalColor ImplColorToSal( Color aColor )
{
- return MAKE_SALCOLOR( aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue() );
+ return MAKE_SALCOLOR(aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue());
+}
+
+inline SalColor ImplColorToSalWithAlpha(Color aColor)
+{
+ SalColor aSalColor = MAKE_SALCOLOR_ALPHA(aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue(),
+ 0xFF - aColor.GetTransparency());
+ return aSalColor;
}
inline bool ImplIsColorTransparent( Color aColor )
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 4a44770..26dc929 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -24,12 +24,36 @@ public:
VclOutdevTest() : BootstrapFixture(true, false) {}
void testVirtualDevice();
+ void testAlphaVirtualDevice();
CPPUNIT_TEST_SUITE(VclOutdevTest);
CPPUNIT_TEST(testVirtualDevice);
+ CPPUNIT_TEST(testAlphaVirtualDevice);
CPPUNIT_TEST_SUITE_END();
};
+void VclOutdevTest::testAlphaVirtualDevice()
+{
+ Size aSize(32,32);
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ pVDev->SetOutputSizePixel(aSize);
+ pVDev->DrawPixel(Point(1,1), Color(0x00, 0x11, 0x22, 0x33));
+ pVDev->DrawPixel(Point(2,2), Color(0x10, 0xEE, 0xEE, 0xEE));
+ pVDev->DrawPixel(Point(3,3), Color(0xEE, 0xEE, 0xEE, 0xEE));
+
+ CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0xFF, 0x00, 0x00, 0x00), pVDev->GetPixel(Point(0,0)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0x00, 0x11, 0x22, 0x33), pVDev->GetPixel(Point(1,1)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0x10, 0xEE, 0xEE, 0xEE), pVDev->GetPixel(Point(2,2)).GetColor());
+
+ Bitmap aBitmap = pVDev->GetBitmap(Point(), aSize);
+
+ Bitmap::ScopedReadAccess pReadAccess(aBitmap);
+ CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0xFF, 0x00, 0x00, 0x00), Color(pReadAccess->GetPixel(0, 0)).GetColor());
+ CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0x00, 0x11, 0x22, 0x33), Color(pReadAccess->GetPixel(1, 1)).GetColor());
+ //CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0xEE, 0xEE, 0xEE, 0xEE), Color(pReadAccess->GetPixel(3, 3)).GetColor());
+ //CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0x10, 0xEE, 0xEE, 0xEE), Color(pReadAccess->GetPixel(2, 2)).GetColor());
+}
+
void VclOutdevTest::testVirtualDevice()
{
ScopedVclPtrInstance< VirtualDevice > pVDev;
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 3dac7a8..b75fd93 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -191,11 +191,11 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
}
// virtual devices have white background by default
- SetBackground( Wallpaper( Color( COL_WHITE ) ) );
+ SetBackground( Wallpaper( Color( COL_TRANSPARENT ) ) );
// #i59283# don't erase user-provided surface
if( !pData && bErase)
- Erase();
+ //Erase();
// register VirDev in the list
mpNext = pSVData->maGDIData.mpFirstVirDev;
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index 698c3a4..e11d07a 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -367,23 +367,11 @@ void OutputDevice::SetFillColor( const Color& rColor )
if ( mpMetaFile )
mpMetaFile->AddAction( new MetaFillColorAction( aColor, true ) );
- if ( ImplIsColorTransparent( aColor ) )
+ if ( maFillColor != aColor )
{
- if ( mbFillColor )
- {
- mbInitFillColor = true;
- mbFillColor = false;
- maFillColor = Color( COL_TRANSPARENT );
- }
- }
- else
- {
- if ( maFillColor != aColor )
- {
- mbInitFillColor = true;
- mbFillColor = true;
- maFillColor = aColor;
- }
+ mbInitFillColor = true;
+ mbFillColor = true;
+ maFillColor = aColor;
}
if( mpAlphaVDev )
@@ -415,23 +403,11 @@ void OutputDevice::SetLineColor( const Color& rColor )
if( mpMetaFile )
mpMetaFile->AddAction( new MetaLineColorAction( aColor, true ) );
- if( ImplIsColorTransparent( aColor ) )
+ if( maLineColor != aColor )
{
- if ( mbLineColor )
- {
- mbInitLineColor = true;
- mbLineColor = false;
- maLineColor = Color( COL_TRANSPARENT );
- }
- }
- else
- {
- if( maLineColor != aColor )
- {
- mbInitLineColor = true;
- mbLineColor = true;
- maLineColor = aColor;
- }
+ mbInitLineColor = true;
+ mbLineColor = true;
+ maLineColor = aColor;
}
if( mpAlphaVDev )
@@ -583,7 +559,7 @@ void OutputDevice::InitLineColor()
else if( ROP_INVERT == meRasterOp )
mpGraphics->SetROPLineColor( SalROPColor::Invert );
else
- mpGraphics->SetLineColor( ImplColorToSal( maLineColor ) );
+ mpGraphics->SetLineColor( ImplColorToSalWithAlpha( maLineColor ) );
}
else
mpGraphics->SetLineColor();
@@ -605,7 +581,7 @@ void OutputDevice::InitFillColor()
else if( ROP_INVERT == meRasterOp )
mpGraphics->SetROPFillColor( SalROPColor::Invert );
else
- mpGraphics->SetFillColor( ImplColorToSal( maFillColor ) );
+ mpGraphics->SetFillColor( ImplColorToSalWithAlpha( maFillColor ) );
}
else
mpGraphics->SetFillColor();
diff --git a/vcl/source/outdev/pixel.cxx b/vcl/source/outdev/pixel.cxx
index 478a693..45a7e82 100644
--- a/vcl/source/outdev/pixel.cxx
+++ b/vcl/source/outdev/pixel.cxx
@@ -44,9 +44,7 @@ Color OutputDevice::GetPixel( const Point& rPt ) const
const long nX = ImplLogicXToDevicePixel( rPt.X() );
const long nY = ImplLogicYToDevicePixel( rPt.Y() );
const SalColor aSalCol = mpGraphics->GetPixel( nX, nY, this );
- aColor.SetRed( SALCOLOR_RED( aSalCol ) );
- aColor.SetGreen( SALCOLOR_GREEN( aSalCol ) );
- aColor.SetBlue( SALCOLOR_BLUE( aSalCol ) );
+ aColor = ImplSalToColor(aSalCol);
}
}
return aColor;
@@ -91,7 +89,7 @@ void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
if ( mpMetaFile )
mpMetaFile->AddAction( new MetaPixelAction( rPt, aColor ) );
- if ( !IsDeviceOutputNecessary() || ImplIsColorTransparent( aColor ) || ImplIsRecordLayout() )
+ if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
return;
Point aPt = ImplLogicToDevicePixel( rPt );
@@ -105,7 +103,7 @@ void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
if ( mbOutputClipped )
return;
- mpGraphics->DrawPixel( aPt.X(), aPt.Y(), ImplColorToSal( aColor ), this );
+ mpGraphics->DrawPixel( aPt.X(), aPt.Y(), ImplColorToSalWithAlpha( aColor ), this );
if( mpAlphaVDev )
mpAlphaVDev->DrawPixel( rPt );
commit 78304c174dce2ea9ddc6852241e903d2aa0434e0
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 12 16:53:17 2016 +0900
Add testcases for 32-bit bitmap
Change-Id: I531b8ba7cd691a526392a85da9cb8456a1f16177
diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index 1aa6821..dd9c5d8 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -16,6 +16,7 @@
#include <vcl/bitmap.hxx>
#include <vcl/bitmapaccess.hxx>
+#include <vcl/alpha.hxx>
#include <vcl/virdev.hxx>
#include <rtl/strbuf.hxx>
@@ -33,18 +34,57 @@ namespace
class BitmapTest : public CppUnit::TestFixture
{
+ void testBitmap32();
+ void testErase();
void testConvert();
void testScale();
void testCRC();
- void testBitmap32();
CPPUNIT_TEST_SUITE(BitmapTest);
+ CPPUNIT_TEST(testBitmap32);
+ CPPUNIT_TEST(testErase);
CPPUNIT_TEST(testConvert);
CPPUNIT_TEST(testScale);
CPPUNIT_TEST(testCRC);
CPPUNIT_TEST_SUITE_END();
};
+void BitmapTest::testErase()
+{
+ Bitmap aBitmap(Size(3, 3), 24);
+ {
+ Bitmap::ScopedWriteAccess pWriteAccess(aBitmap);
+ pWriteAccess->Erase(Color(0x11, 0x22, 0x33));
+ }
+ {
+ Bitmap::ScopedReadAccess pReadAccess(aBitmap);
+ Color aColor((Color)pReadAccess->GetPixel(0, 0));
+ CPPUNIT_ASSERT_EQUAL(RGB_COLORDATA(0x11, 0x22, 0x33), aColor.GetColor());
+ }
+}
+
+void BitmapTest::testBitmap32()
+{
+ Bitmap aBitmap(Size(3, 3), 32);
+ {
+ Bitmap::ScopedWriteAccess pWriteAccess(aBitmap);
+ pWriteAccess->Erase(TRGB_COLORDATA(0xFF, 0x11, 0x22, 0x33));
+ pWriteAccess->SetPixel(1, 1, BitmapColor(0x44, 0xFF, 0xBB, 0x00));
+ pWriteAccess->SetPixel(2, 2, BitmapColor(0x88, 0x77, 0x66, 0x55));
+ }
+ {
+ Bitmap::ScopedReadAccess pReadAccess(aBitmap);
+ BitmapColor aColor = pReadAccess->GetPixel(0, 0);
+ CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0xFF, 0x00, 0x00, 0x00), Color(aColor).GetColor());
+
+ aColor = pReadAccess->GetPixel(1, 1);
+ CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0x00, 0x44, 0xFF, 0xBB), Color(aColor).GetColor());
+
+ aColor = pReadAccess->GetPixel(2, 2);
+ CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0x55, 0x88, 0x77, 0x66), Color(aColor).GetColor());
+ }
+}
+
void BitmapTest::testConvert()
{
Bitmap aBitmap(Size(10, 10), 8);
commit 6dc401113a1925cc8da98320f7e6cc5ac855ebdc
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 12 16:50:39 2016 +0900
general support for 32-bit Bitmaps + support in "gen" backend
Change-Id: Iad57414a21dfa4e84e471d288923a1417a3535a3
diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx
index 10cadff..2230f57 100644
--- a/vcl/source/gdi/bmpacc2.cxx
+++ b/vcl/source/gdi/bmpacc2.cxx
@@ -169,78 +169,98 @@ void BitmapReadAccess::SetPixelForN24BitTcMask(Scanline pScanline, long nX, cons
BitmapColor BitmapReadAccess::GetPixelForN32BitTcAbgr(ConstScanline pScanline, long nX, const ColorMask&)
{
- BitmapColor aBitmapColor;
+ pScanline = pScanline + (nX << 2);
- aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ );
- aBitmapColor.SetGreen( *pScanline++ );
- aBitmapColor.SetRed( *pScanline );
+ sal_uInt8 a = *pScanline++;
+ sal_uInt8 b = *pScanline++;
+ sal_uInt8 g = *pScanline++;
+ sal_uInt8 r = *pScanline;
- return aBitmapColor;
+ return BitmapColor(r, g, b, 0xFF - a);
}
void BitmapReadAccess::SetPixelForN32BitTcAbgr(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&)
{
- *( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF;
+ pScanline = pScanline + (nX << 2);
+
+ sal_uInt8 alpha = 0xFF - rBitmapColor.GetAlpha();
+
+ *pScanline++ = alpha;
*pScanline++ = rBitmapColor.GetBlue();
*pScanline++ = rBitmapColor.GetGreen();
- *pScanline = rBitmapColor.GetRed();
+ *pScanline = rBitmapColor.GetRed();
}
BitmapColor BitmapReadAccess::GetPixelForN32BitTcArgb(ConstScanline pScanline, long nX, const ColorMask&)
{
- BitmapColor aBitmapColor;
+ pScanline = pScanline + (nX << 2);
- aBitmapColor.SetRed( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ );
- aBitmapColor.SetGreen( *pScanline++ );
- aBitmapColor.SetBlue( *pScanline );
+ sal_uInt8 a = *pScanline++;
+ sal_uInt8 r = *pScanline++;
+ sal_uInt8 g = *pScanline++;
+ sal_uInt8 b = *pScanline;
- return aBitmapColor;
+ return BitmapColor(r, g, b, 0xFF - a);
}
void BitmapReadAccess::SetPixelForN32BitTcArgb(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&)
{
- *( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF;
+ pScanline = pScanline + (nX << 2);
+
+ sal_uInt8 alpha = 0xFF - rBitmapColor.GetAlpha();
+
+ *pScanline++ = alpha;
*pScanline++ = rBitmapColor.GetRed();
*pScanline++ = rBitmapColor.GetGreen();
- *pScanline = rBitmapColor.GetBlue();
+ *pScanline = rBitmapColor.GetBlue();
}
BitmapColor BitmapReadAccess::GetPixelForN32BitTcBgra(ConstScanline pScanline, long nX, const ColorMask&)
{
- BitmapColor aBitmapColor;
+ pScanline = pScanline + (nX << 2);
- aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) )++ );
- aBitmapColor.SetGreen( *pScanline++ );
- aBitmapColor.SetRed( *pScanline );
+ sal_uInt8 b = *pScanline++;
+ sal_uInt8 g = *pScanline++;
+ sal_uInt8 r = *pScanline++;
+ sal_uInt8 a = *pScanline;
- return aBitmapColor;
+ return BitmapColor(r, g, b, 0xFF - a);
}
void BitmapReadAccess::SetPixelForN32BitTcBgra(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&)
{
- *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetBlue();
+ pScanline = pScanline + (nX << 2);
+
+ sal_uInt8 alpha = 0xFF - rBitmapColor.GetAlpha();
+
+ *pScanline++ = rBitmapColor.GetBlue();
*pScanline++ = rBitmapColor.GetGreen();
*pScanline++ = rBitmapColor.GetRed();
- *pScanline = 0xFF;
+ *pScanline = alpha;
}
BitmapColor BitmapReadAccess::GetPixelForN32BitTcRgba(ConstScanline pScanline, long nX, const ColorMask&)
{
- BitmapColor aBitmapColor;
+ pScanline = pScanline + (nX << 2);
- aBitmapColor.SetRed( *( pScanline = pScanline + ( nX << 2 ) )++ );
- aBitmapColor.SetGreen( *pScanline++ );
- aBitmapColor.SetBlue( *pScanline );
+ sal_uInt8 r = *pScanline++;
+ sal_uInt8 g = *pScanline++;
+ sal_uInt8 b = *pScanline++;
+ sal_uInt8 a = *pScanline;
- return aBitmapColor;
+ return BitmapColor(r, g, b, 0xFF - a);
}
void BitmapReadAccess::SetPixelForN32BitTcRgba(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&)
{
- *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetRed();
+ pScanline = pScanline + (nX << 2);
+
+ sal_uInt8 alpha = 0xFF - rBitmapColor.GetAlpha();
+
+ *pScanline++ = rBitmapColor.GetRed();
*pScanline++ = rBitmapColor.GetGreen();
*pScanline++ = rBitmapColor.GetBlue();
- *pScanline = 0xFF;
+ *pScanline = alpha;
}
BitmapColor BitmapReadAccess::GetPixelForN32BitTcMask(ConstScanline pScanline, long nX, const ColorMask& rMask)
diff --git a/vcl/source/gdi/impbmp.cxx b/vcl/source/gdi/impbmp.cxx
index e232b50..2f45fdd 100644
--- a/vcl/source/gdi/impbmp.cxx
+++ b/vcl/source/gdi/impbmp.cxx
@@ -80,8 +80,10 @@ sal_uInt16 ImpBitmap::ImplGetBitCount() const
return 4;
else if (nBitCount <= 8)
return 8;
- else
+ else if (nBitCount <= 24)
return 24;
+ else
+ return 32;
}
BitmapBuffer* ImpBitmap::ImplAcquireBuffer( BitmapAccessMode nMode )
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 45b5a45..cfd032f 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -130,6 +130,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
|| nBitCount == 8
|| nBitCount == 16
|| nBitCount == 24
+ || nBitCount == 32
, "Unsupported BitCount!"
);
@@ -184,12 +185,16 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
break;
}
#endif
- default:
- nBitCount = 24;
- SAL_FALLTHROUGH;
+ case 32:
+ pDIB->mnFormat |= ScanlineFormat::N32BitTcBgra;
+ break;
case 24:
pDIB->mnFormat |= ScanlineFormat::N24BitTcBgr;
- break;
+ break;
+ default:
+ pDIB->mnFormat |= ScanlineFormat::N24BitTcBgr;
+ nBitCount = 24;
+ break;
}
pDIB->mnWidth = rSize.Width();
commit 9af5fc6d23ca853c51c9fc82a9bf7184c96cbc33
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 12 16:47:25 2016 +0900
bitmap: support 32bit conversion
Change-Id: Ia97cb00a7f311088a8ab2c52c069a570f8c269b4
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 31811b9..516c293 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -95,9 +95,10 @@ enum BmpConversion
BMP_CONVERSION_8BIT_GREYS = 5,
BMP_CONVERSION_8BIT_COLORS = 6,
BMP_CONVERSION_24BIT = 7,
- BMP_CONVERSION_4BIT_TRANS = 8,
- BMP_CONVERSION_8BIT_TRANS = 9,
- BMP_CONVERSION_GHOSTED = 10
+ BMP_CONVERSION_32BIT = 8,
+ BMP_CONVERSION_4BIT_TRANS = 9,
+ BMP_CONVERSION_8BIT_TRANS = 10,
+ BMP_CONVERSION_GHOSTED = 11
};
enum BmpCombine
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 98ede14..46fa6c5 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -332,6 +332,15 @@ bool Bitmap::Convert( BmpConversion eConversion )
}
break;
+ case BMP_CONVERSION_32BIT:
+ {
+ if( nBitCount < 32 )
+ bRet = ImplConvertUp( 32 );
+ else
+ bRet = true;
+ }
+ break;
+
case BMP_CONVERSION_GHOSTED:
bRet = ImplConvertGhosted();
break;
commit 6b8b4688ac09ada485dca952ce3560581912ab36
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 12 16:38:02 2016 +0900
ColorData - for RGB macro use TRGB with transparency set to 0
Change-Id: Ia363e05768ac76a7cf4b4da6cbb57174b2d64682
diff --git a/include/tools/colordata.hxx b/include/tools/colordata.hxx
index 1d0fb42..2d8dbef 100644
--- a/include/tools/colordata.hxx
+++ b/include/tools/colordata.hxx
@@ -25,9 +25,12 @@
typedef sal_uInt32 ColorData;
#define TRGB_COLORDATA(TRANSPARENCE,RED,GREEN,BLUE) \
- ((sal_Int32)(((sal_uInt32)((sal_uInt8)(BLUE))))|(((sal_uInt32)((sal_uInt8)(GREEN)))<<8)|(((sal_uInt32)((sal_uInt8)(RED)))<<16)|(((sal_uInt32)((sal_uInt8)(TRANSPARENCE)))<<24))
+ ((sal_Int32)(((sal_uInt32)((sal_uInt8)(BLUE)))) | \
+ (((sal_uInt32)((sal_uInt8)(GREEN)))<<8) | \
+ (((sal_uInt32)((sal_uInt8)(RED)))<<16) | \
+ (((sal_uInt32)((sal_uInt8)(TRANSPARENCE)))<<24))
-#define RGB_COLORDATA( r,g,b ) ((ColorData)(((sal_uInt32)((sal_uInt8)(b))))|(((sal_uInt32)((sal_uInt8)(g)))<<8)|(((sal_uInt32)((sal_uInt8)(r)))<<16))
+#define RGB_COLORDATA( r,g,b ) TRGB_COLORDATA(0, r, g, b)
#define COLORDATA_RED( n ) ((sal_uInt8)((n)>>16))
#define COLORDATA_GREEN( n ) ((sal_uInt8)(((sal_uInt16)(n)) >> 8))
commit cffbb730d3c99359584139e4f25cb9f5fc989f3d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Tue Jun 7 18:33:34 2016 +0900
vcl: add "color channel bitcount" for an bitmap buffer (Linux)
In addition to "bitcount" on bitmap buffer, which represents the
number of bits one pixel takes, we also need the bitcount that the
color channels take of one pixel take.
For example RGB can be contined in 32 bits (because that the
underlaying buffer supports) In this case GetBitCount returns
32bit so we can traverse the buffer correctly. However, we also
need to know the bitcount of the actual color channels - in this
case this would be 24 bits.
Change-Id: I0a64928336540dc66d60659c46d64f369e786c3a
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index 04baf90..25f4159 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -267,7 +267,18 @@ struct VCL_DLLPUBLIC BitmapBuffer
long mnWidth;
long mnHeight;
long mnScanlineSize;
+
+ /**
+ * Bitcount of one pixel in the buffer.
+ * color + alpha channels with padding (for example in an RGBX format)
+ */
sal_uInt16 mnBitCount;
+
+ /**
+ * Bitcount color channels of one pixel.
+ * color + alpha channels only (i.e. 8, 16, 24, 32)
+ */
+ sal_uInt16 mnColorChannelBitCount;
ColorMask maColorMask;
BitmapPalette maPalette;
sal_uInt8* mpBits;
diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index f5dabae..e3f62a5 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -72,6 +72,7 @@ BitmapBuffer* ImplCreateDIB(
{
const sal_uInt16 nColors = ( nBitCount <= 8 ) ? ( 1 << nBitCount ) : 0;
+ pDIB->mnColorChannelBitCount = nBitCount;
switch (nBitCount)
{
case 1:
@@ -231,16 +232,14 @@ Size SvpSalBitmap::GetSize() const
return aSize;
}
-sal_uInt16 SvpSalBitmap::GetBitCount() const
+sal_uInt16 SvpSalBitmap::GetColorChannelBitCount() const
{
- sal_uInt16 nBitCount;
-
- if (mpDIB)
- nBitCount = mpDIB->mnBitCount;
- else
- nBitCount = 0;
+ return (mpDIB) ? mpDIB->mnColorChannelBitCount : 0;
+}
- return nBitCount;
+sal_uInt16 SvpSalBitmap::GetBitCount() const
+{
+ return (mpDIB) ? mpDIB->mnBitCount : 0;
}
BitmapBuffer* SvpSalBitmap::AcquireBuffer(BitmapAccessMode)
diff --git a/vcl/inc/headless/svpbmp.hxx b/vcl/inc/headless/svpbmp.hxx
index f0fce62..c9f2be8 100644
--- a/vcl/inc/headless/svpbmp.hxx
+++ b/vcl/inc/headless/svpbmp.hxx
@@ -52,6 +52,7 @@ public:
virtual void Destroy() final override;
virtual Size GetSize() const override;
virtual sal_uInt16 GetBitCount() const override;
+ virtual sal_uInt16 GetColorChannelBitCount() const override;
virtual BitmapBuffer* AcquireBuffer( BitmapAccessMode nMode ) override;
virtual void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override;
diff --git a/vcl/inc/opengl/salbmp.hxx b/vcl/inc/opengl/salbmp.hxx
index 771c4aa..4f54a45 100644
--- a/vcl/inc/opengl/salbmp.hxx
+++ b/vcl/inc/opengl/salbmp.hxx
@@ -70,6 +70,7 @@ public:
Size GetSize() const override;
sal_uInt16 GetBitCount() const override;
+ sal_uInt16 GetColorChannelBitCount() const override;
BitmapBuffer *AcquireBuffer( BitmapAccessMode nMode ) override;
void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override;
diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index 69d2539..91e4e5c 100644
--- a/vcl/inc/salbmp.hxx
+++ b/vcl/inc/salbmp.hxx
@@ -61,6 +61,7 @@ public:
virtual void Destroy() = 0;
virtual Size GetSize() const = 0;
virtual sal_uInt16 GetBitCount() const = 0;
+ virtual sal_uInt16 GetColorChannelBitCount() const = 0;
virtual BitmapBuffer* AcquireBuffer( BitmapAccessMode nMode ) = 0;
virtual void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) = 0;
diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h
index 761bbb6..d74736c 100644
--- a/vcl/inc/unx/salbmp.h
+++ b/vcl/inc/unx/salbmp.h
@@ -139,6 +139,7 @@ public:
virtual Size GetSize() const override;
virtual sal_uInt16 GetBitCount() const override;
+ virtual sal_uInt16 GetColorChannelBitCount() const override;
virtual BitmapBuffer* AcquireBuffer( BitmapAccessMode nMode ) override;
virtual void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override;
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index ef081ee..b90d0fc 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -660,6 +660,11 @@ sal_uInt16 OpenGLSalBitmap::GetBitCount() const
return mnBits;
}
+sal_uInt16 OpenGLSalBitmap::GetColorChannelBitCount() const
+{
+ return mnBits;
+}
+
bool OpenGLSalBitmap::calcChecksumGL(OpenGLTexture& rInputTexture, ChecksumType& rChecksum) const
{
OUString FragShader("areaHashCRC64TFragmentShader");
diff --git a/vcl/source/gdi/impbmp.cxx b/vcl/source/gdi/impbmp.cxx
index ab06a71..e232b50 100644
--- a/vcl/source/gdi/impbmp.cxx
+++ b/vcl/source/gdi/impbmp.cxx
@@ -73,9 +73,15 @@ Size ImpBitmap::ImplGetSize() const
sal_uInt16 ImpBitmap::ImplGetBitCount() const
{
- sal_uInt16 nBitCount = mpSalBitmap->GetBitCount();
- return ( nBitCount <= 4 ) ? ( ( nBitCount <= 1 ) ? 1 : 4 ):
- ( ( nBitCount <= 8 ) ? 8 : 24);
+ sal_uInt16 nBitCount = mpSalBitmap->GetColorChannelBitCount();
+ if (nBitCount <= 1)
+ return 1;
+ else if (nBitCount <= 4)
+ return 4;
+ else if (nBitCount <= 8)
+ return 8;
+ else
+ return 24;
}
BitmapBuffer* ImpBitmap::ImplAcquireBuffer( BitmapAccessMode nMode )
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 95665fd..45b5a45 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -149,7 +149,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
if( pDIB )
{
const sal_uInt16 nColors = ( nBitCount <= 8 ) ? ( 1 << nBitCount ) : 0;
-
+ pDIB->mnColorChannelBitCount = nBitCount;
pDIB->mnFormat = ScanlineFormat::NONE;
switch( nBitCount )
@@ -260,6 +260,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
aSrcBuf.mnWidth = nWidth;
aSrcBuf.mnHeight = nHeight;
aSrcBuf.mnBitCount = pImage->bits_per_pixel;
+ aSrcBuf.mnColorChannelBitCount = aSrcBuf.mnBitCount;
aSrcBuf.mnScanlineSize = pImage->bytes_per_line;
aSrcBuf.mpBits = reinterpret_cast<sal_uInt8*>(pImage->data);
@@ -848,6 +849,11 @@ sal_uInt16 X11SalBitmap::GetBitCount() const
return nBitCount;
}
+sal_uInt16 X11SalBitmap::GetColorChannelBitCount() const
+{
+ return GetBitCount();
+}
+
BitmapBuffer* X11SalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ )
{
if( !mpDIB && mpDDB )
commit cec0938fedaba803265d631b1cb4fe07f7f94c39
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 5 18:58:58 2016 +0900
Alpha channel in BitmapColor - change bIndex to alpha
We what to store the alpha channel in BitmapColor. To achieve this
we can repurpose bIndex attribute for alpha. Generally we don't
need bIndex at all as we can infer if we use index colors or not
from the context.
Change-Id: I18fe748beeca59e2869368a1c3c2ee9d2062b41e
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index cd9a79e..d7b82eb 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -328,22 +328,6 @@ namespace cairocanvas
return ::BitmapEx();
}
- static sal_uInt8 lcl_GetColor(BitmapColor const& rColor)
- {
- sal_uInt8 nTemp(0);
- if (rColor.IsIndex())
- {
- nTemp = rColor.GetIndex();
- }
- else
- {
- nTemp = rColor.GetBlue();
- // greyscale expected here, or what would non-grey colors mean?
- assert(rColor.GetRed() == nTemp && rColor.GetGreen() == nTemp);
- }
- return nTemp;
- }
-
static bool readAlpha( BitmapReadAccess* pAlphaReadAcc, long nY, const long nWidth, unsigned char* data, long nOff )
{
bool bIsAlpha = false;
@@ -372,7 +356,7 @@ namespace cairocanvas
BitmapColor const& rColor(
pAlphaReadAcc->GetPaletteColor(*pReadScan));
pReadScan++;
- nAlpha = data[ nOff ] = 255 - lcl_GetColor(rColor);
+ nAlpha = data[ nOff ] = 255 - rColor.GetBlueOrIndex();
if( nAlpha != 255 )
bIsAlpha = true;
nOff += 4;
diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx
index 950e82d..a63366e 100644
--- a/include/vcl/alpha.hxx
+++ b/include/vcl/alpha.hxx
@@ -67,6 +67,8 @@ public:
typedef vcl::ScopedBitmapAccess< BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireWriteAccess >
ScopedWriteAccess;
+ using Bitmap::IsEmpty;
+
private:
friend class BitmapEx;
friend class ::OutputDevice;
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index a40f24f..04baf90 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -98,20 +98,17 @@ private:
sal_uInt8 mcBlueOrIndex;
sal_uInt8 mcGreen;
sal_uInt8 mcRed;
- sal_uInt8 mbIndex; // should be bool, but see above warning
-
+ sal_uInt8 mcAlpha;
public:
inline BitmapColor();
- inline BitmapColor( sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue );
+ inline BitmapColor( sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cAlpha = 0 );
inline BitmapColor( const Color& rColor );
explicit inline BitmapColor( sal_uInt8 cIndex );
inline bool operator==( const BitmapColor& rBitmapColor ) const;
inline bool operator!=( const BitmapColor& rBitmapColor ) const;
- inline bool IsIndex() const;
-
inline sal_uInt8 GetRed() const;
inline void SetRed( sal_uInt8 cRed );
@@ -124,6 +121,9 @@ public:
inline sal_uInt8 GetIndex() const;
inline void SetIndex( sal_uInt8 cIndex );
+ inline sal_uInt8 GetAlpha() const;
+ inline void SetAlpha( sal_uInt8 cAlpha );
+
operator Color() const;
inline sal_uInt8 GetBlueOrIndex() const;
@@ -288,15 +288,15 @@ inline BitmapColor::BitmapColor() :
mcBlueOrIndex ( 0 ),
mcGreen ( 0 ),
mcRed ( 0 ),
- mbIndex ( sal_uInt8(false) )
+ mcAlpha ( 0 )
{
}
-inline BitmapColor::BitmapColor( sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue ) :
+inline BitmapColor::BitmapColor( sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cAlpha ) :
mcBlueOrIndex ( cBlue ),
mcGreen ( cGreen ),
mcRed ( cRed ),
- mbIndex ( sal_uInt8(false) )
+ mcAlpha ( cAlpha )
{
}
@@ -304,7 +304,7 @@ inline BitmapColor::BitmapColor( const Color& rColor ) :
mcBlueOrIndex ( rColor.GetBlue() ),
mcGreen ( rColor.GetGreen() ),
mcRed ( rColor.GetRed() ),
- mbIndex ( sal_uInt8(false) )
+ mcAlpha ( rColor.GetTransparency() )
{
}
@@ -312,15 +312,16 @@ inline BitmapColor::BitmapColor( sal_uInt8 cIndex ) :
mcBlueOrIndex ( cIndex ),
mcGreen ( 0 ),
mcRed ( 0 ),
- mbIndex ( sal_uInt8(true) )
+ mcAlpha ( 0 )
{
}
inline bool BitmapColor::operator==( const BitmapColor& rBitmapColor ) const
{
- return( ( mcBlueOrIndex == rBitmapColor.mcBlueOrIndex ) &&
- ( mbIndex ? bool(rBitmapColor.mbIndex) :
- ( mcGreen == rBitmapColor.mcGreen && mcRed == rBitmapColor.mcRed ) ) );
+ return mcBlueOrIndex == rBitmapColor.mcBlueOrIndex &&
+ mcGreen == rBitmapColor.mcGreen &&
+ mcRed == rBitmapColor.mcRed &&
+ mcAlpha == rBitmapColor.mcAlpha;
}
inline bool BitmapColor::operator!=( const BitmapColor& rBitmapColor ) const
@@ -328,63 +329,59 @@ inline bool BitmapColor::operator!=( const BitmapColor& rBitmapColor ) const
return !( *this == rBitmapColor );
}
-inline bool BitmapColor::IsIndex() const
-{
- return mbIndex;
-}
-
inline sal_uInt8 BitmapColor::GetRed() const
{
- assert( !mbIndex && "Pixel represents index into colortable" );
return mcRed;
}
inline void BitmapColor::SetRed( sal_uInt8 cRed )
{
- assert( !mbIndex && "Pixel represents index into colortable" );
mcRed = cRed;
}
inline sal_uInt8 BitmapColor::GetGreen() const
{
- assert( !mbIndex && "Pixel represents index into colortable" );
return mcGreen;
}
inline void BitmapColor::SetGreen( sal_uInt8 cGreen )
{
- assert( !mbIndex && "Pixel represents index into colortable" );
mcGreen = cGreen;
}
inline sal_uInt8 BitmapColor::GetBlue() const
{
- assert( !mbIndex && "Pixel represents index into colortable" );
return mcBlueOrIndex;
}
inline void BitmapColor::SetBlue( sal_uInt8 cBlue )
{
- assert( !mbIndex && "Pixel represents index into colortable" );
mcBlueOrIndex = cBlue;
}
inline sal_uInt8 BitmapColor::GetIndex() const
{
- assert( mbIndex && "Pixel represents color values" );
return mcBlueOrIndex;
}
inline void BitmapColor::SetIndex( sal_uInt8 cIndex )
{
- assert( mbIndex && "Pixel represents color values" );
mcBlueOrIndex = cIndex;
}
+inline sal_uInt8 BitmapColor::GetAlpha() const
+{
+ return mcAlpha;
+}
+
+inline void BitmapColor::SetAlpha( sal_uInt8 cAlpha )
+{
+ mcAlpha = cAlpha;
+}
+
inline BitmapColor::operator Color() const
{
- assert( !mbIndex && "Pixel represents index into colortable" );
- return Color( mcRed, mcGreen, mcBlueOrIndex );
+ return Color(mcAlpha, mcRed, mcGreen, mcBlueOrIndex);
}
inline sal_uInt8 BitmapColor::GetBlueOrIndex() const
@@ -395,7 +392,6 @@ inline sal_uInt8 BitmapColor::GetBlueOrIndex() const
inline BitmapColor& BitmapColor::Invert()
{
- assert( !mbIndex && "Pixel represents index into colortable" );
mcBlueOrIndex = ~mcBlueOrIndex;
mcGreen = ~mcGreen;
mcRed = ~mcRed;
@@ -405,15 +401,12 @@ inline BitmapColor& BitmapColor::Invert()
inline sal_uInt8 BitmapColor::GetLuminance() const
{
- assert( !mbIndex && "Pixel represents index into colortable" );
return (static_cast<unsigned long>(mcBlueOrIndex) * 28UL + static_cast<unsigned long>(mcGreen) * 151UL + static_cast<unsigned long>(mcRed) * 77UL) >> 8;
}
inline BitmapColor& BitmapColor::Merge( const BitmapColor& rBitmapColor, sal_uInt8 cTransparency )
{
- assert( !mbIndex && "Pixel represents index into colortable" );
- assert( !rBitmapColor.mbIndex && "Pixel represents index into colortable" );
mcBlueOrIndex = COLOR_CHANNEL_MERGE( mcBlueOrIndex, rBitmapColor.mcBlueOrIndex, cTransparency );
mcGreen = COLOR_CHANNEL_MERGE( mcGreen, rBitmapColor.mcGreen, cTransparency );
mcRed = COLOR_CHANNEL_MERGE( mcRed, rBitmapColor.mcRed, cTransparency );
@@ -424,8 +417,6 @@ inline BitmapColor& BitmapColor::Merge( const BitmapColor& rBitmapColor, sal_uIn
inline sal_uInt16 BitmapColor::GetColorError( const BitmapColor& rBitmapColor ) const
{
- assert( !mbIndex && "Pixel represents index into colortable" );
- assert( !rBitmapColor.mbIndex && "Pixel represents index into colortable" );
return static_cast<sal_uInt16>(
abs( static_cast<int>(mcBlueOrIndex) - static_cast<int>(rBitmapColor.mcBlueOrIndex) ) +
abs( static_cast<int>(mcGreen) - static_cast<int>(rBitmapColor.mcGreen) ) +
diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index 6823cfb..1aa6821 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -36,6 +36,7 @@ class BitmapTest : public CppUnit::TestFixture
void testConvert();
void testScale();
void testCRC();
+ void testBitmap32();
CPPUNIT_TEST_SUITE(BitmapTest);
CPPUNIT_TEST(testConvert);
diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx
index 089a246..10cadff 100644
--- a/vcl/source/gdi/bmpacc2.cxx
+++ b/vcl/source/gdi/bmpacc2.cxx
@@ -79,11 +79,7 @@ BitmapColor BitmapReadAccess::GetPixelForN8BitPal(ConstScanline pScanline, long
void BitmapReadAccess::SetPixelForN8BitPal(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&)
{
- if (rBitmapColor.IsIndex())
- pScanline[ nX ] = rBitmapColor.GetIndex();
- else
- // Let's hope that the RGB color values equal, so it doesn't matter what do we pick
- pScanline[ nX ] = rBitmapColor.GetBlueOrIndex();
+ pScanline[ nX ] = rBitmapColor.GetBlueOrIndex();
}
BitmapColor BitmapReadAccess::GetPixelForN8BitTcMask(ConstScanline pScanline, long nX, const ColorMask& rMask)
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 51dfdc8..b60037a 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -77,8 +77,8 @@ private:
Scanline mpScanAccess;
sal_PtrDiff mnScanOffset;
- sal_uInt32 ColorOf (BitmapColor& rColor) const;
- sal_uInt8 GrayOf (BitmapColor& rColor) const;
+ sal_uInt32 ColorOf (BitmapColor& rColor, bool bIndex) const;
+ sal_uInt8 GrayOf (BitmapColor& rColor, bool bIndex) const;
public:
@@ -189,10 +189,10 @@ SalPrinterBmp::GetDepth () const
}
sal_uInt32
-SalPrinterBmp::ColorOf (BitmapColor& rColor) const
+SalPrinterBmp::ColorOf(BitmapColor& rColor, bool bIndex) const
{
- if (rColor.IsIndex())
- return ColorOf (mpBmpBuffer->maPalette[rColor.GetIndex()]);
+ if (bIndex)
+ return ColorOf(mpBmpBuffer->maPalette[rColor.GetIndex()], false);
else
return ((rColor.GetBlue()) & 0x000000ff)
| ((rColor.GetGreen() << 8) & 0x0000ff00)
@@ -200,10 +200,10 @@ SalPrinterBmp::ColorOf (BitmapColor& rColor) const
}
sal_uInt8
-SalPrinterBmp::GrayOf (BitmapColor& rColor) const
+SalPrinterBmp::GrayOf(BitmapColor& rColor, bool bIndex) const
{
- if (rColor.IsIndex())
- return GrayOf (mpBmpBuffer->maPalette[rColor.GetIndex()]);
+ if (bIndex)
+ return GrayOf(mpBmpBuffer->maPalette[rColor.GetIndex()], false);
else
return ( rColor.GetBlue() * 28UL
+ rColor.GetGreen() * 151UL
@@ -213,13 +213,13 @@ SalPrinterBmp::GrayOf (BitmapColor& rColor) const
sal_uInt32
SalPrinterBmp::GetPaletteEntryCount () const
{
- return mpBmpBuffer->maPalette.GetEntryCount ();
+ return mpBmpBuffer->maPalette.GetEntryCount();
}
sal_uInt32
SalPrinterBmp::GetPaletteColor (sal_uInt32 nIdx) const
{
- return ColorOf (mpBmpBuffer->maPalette[nIdx]);
+ return ColorOf(mpBmpBuffer->maPalette[nIdx], false);
}
sal_uInt32
@@ -228,7 +228,7 @@ SalPrinterBmp::GetPixelRGB (sal_uInt32 nRow, sal_uInt32 nColumn) const
Scanline pScan = mpScanAccess + nRow * mnScanOffset;
BitmapColor aColor = mpFncGetPixel (pScan, nColumn, mpBmpBuffer->maColorMask);
- return ColorOf (aColor);
+ return ColorOf(aColor, !!mpBmpBuffer->maPalette);
}
sal_uInt8
@@ -237,7 +237,7 @@ SalPrinterBmp::GetPixelGray (sal_uInt32 nRow, sal_uInt32 nColumn) const
Scanline pScan = mpScanAccess + nRow * mnScanOffset;
BitmapColor aColor = mpFncGetPixel (pScan, nColumn, mpBmpBuffer->maColorMask);
- return GrayOf (aColor);
+ return GrayOf(aColor, !!mpBmpBuffer->maPalette);
}
sal_uInt8
@@ -246,7 +246,7 @@ SalPrinterBmp::GetPixelIdx (sal_uInt32 nRow, sal_uInt32 nColumn) const
Scanline pScan = mpScanAccess + nRow * mnScanOffset;
BitmapColor aColor = mpFncGetPixel (pScan, nColumn, mpBmpBuffer->maColorMask);
- if (aColor.IsIndex())
+ if (!!mpBmpBuffer->maPalette)
return aColor.GetIndex();
else
return 0;
commit 90517f4071c0a5950f88227c5ec345f4aa6ca0cd
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Sun Jul 24 05:52:57 2016 +0900
starmath: Add unit test for tdf#52225
Change-Id: Id0e9cb3f2fb939bedc2f8e7a56d40a0f82c1e9ca
Reviewed-on: https://gerrit.libreoffice.org/27469
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>
diff --git a/starmath/qa/cppunit/test_node.cxx b/starmath/qa/cppunit/test_node.cxx
index 5f2dca8..b07f26c 100644
--- a/starmath/qa/cppunit/test_node.cxx
+++ b/starmath/qa/cppunit/test_node.cxx
@@ -16,6 +16,7 @@
#include <smdll.hxx>
#include <node.hxx>
#include <parse.hxx>
+#include <utility.hxx>
#include <memory>
@@ -33,9 +34,11 @@ public:
private:
void testTdf47813();
+ void testTdf52225();
CPPUNIT_TEST_SUITE(NodeTest);
CPPUNIT_TEST(testTdf47813);
+ CPPUNIT_TEST(testTdf52225);
CPPUNIT_TEST_SUITE_END();
SmDocShellRef mxDocShell;
@@ -81,6 +84,52 @@ void NodeTest::testTdf47813()
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, nWidthR/static_cast<double>(nWidthA), 0.01);
}
+void NodeTest::testTdf52225()
+{
+#define CHECK_GREEK_SYMBOL(text, code, bItalic) do { \
+ mxDocShell->SetText(text); \
+ const SmTableNode *pTree= mxDocShell->GetFormulaTree(); \
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pTree->GetNumSubNodes()); \
+ const SmNode *pLine = pTree->GetSubNode(0); \
+ CPPUNIT_ASSERT(pLine); \
+ CPPUNIT_ASSERT_EQUAL(NLINE, pLine->GetType()); \
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pLine->GetNumSubNodes()); \
+ const SmNode *pNode = pLine->GetSubNode(0); \
+ CPPUNIT_ASSERT(pNode); \
+ CPPUNIT_ASSERT_EQUAL(NSPECIAL, pNode->GetType()); \
+ const SmSpecialNode *pSn = static_cast<const SmSpecialNode *>(pNode); \
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pSn->GetText().getLength()); \
+ CPPUNIT_ASSERT_EQUAL(sal_Unicode(code), pSn->GetText()[0]); \
+ CPPUNIT_ASSERT_EQUAL(OUString(text), pSn->GetToken().aText); \
+ CPPUNIT_ASSERT_EQUAL(bItalic, IsItalic(pSn->GetFont())); \
+ } while (false)
+
+ SmFormat aFormat = mxDocShell->GetFormat();
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), aFormat.GetGreekCharStyle()); // default format
+ CHECK_GREEK_SYMBOL("%ALPHA", 0x0391, false);
+ CHECK_GREEK_SYMBOL("%iALPHA", 0x0391, true);
+ CHECK_GREEK_SYMBOL("%alpha", 0x03b1, false);
+ CHECK_GREEK_SYMBOL("%ialpha", 0x03b1, true);
+
+ // mode 1
+ aFormat.SetGreekCharStyle(1);
+ mxDocShell->SetFormat(aFormat);
+ CHECK_GREEK_SYMBOL("%BETA", 0x0392, true);
+ CHECK_GREEK_SYMBOL("%iBETA", 0x0392, true);
+ CHECK_GREEK_SYMBOL("%beta", 0x03b2, true);
+ CHECK_GREEK_SYMBOL("%ibeta", 0x03b2, true);
+
+ // mode 2
+ aFormat.SetGreekCharStyle(2);
+ mxDocShell->SetFormat(aFormat);
+ CHECK_GREEK_SYMBOL("%GAMMA", 0x0393, false);
+ CHECK_GREEK_SYMBOL("%iGAMMA", 0x0393, true);
+ CHECK_GREEK_SYMBOL("%gamma", 0x03b3, true);
+ CHECK_GREEK_SYMBOL("%igamma", 0x03b3, true);
+
+#undef CHECK_GREEK_SYMBOL
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(NodeTest);
}
commit b49005115076771da2669d120e72606bc2b0f532
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun Jun 19 10:19:17 2016 +0800
don't use AA in SVP backend when getAntiAliasB2DDraw is false
Change-Id: Icea880a824f57ca74eb9e22820893faf6cbf7945
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 364050a..7482a68 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -684,7 +684,10 @@ void SvpSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 )
cairo_t* cr = getCairoContext(false);
clipRegion(cr);
- AddPolygonToPath(cr, aPoly, aPoly.isClosed(), !getAntiAliasB2DDraw(), true);
+ bool bAA = getAntiAliasB2DDraw();
+
+ cairo_set_antialias(cr, bAA ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE);
+ AddPolygonToPath(cr, aPoly, aPoly.isClosed(), !bAA, true);
applyColor(cr, m_aLineColor);
@@ -766,6 +769,7 @@ bool SvpSalGraphics::drawPolyLine(
cairo_set_line_width(cr, rLineWidths.getX());
cairo_set_miter_limit(cr, fMiterLimit);
+ cairo_set_antialias(cr, getAntiAliasB2DDraw() ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE);
basegfx::B2DRange extents(0, 0, 0, 0);
commit c360f90ea902ca697c7a7145825450d430b02e07
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Sun Jul 24 11:40:59 2016 +0200
For a failing image load, indicate theme
(only in case OSL_DEBUG_LEVEL>0)
Change-Id: I31217c72c9bddaa748a5980252b40d025c76b730
Reviewed-on: https://gerrit.libreoffice.org/27473
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/vcl/source/image/ImageList.cxx b/vcl/source/image/ImageList.cxx
index aab0150..07182af 100644
--- a/vcl/source/image/ImageList.cxx
+++ b/vcl/source/image/ImageList.cxx
@@ -139,6 +139,9 @@ void ImageAryData::Load(const OUString &rPrefix)
aMessage.append( "ImageAryData::Load: failed to load image '" );
aMessage.append( OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ).getStr() );
aMessage.append( "'" );
+ aMessage.append( " from icon theme '" );
+ aMessage.append( OUStringToOString( aIconTheme, RTL_TEXTENCODING_UTF8 ).getStr() );
+ aMessage.append( "'" );
OSL_FAIL( aMessage.makeStringAndClear().getStr() );
}
#endif
commit c3c4aec158a595826e37652a82c5782433022a7b
Author: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
Date: Sun Jul 24 02:47:21 2016 -0500
tdf#100849 Restore Tango currency-neutral icon
This partially reverts f18096f1b5cce12033e6721fa6624f02e797acc3.
Change-Id: I0697214e39406905b995e4fd30ee64702908e5aa
diff --git a/icon-themes/tango/cmd/lc_currencyfield.png b/icon-themes/tango/cmd/lc_currencyfield.png
index 7d60025..7f09c08 100644
Binary files a/icon-themes/tango/cmd/lc_currencyfield.png and b/icon-themes/tango/cmd/lc_currencyfield.png differ
diff --git a/icon-themes/tango/cmd/sc_currencyfield.png b/icon-themes/tango/cmd/sc_currencyfield.png
index e403abc..ae67122 100644
Binary files a/icon-themes/tango/cmd/sc_currencyfield.png and b/icon-themes/tango/cmd/sc_currencyfield.png differ
commit e22122e20ca69d0f2b0e8831e9ebf3afd2064329
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jul 23 21:48:25 2016 +0100
Resolves: tdf#101058 crash on deleting certain table row
regression from...
commit 15d8b51bf82610c663f80fe552a1c0315e137ad3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Feb 5 17:33:49 2013 +0000
Resolves: rhbz#907933 crash on removing second last para in cell...
if (basically) the last para is on next page
so revert that and try a different fix which now works to keep the original
problem crash-free and fix this one too
Change-Id: Ia6b3ef48c43ceceb7ee7cc2b8b803314349f3785
diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx
index bd42457..92da368 100644
--- a/sw/source/core/inc/tabfrm.hxx
+++ b/sw/source/core/inc/tabfrm.hxx
@@ -156,8 +156,6 @@ public:
bool HasFollowFlowLine() const { return m_bHasFollowFlowLine; }
void SetFollowFlowLine(bool bNew) { m_bHasFollowFlowLine = bNew; }
- //return the SwTabFrame (if any) that this SwTabFrame is a follow flow line for
- SwTabFrame* GetFollowFlowLineFor();
bool IsRebuildLastLine() const { return m_bIsRebuildLastLine; }
void SetRebuildLastLine(bool bNew) { m_bIsRebuildLastLine = bNew; }
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 3295980..e4edd2b 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -129,28 +129,8 @@ extern const SwTable *g_pRowCacheLastTable;
extern const SwTabFrame *g_pRowCacheLastTabFrame;
extern const SwFrame *g_pRowCacheLastCellFrame;
-//return the SwTabFrame (if any) that this SwTabFrame is a follow flow line for
-SwTabFrame* SwTabFrame::GetFollowFlowLineFor()
-{
- SwFlowFrame *pPrec = GetPrecede();
- if (pPrec && pPrec->GetFrame().IsTabFrame())
- {
- SwTabFrame *pPrevTabFrame = static_cast<SwTabFrame*>(pPrec);
- assert(this == pPrevTabFrame->GetFollow());
- if (pPrevTabFrame->HasFollowFlowLine() && pPrevTabFrame->GetFollow() == this)
- return pPrevTabFrame;
- }
- return nullptr;
-}
-
void SwTabFrame::DestroyImpl()
{
- //rhbz#907933, we are a follow flow line for something and have been
- //deleted, remove ourself as a follow flowline
- SwTabFrame* pFlowFrameFor = GetFollowFlowLineFor();
- if (pFlowFrameFor)
- pFlowFrameFor->RemoveFollowFlowLine();
-
// There is some terrible code in fetab.cxx, that
// makes use of these global pointers. Obviously
// this code did not consider that a TabFrame can be
@@ -838,7 +818,8 @@ static long lcl_GetMaximumLayoutRowSpan( const SwRowFrame& rRow )
bool SwTabFrame::RemoveFollowFlowLine()
{
// find FollowFlowLine
- SwRowFrame* pFollowFlowLine = GetFollow()->GetFirstNonHeadlineRow();
+ SwTabFrame *pFoll = GetFollow();
+ SwRowFrame* pFollowFlowLine = pFoll ? pFoll->GetFirstNonHeadlineRow() : nullptr;
// find last row in master
SwFrame* pLastLine = GetLastLower();
@@ -1270,7 +1251,7 @@ bool SwTabFrame::Join()
SwTabFrame *pFoll = GetFollow();
- if ( !pFoll->IsJoinLocked() )
+ if (pFoll && !pFoll->IsJoinLocked())
{
SWRECTFN( this )
pFoll->Cut(); //Cut out first to avoid unnecessary notifications.
commit f9f090d0d0f2b454d6c1dd14fe735e7e83fda9da
Author: Stanislav Horacek <stanislav.horacek at gmail.com>
Date: Sat Jul 23 22:04:19 2016 +0200
Updated core
Project: help 96c3fd60a0d02dcd4d9fc1925aed3c28f5170b9a
fix function name in syntax for FORECAST.LINEAR
Change-Id: Ibbaadef2e51ad71d819df993ccbee9b124243054
Reviewed-on: https://gerrit.libreoffice.org/27466
Reviewed-by: jan iversen <jani at documentfoundation.org>
Tested-by: jan iversen <jani at documentfoundation.org>
diff --git a/helpcontent2 b/helpcontent2
index a5c501a..96c3fd6 160000
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit a5c501a84e0061e3316352f9ed5219419d9bc295
+Subproject commit 96c3fd60a0d02dcd4d9fc1925aed3c28f5170b9a
commit 3ce5a97f28780983cbaf57d65622df7766abb741
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jul 23 21:20:05 2016 +0100
why do I keep getting these the wrong way around
Change-Id: I5f40f1b51d5581d97ded5576c7a1ad05a59d29e8
diff --git a/svx/uiconfig/ui/compressgraphicdialog.ui b/svx/uiconfig/ui/compressgraphicdialog.ui
index f7120cd..8648523 100644
--- a/svx/uiconfig/ui/compressgraphicdialog.ui
+++ b/svx/uiconfig/ui/compressgraphicdialog.ui
@@ -147,7 +147,7 @@
<property name="column_spacing">6</property>
<child>
<object class="GtkRadioButton" id="radio-jpeg">
- <property name="label" translatable="yes">JPEG Compression</property>
+ <property name="label" translatable="yes">JPEG Quality</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -163,7 +163,7 @@
</child>
<child>
<object class="GtkRadioButton" id="radio-lossless">
- <property name="label" translatable="yes">PNG Quality</property>
+ <property name="label" translatable="yes">PNG Compression</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
commit 22155f9adbbe853b6e03729605331c06f43972ca
Author: Gabor Kelemen <kelemeng at ubuntu.com>
Date: Sat Jul 23 15:56:24 2016 +0200
tdf#101087 Add Hungarian example xml for classification
Change-Id: Ic35a2c12973863545397c417704a1e68703daec4
Reviewed-on: https://gerrit.libreoffice.org/27459
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/sfx2/Package_classification.mk b/sfx2/Package_classification.mk
index 91f9d0e..4ed779c 100644
--- a/sfx2/Package_classification.mk
+++ b/sfx2/Package_classification.mk
@@ -11,6 +11,7 @@ $(eval $(call gb_Package_Package,sfx2_classification,$(SRCDIR)/sfx2))
$(eval $(call gb_Package_add_files,sfx2_classification,$(LIBO_SHARE_FOLDER)/classification,\
classification/example.xml \
+ classification/example_hu-HU.xml \
classification/example_pt-BR.xml \
classification/example_sl-SI.xml \
))
diff --git a/sfx2/classification/example_hu-HU.xml b/sfx2/classification/example_hu-HU.xml
new file mode 100644
index 0000000..1bb6e94
--- /dev/null
+++ b/sfx2/classification/example_hu-HU.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<baf:BusinessAuthorization xmlns:baf="urn:tscp:names:baf:1.1">
+ <baf:PolicyAuthorityName>TSCP példa irányelv-szolgáltató</baf:PolicyAuthorityName>
+ <baf:PolicyName>TSCP példa irányelv</baf:PolicyName>
+ <baf:AdministrativeData>
+ <baf:ProgramID>urn:example:tscp:1</baf:ProgramID>
+ </baf:AdministrativeData>
+ <baf:Included>
+ <baf:BusinessAuthorizationCategory Identifier="urn:example:tscp:1:non-business" Name="Nem üzleti">
+ <baf:LabelingRules/>
+ <baf:ImpactLevel>
+ <baf:Scale>UK-Cabinet</baf:Scale>
+ <baf:ConfidentalityValue>0</baf:ConfidentalityValue>
+ </baf:ImpactLevel>
+ </baf:BusinessAuthorizationCategory>
+ <baf:BusinessAuthorizationCategory Identifier="urn:example:tscp:1:general-business" Name="Általános üzleti">
+ <baf:LabelingRules>
+ <baf:VisualMarkingPart>
+ <baf:Identifier>Document: Header</baf:Identifier>
+ <baf:Value>Besorolás: Általános üzleti</baf:Value>
+ </baf:VisualMarkingPart>
+ </baf:LabelingRules>
+ <baf:ImpactLevel>
+ <baf:Scale>UK-Cabinet</baf:Scale>
+ <baf:ConfidentalityValue>1</baf:ConfidentalityValue>
+ </baf:ImpactLevel>
+ </baf:BusinessAuthorizationCategory>
+ <baf:BusinessAuthorizationCategory Identifier="urn:example:tscp:1:confidential" Name="Bizalmas">
+ <baf:LabelingRules>
+ <baf:VisualMarkingPart>
+ <baf:Identifier>Document: Header</baf:Identifier>
+ <baf:Value>Besorolás: bizalmas</baf:Value>
+ </baf:VisualMarkingPart>
+ <baf:VisualMarkingPart>
+ <baf:Identifier>Document: Footer</baf:Identifier>
+ <baf:Value>Ez a tartalom bizalmasként van megjelölve. Ne terjessze külső feleknek vezetői jóváhagyás nélkül.</baf:Value>
+ </baf:VisualMarkingPart>
+ <baf:VisualMarkingPart>
+ <baf:Identifier>Document: Watermark</baf:Identifier>
+ <baf:Value>Bizalmas</baf:Value>
+ </baf:VisualMarkingPart>
+ </baf:LabelingRules>
+ <baf:ImpactLevel>
+ <baf:Scale>UK-Cabinet</baf:Scale>
+ <baf:ConfidentalityValue>2</baf:ConfidentalityValue>
+ </baf:ImpactLevel>
+ </baf:BusinessAuthorizationCategory>
+ <baf:BusinessAuthorizationCategory Identifier="urn:example:tscp:1:internal-only" Name="Csak belső">
+ <baf:LabelingRules>
+ <baf:VisualMarkingPart>
+ <baf:Identifier>Document: Header</baf:Identifier>
+ <baf:Value>Besorolás: csak belső</baf:Value>
+ </baf:VisualMarkingPart>
+ <baf:VisualMarkingPart>
+ <baf:Identifier>Document: Footer</baf:Identifier>
+ <baf:Value>Ez a tartalom csak belső felhasználásúként van megjelölve. Ne terjessze a szervezeten kívüli feleknek.</baf:Value>
+ </baf:VisualMarkingPart>
+ <baf:VisualMarkingPart>
+ <baf:Identifier>Document: Watermark</baf:Identifier>
+ <baf:Value>Csak belső</baf:Value>
+ </baf:VisualMarkingPart>
+ </baf:LabelingRules>
+ <baf:ImpactLevel>
+ <baf:Scale>UK-Cabinet</baf:Scale>
+ <baf:ConfidentalityValue>3</baf:ConfidentalityValue>
+ </baf:ImpactLevel>
+ </baf:BusinessAuthorizationCategory>
+ </baf:Included>
+</baf:BusinessAuthorization>
+<!-- vim:set shiftwidth=4 softtabstop=4 expandtab:
+-->
commit 8278be98600b21eaa237c9b7a072ffcff370f3b7
Author: Andrea Gelmini <andrea.gelmini at gelma.net>
Date: Thu Jul 21 13:54:43 2016 +0200
Fix typos
Thanks to Carlo Bertoldi for the german translation.
Change-Id: I76f554e757318aed4e28b5a05fae0ba15bd46afb
Reviewed-on: https://gerrit.libreoffice.org/27355
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx
index 4e4c1e3..9dd861d 100644
--- a/connectivity/source/cpool/ZPoolCollection.cxx
+++ b/connectivity/source/cpool/ZPoolCollection.cxx
@@ -465,7 +465,7 @@ void SAL_CALL OPoolCollection::propertyChange( const css::beans::PropertyChangeE
{
OUString sThisDriverName;
getNodeValue(getDriverNameNodeName(),evt.Source) >>= sThisDriverName;
- // 1nd relase the driver
+ // 1st release the driver
// look if we already have a proxy for this driver
MapDriver2DriverRef::iterator aLookup = m_aDriverProxies.begin();
while( aLookup != m_aDriverProxies.end())
diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx
index dfff234..f3736de 100644
--- a/framework/source/dispatch/interceptionhelper.cxx
+++ b/framework/source/dispatch/interceptionhelper.cxx
@@ -177,7 +177,7 @@ void SAL_CALL InterceptionHelper::releaseDispatchProviderInterceptor(const css::
// If it could be located inside cache -
// use its slave/master relations to update the interception list;
// set empty references for it as new master and slave;
- // and relase it from out cache.
+ // and release it from out cache.
InterceptorList::iterator pIt = m_lInterceptionRegs.findByReference(xInterceptor);
if (pIt != m_lInterceptionRegs.end())
{
diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx
index ecf5b91..eaff5b5 100644
--- a/framework/source/jobs/jobexecutor.cxx
+++ b/framework/source/jobs/jobexecutor.cxx
@@ -380,7 +380,7 @@ void SAL_CALL JobExecutor::elementReplaced( const css::container::ContainerEvent
css.document.XEventListener. So it can be, that this disposing call comes from
the global event broadcaster service. But we don't hold any reference to this service
which can or must be released. Because this broadcaster itself is an one instance service
- too, we can ignore this request. On the other side we must relase our internal CFG
+ too, we can ignore this request. On the other side we must release our internal CFG
reference ... SOLUTION => check the given event source and react only, if it's our internal
hold configuration object!
*/
diff --git a/include/onlineupdate/mozilla/Attributes.h b/include/onlineupdate/mozilla/Attributes.h
index 129d1dc..6c2cc02 100644
--- a/include/onlineupdate/mozilla/Attributes.h
+++ b/include/onlineupdate/mozilla/Attributes.h
@@ -351,7 +351,7 @@
* void DeclaredFunction() MOZ_FUNCTION_ATTRIBUTE;
* void SomeFunction() MOZ_FUNCTION_ATTRIBUTE {}
* void PureFunction() const MOZ_FUNCTION_ATTRIBUTE = 0;
- * void OverriddenFunction() MOZ_FUNCTION_ATTIRBUTE override;
+ * void OverriddenFunction() MOZ_FUNCTION_ATTRIBUTE override;
*
* Attributes that apply to variables or parameters follow the variable's name:
*
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx
index 6372f90..de21039 100644
--- a/l10ntools/inc/export.hxx
+++ b/l10ntools/inc/export.hxx
@@ -306,7 +306,7 @@ class MergeDataFile
MergeDataHashMap aMap;
std::set<OString> aLanguageSet;
- MergeData *GetMergeData( ResData *pResData , bool bCaseSensitve = false );
+ MergeData *GetMergeData( ResData *pResData , bool bCaseSensitive = false );
void InsertEntry(const OString &rTYP, const OString &rGID,
const OString &rLID, const OString &nLang,
const OString &rTEXT, const OString &rQHTEXT,
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index be8810a..0767e2c 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2708,7 +2708,7 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray )
else if (mxSymbols->isODFF())
{
// ODFF names that are not written in the current mapping but to be
- // recognized. New names will be written in a future relase, then
+ // recognized. New names will be written in a future release, then
// exchange (!) with the names in
// formula/source/core/resource/core_resource.src to be able to still
// read the old names as well.
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index de3d4d5..2a341ee 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -111,7 +111,7 @@ void SAL_CALL BasicViewFactory::disposing()
mpFrameView = nullptr;
}
- // Relase the view cache.
+ // Release the view cache.
ViewShellContainer::const_iterator iView;
for (iView=mpViewCache->begin(); iView!=mpViewCache->end(); ++iView)
{
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index d461bc0..2697228 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -700,7 +700,7 @@ void SfxObjectShell::SetTitle
SfxApplication *pSfxApp = SfxGetpApp();
- // If possible relase the unnamed number.
+ // If possible release the unnamed number.
if ( pImpl->bIsNamedVisible && USHRT_MAX != pImpl->nVisualDocumentNumber )
{
pSfxApp->ReleaseIndex(pImpl->nVisualDocumentNumber);
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index fe2fd8b..6eeb354 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2265,7 +2265,7 @@ bool SwHTMLParser::AppendTextNode( SwHTMLAppendMode eMode, bool bUpdateNum )
m_pPam->GetNode().GetTextNode()->ResetAttr( RES_PARATR_NUMRULE );
}
- // Attrubute im Absatz davor sollte man jetzt setzen (wegen JavaScript)
+ // We must set the attribute of the paragraph before now (because of JavaScript)
SetAttr();
// Now it is time to get rid of all script dependent hints that are
diff --git a/wizards/com/sun/star/wizards/web/ImageListDialog.py b/wizards/com/sun/star/wizards/web/ImageListDialog.py
index 1db1078..743f956 100644
--- a/wizards/com/sun/star/wizards/web/ImageListDialog.py
+++ b/wizards/com/sun/star/wizards/web/ImageListDialog.py
@@ -215,7 +215,7 @@ class ImageListDialog(UnoDialog2):
class ARenderer(IRenderer):
'''
- @param aTempalte a template for this renderer.
+ @param aTemplate is a template for this renderer.
The strings %START, %END ,%TOTAL will be replaced
with the actual values.
'''
commit 88e73ff03886c7d59c3977b9add5c97efecf6044
Author: Stanislav Horacek <stanislav.horacek at gmail.com>
Date: Fri Jul 22 17:03:29 2016 +0200
Updated core
Project: help a5c501a84e0061e3316352f9ed5219419d9bc295
rename option for cursor in protected areas
Change-Id: I1e2ffcf03c952a5d40874d9aafe60ccd97d80dc3
Reviewed-on: https://gerrit.libreoffice.org/27443
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/helpcontent2 b/helpcontent2
index 33e1d32..a5c501a 160000
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit 33e1d32da35c7eae844a798ecbb4df9dd1964769
+Subproject commit a5c501a84e0061e3316352f9ed5219419d9bc295
commit a3b3c5fcd7efd3e33a0f0078bd6fd23689c45c41
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jul 22 21:02:17 2016 +0100
Related: tdf#101057 inherit MalformedVersionException from std::exception
so we don't get std::terminate on MacOSX if its thrown up to
JavaVirtualMachine::getJavaVM
Change-Id: I1c6b79bf16cbaa66b8f79d495239e301d3ca58de
diff --git a/jvmfwk/inc/vendorbase.hxx b/jvmfwk/inc/vendorbase.hxx
index da8a3e7..8f4fab5 100644
--- a/jvmfwk/inc/vendorbase.hxx
+++ b/jvmfwk/inc/vendorbase.hxx
@@ -82,7 +82,7 @@ OpenJDK at least, but probably not true for Lemotes JDK */
#endif // SPARC, INTEL, POWERPC, MIPS, MIPS64, ARM, IA64, M68K, HPPA, ALPHA
-class MalformedVersionException
+class MalformedVersionException : public std::exception
{
public:
MalformedVersionException();
commit bfec304e86e8ffd258e99ffa3efbbfe1167486bc
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date: Tue Jul 12 22:10:20 2016 +0200
tdf#100842 qa unit test
test of text before after fraction, with or without integer
test of text before after and in the middle of scientific number
Change-Id: Ib4a1a722d4cf2350c73b1b721b4e77889dfc666c
Reviewed-on: https://gerrit.libreoffice.org/27172
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Laurent BP <laurent.balland-poirier at laposte.net>
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 6271a59..a1231b0 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -1114,6 +1114,17 @@ void Test::testUserDefinedNumberFormats()
sExpected = "2 6/16 inch";
checkPreviewString(aFormatter, sCode, 2.379, eLang, sExpected);
}
+ { // tdf#100842: text before/after fraction
+ sCode = "\"before \"?/?\" after\"";
+ sExpected = "before 11/9 after";
+ checkPreviewString(aFormatter, sCode, 1.2345667, eLang, sExpected);
+ sCode = "\"before \"# ?/?\" after\"";
+ sExpected = "before 1 2/9 after";
+ checkPreviewString(aFormatter, sCode, 1.2345667, eLang, sExpected);
+ sCode = "\"before \"0.0\"inside\"0E+0\"middle\"0\" after\"";
+ sExpected = "before 1.2inside3E+0middle4 after";
+ checkPreviewString(aFormatter, sCode, 12345.667, eLang, sExpected);
+ }
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
commit c2524387f3c26c3f0a01a2ce06a352429e27f87c
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date: Fri Jul 22 15:13:29 2016 +0200
sc: remove unused ScCloneFlags: Adjust3Drel and NoCaption
ScTokenArray::ReadjustRelative3DReferences() is unused now
and is removed too
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list