[Libreoffice-commits] core.git: Branch 'feature/skia' - 3789 commits - accessibility/inc accessibility/Library_acc.mk accessibility/source android/Bootstrap android/README android/source animations/source avmedia/source basctl/inc basctl/Library_basctl.mk basctl/source basctl/uiconfig basegfx/Library_basegfx.mk basegfx/source basegfx/test basic/inc basic/Library_sb.mk basic/qa basic/source bean/com binaryurp/source bin/check-elf-dynamic-objects bin/distro-install-file-lists bin/find-most-common-warn-messages.py bin/find-unneeded-includes bin/gbuild-to-ide bin/gla11y bin/lo-all-static-libs bin/moveglobalheaders.sh bin/oss-fuzz-build.sh bin/update_pch bin/update_pch.sh bridges/inc bridges/Library_cpp_uno.mk bridges/source canvas/source canvas/workben chart2/inc chart2/Library_chartcontroller.mk chart2/Library_chartcore.mk chart2/qa chart2/source chart2/uiconfig chart2/UIConfig_chart2.mk cli_ure/readme.txt cli_ure/source codemaker/source comphelper/CppunitTest_comphelper_parallelsort_test.mk comphel per/Library_comphelper.mk comphelper/Module_comphelper.mk comphelper/qa comphelper/source compilerplugins/clang compilerplugins/.gitignore compilerplugins/Makefile-clang.mk config.guess config_host/config_features.h.in config_host/config_global.h.in config_host/config_vclplug.h.in config_host.mk.in configmgr/IwyuFilter_configmgr.yaml configmgr/Library_configmgr.mk configmgr/qa configmgr/source configure.ac connectivity/Library_ado.mk connectivity/Library_calc.mk connectivity/Library_dbase.mk connectivity/Library_dbpool2.mk connectivity/Library_dbtools.mk connectivity/Library_file.mk connectivity/Library_firebird_sdbc.mk connectivity/Library_flat.mk connectivity/Library_mysql_jdbc.mk connectivity/Library_odbc.mk connectivity/Library_postgresql-sdbc-impl.mk connectivity/qa connectivity/README connectivity/source cppcanvas/Library_cppcanvas.mk cppcanvas/source cppuhelper/Library_cppuhelper.mk cppuhelper/qa cppuhelper/source cppu/source cpputools/Executable_uno.mk cui/CppunitTest_cui_di alogs_test.mk cui/inc cui/IwyuFilter_cui.yaml cui/Library_cui.mk cui/qa cui/source cui/uiconfig cui/UIConfig_cui.mk dbaccess/CppunitTest_dbaccess_tdf126268.mk dbaccess/Executable_odbcconfig.mk dbaccess/inc dbaccess/Library_dbahsql.mk dbaccess/Library_dba.mk dbaccess/Library_dbaxml.mk dbaccess/Library_dbmm.mk dbaccess/Library_dbu.mk dbaccess/Library_sdbt.mk dbaccess/Module_dbaccess.mk dbaccess/qa dbaccess/README dbaccess/source dbaccess/uiconfig dbaccess/UIConfig_dbaccess.mk desktop/Executable_minidump_upload.mk desktop/Executable_quickstart.mk desktop/Executable_sbase.mk desktop/Executable_scalc.mk desktop/Executable_sdraw.mk desktop/Executable_simpress.mk desktop/Executable_smath.mk desktop/Executable_soffice_bin.mk desktop/Executable_soffice_com.mk desktop/Executable_soffice_exe.mk desktop/Executable_sweb.mk desktop/Executable_swriter.mk desktop/Executable_unoinfo.mk desktop/Executable_unopkg_bin.mk desktop/Executable_unopkg_com.mk desktop/Executable_unopkg.mk desktop/inc desktop/ Library_deploymentgui.mk desktop/Library_deploymentmisc.mk desktop/Library_deployment.mk desktop/Library_sofficeapp.mk desktop/Pagein_common.mk desktop/qa desktop/scripts desktop/source desktop/StaticLibrary_winloader.mk desktop/test desktop/unx desktop/util desktop/win32 desktop/WinResTarget_sbase.mk desktop/WinResTarget_scalc.mk desktop/WinResTarget_sdraw.mk desktop/WinResTarget_simpress.mk desktop/WinResTarget_smath.mk desktop/WinResTarget_sofficebin.mk desktop/WinResTarget_soffice.mk desktop/WinResTarget_sweb.mk desktop/WinResTarget_swriter.mk dictionaries distro-configs/Jenkins distro-configs/LibreOfficeAndroidX86_64.conf distro-configs/LibreOfficeCoverity.conf distro-configs/LibreOfficeFlatpak.conf distro-configs/LibreOfficeiOS.conf distro-configs/LibreOfficeiOS_Sim.conf distro-configs/LibreOfficeLinux.conf distro-configs/LibreOfficeMacOSX.conf distro-configs/LibreOfficeOnline.conf distro-configs/LibreOfficeOpenBSD.conf distro-configs/LibreOfficeOssFuzz.conf download.lst drawi nglayer/Library_drawinglayer.mk drawinglayer/qa drawinglayer/source dtrans/source dtrans/test editeng/inc editeng/Library_editeng.mk editeng/qa editeng/source embeddedobj/CppunitTest_embeddedobj_general.mk embeddedobj/IwyuFilter_embeddedobj.yaml embeddedobj/Library_embobj.mk embeddedobj/Module_embeddedobj.mk embeddedobj/qa embeddedobj/source embedserv/source emfio/inc emfio/Library_emfio.mk emfio/qa emfio/source eventattacher/source extensions/Executable_twain32shim.mk extensions/inc extensions/Library_ldapbe2.mk extensions/Library_WinUserInfoBe.mk extensions/source extensions/test extensions/uiconfig external/boost external/breakpad external/cairo external/ct2n external/expat external/firebird external/gpgmepp external/harfbuzz external/icu external/libabw external/libcdr external/libcmis external/libebook external/libepubgen external/libetonyek external/libfreehand external/libgpg-error external/libmspub external/libmwaw external/libodfgen external/liborcus external/libpagemaker e xternal/libqxp external/librevenge external/libstaroffice external/libvisio external/libwps external/libzmf external/mdds external/Module_external.mk external/nss external/owncloud-android-lib external/pdfium external/postgresql external/qrcodegen external/redland external/skia extras/AllLangPackage_autotextshare.mk extras/CustomTarget_autotextshare.mk extras/CustomTarget_fontconfig.mk extras/Module_extras.mk extras/Package_fontconfig.mk extras/Package_palettes.mk extras/README extras/source filter/qa filter/README filter/source filter/uiconfig forms/Library_frm.mk forms/source formula/inc formula/source formula/uiconfig fpicker/inc fpicker/Library_fps_office.mk fpicker/source fpicker/uiconfig framework/dtd framework/inc framework/Library_fwe.mk framework/Library_fwi.mk framework/Library_fwk.mk framework/Library_fwl.mk framework/qa framework/source framework/uiconfig .git-blame-ignore-revs .github/FUNDING.yml helpcompiler/inc helpcompiler/source helpcontent2 hwpfilter/Library_hwp.mk hwpfilter/source i18nlangtag/source i18npool/inc i18npool/Library_localedata_en.mk i18npool/qa i18npool/source i18nutil/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_svg icon-themes/colibre icon-themes/colibre_svg icon-themes/elementary icon-themes/elementary_svg icon-themes/karasa_jaga icon-themes/karasa_jaga_svg icon-themes/sifr icon-themes/tango idlc/CustomTarget_parser_test.mk idlc/Executable_idlc.mk idlc/inc idlc/source idlc/test idl/inc idl/source include/animations include/basegfx include/basic include/canvas include/com include/comphelper include/connectivity include/cppcanvas include/cppuhelper include/dbaccess include/desktop include/drawinglayer include/editeng include/filter include/formula include/framework include/i18nlangtag include/i18npool include/i18nutil include/IwyuFilter_include.yaml include/jvmfwk include/LibreOfficeKit include/o3tl include/onlineupdate include/oox include/opencl include/osl include/package include/registry include/rtl i nclude/sal include/salhelper include/sax include/sfx2 include/store include/svl include/svtools include/svx include/test include/toolkit include/tools include/typelib include/ucbhelper include/uno include/unotest include/unotools include/vbahelper include/vcl include/xmloff include/xmlreader install-sh instsetoo_native/CustomTarget_install.mk instsetoo_native/CustomTarget_setup.mk instsetoo_native/inc_common instsetoo_native/inc_ooohelppack instsetoo_native/inc_openoffice instsetoo_native/inc_sdkoo ios/CustomTarget_iOS_setup.mk ios/LibreOfficeLight io/source io/test javaunohelper/com javaunohelper/test jurt/com jvmfwk/distributions jvmfwk/inc jvmfwk/plugins jvmfwk/source l10ntools/inc l10ntools/source libreofficekit/qa libreofficekit/source lingucomponent/source linguistic/Library_lng.mk linguistic/source logerrit lotuswordpro/inc lotuswordpro/Library_lwpft.mk lotuswordpro/source m4/l_atomic.m4 Makefile.fetch Makefile.in nlpsolver/src nlpsolver/ThirdParty o3tl/CompilerTest_o3tl_unsa fe_downcast.mk o3tl/Module_o3tl.mk o3tl/qa odk/build-examples_common.mk odk/docs odk/examples odk/Package_odk_headers.mk odk/settings odk/util offapi/com offapi/type_reference offapi/UnoApi_offapi.mk officecfg/registry onlineupdate/Executable_test_updater_dialog.mk onlineupdate/Executable_updater.mk onlineupdate/source oox/AllLangMoTarget_oox.mk oox/inc oox/Library_oox.mk oox/Module_oox.mk oox/README oox/source opencl/Executable_opencltest.mk opencl/inc opencl/opencltest opencl/source osx/soffice.xcodeproj package/inc package/Library_package2.mk package/Library_xstor.mk package/qa package/source pch/inc pch/Makefile pch/Module_pch.mk pch/README pch/StaticLibrary_precompiled_system.mk pch/system_empty.cxx postprocess/CppunitTest_services.mk postprocess/CustomTarget_fontconfig.mk postprocess/CustomTarget_signing.mk postprocess/Module_postprocess.mk postprocess/Package_fontconfig.mk postprocess/qa postprocess/Rdb_services.mk postprocess/signing pyuno/demo pyuno/Executable_python.mk pyu no/inc pyuno/source qadevOOo/objdsc qadevOOo/runner qadevOOo/tests readlicense_oo/docs readlicense_oo/license README.md registry/Executable_regmerge.mk registry/Executable_regview.mk registry/source registry/test remotebridges/source reportbuilder/java reportdesign/inc reportdesign/Library_rpt.mk reportdesign/Library_rptui.mk reportdesign/Library_rptxml.mk reportdesign/qa reportdesign/source reportdesign/uiconfig RepositoryExternal.mk Repository.mk RepositoryModule_host.mk ridljar/com sal/inc sal/Library_sal.mk sal/osl sal/qa sal/rtl sal/test sal/textenc sax/CppunitTest_sax_attributes.mk sax/CppunitTest_sax.mk sax/CppunitTest_sax_parser.mk sax/CppunitTest_sax_xmlimport.mk sax/inc sax/IwyuFilter_sax.yaml sax/Library_expwrap.mk sax/Library_sax.mk sax/qa sax/source scaddins/Library_analysis.mk scaddins/Library_date.mk scaddins/Library_pricing.mk scaddins/source sccomp/source sc/CppunitTest_sc_addin_functions_test.mk sc/CppunitTest_sc_anchor_test.mk sc/CppunitTest_sc_annotationobj.mk sc /CppunitTest_sc_annotationshapeobj.mk sc/CppunitTest_sc_annotationsobj.mk sc/CppunitTest_sc_arealinkobj.mk sc/CppunitTest_sc_arealinksobj.mk sc/CppunitTest_sc_array_functions_test.mk sc/CppunitTest_sc_autoformatobj.mk sc/CppunitTest_sc_autoformatsobj.mk sc/CppunitTest_sc_bugfix_test.mk sc/CppunitTest_sc_cache_test.mk sc/CppunitTest_sc_cellcursorobj.mk sc/CppunitTest_sc_cellfieldsobj.mk sc/CppunitTest_sc_cellformatsenumeration.mk sc/CppunitTest_sc_cellformatsobj.mk sc/CppunitTest_sc_cellobj.mk sc/CppunitTest_sc_cellrangeobj.mk sc/CppunitTest_sc_cellrangesobj.mk sc/CppunitTest_sc_cellsearchobj.mk sc/CppunitTest_sc_cellsenumeration.mk sc/CppunitTest_sc_cellsobj.mk sc/CppunitTest_sc_chart2dataprovider.mk sc/CppunitTest_sc_chartobj.mk sc/CppunitTest_sc_chart_regression_test.mk sc/CppunitTest_sc_chartsobj.mk sc/CppunitTest_sc_check_data_pilot_field.mk sc/CppunitTest_sc_check_data_pilot_table.mk sc/CppunitTest_sc_check_xcell_ranges_query.mk sc/CppunitTest_sc_cond_format_merge.mk sc/Cppunit Test_sc_consolidationdescriptorobj.mk sc/CppunitTest_sc_copypaste.mk sc/CppunitTest_sc_core.mk sc/CppunitTest_sc_database_functions_test.mk sc/CppunitTest_sc_databaserangeobj.mk sc/CppunitTest_sc_databaserangesobj.mk sc/CppunitTest_sc_datapilotfieldgroupitemobj.mk sc/CppunitTest_sc_datapilotfieldgroupobj.mk sc/CppunitTest_sc_datapilotfieldgroupsobj.mk sc/CppunitTest_sc_datapilotfieldobj.mk sc/CppunitTest_sc_datapilotfieldsobj.mk sc/CppunitTest_sc_datapilotitemobj.mk sc/CppunitTest_sc_datapilotitemsobj.mk sc/CppunitTest_sc_datapilottableobj.mk sc/CppunitTest_sc_datapilottablesobj.mk sc/CppunitTest_sc_dataprovider.mk sc/CppunitTest_sc_datatransformation.mk sc/CppunitTest_sc_datetime_functions_test.mk sc/CppunitTest_sc_ddelinkobj.mk sc/CppunitTest_sc_ddelinksobj.mk sc/CppunitTest_sc_documentconfigurationobj.mk sc/CppunitTest_sc_drawpageobj.mk sc/CppunitTest_sc_drawpagesobj.mk sc/CppunitTest_sc_editfieldobj_cell.mk sc/CppunitTest_sc_editfieldobj_header.mk sc/CppunitTest_sc_filterdescrip torbase.mk sc/CppunitTest_sc_filters_test.mk sc/CppunitTest_sc_financial_functions_test.mk sc/CppunitTest_sc_functiondescriptionobj.mk sc/CppunitTest_sc_functionlistobj.mk sc/CppunitTest_sc_functions_test_old.mk sc/CppunitTest_sc_headerfieldsobj.mk sc/CppunitTest_sc_headerfootercontentobj.mk sc/CppunitTest_sc_html_export_test.mk sc/CppunitTest_sc_importdescriptorbaseobj.mk sc/CppunitTest_sc_indexenumeration_cellannotationsenumeration.mk sc/CppunitTest_sc_indexenumeration_cellarealinksenumeration.mk sc/CppunitTest_sc_indexenumeration_databaserangesenumeration.mk sc/CppunitTest_sc_indexenumeration_datapilotfieldsenumeration.mk sc/CppunitTest_sc_indexenumeration_datapilotitemsenumeration.mk sc/CppunitTest_sc_indexenumeration_datapilottablesenumeration.mk sc/CppunitTest_sc_indexenumeration_ddelinksenumeration.mk sc/CppunitTest_sc_indexenumeration_functiondescriptionenumeration.mk sc/CppunitTest_sc_indexenumeration_labelrangesenumeration.mk sc/CppunitTest_sc_indexenumeration_namedrangese numeration.mk sc/CppunitTest_sc_indexenumeration_scenariosenumeration.mk sc/CppunitTest_sc_indexenumeration_sheetcellrangesenumeration.mk sc/CppunitTest_sc_indexenumeration_sheetlinksenumeration.mk sc/CppunitTest_sc_indexenumeration_spreadsheetsenumeration.mk sc/CppunitTest_sc_indexenumeration_spreadsheetviewpanesenumeration.mk sc/CppunitTest_sc_indexenumeration_subtotalfieldsenumeration.mk sc/CppunitTest_sc_indexenumeration_tableautoformatenumeration.mk sc/CppunitTest_sc_indexenumeration_tablechartsenumeration.mk sc/CppunitTest_sc_indexenumeration_tablecolumnsenumeration.mk sc/CppunitTest_sc_indexenumeration_tableconditionalentryenumeration.mk sc/CppunitTest_sc_indexenumeration_tablerowsenumeration.mk sc/CppunitTest_sc_indexenumeration_textfieldenumeration.mk sc/CppunitTest_sc_information_functions_test.mk sc/CppunitTest_sc_labelrangeobj.mk sc/CppunitTest_sc_labelrangesobj.mk sc/CppunitTest_sc_logical_functions_test.mk sc/CppunitTest_sc_macros_test.mk sc/CppunitTest_sc_mark_test.mk sc/CppunitTest_sc_mathematical_functions_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/CppunitTest_sc_outlineobj.mk sc/CppunitTest_sc_parallelism.mk sc/CppunitTest_sc_pdf_export.mk sc/CppunitTest_sc_perfobj.mk sc/CppunitTest_sc_pivottable_filters_test.mk sc/CppunitTest_sc_rangelst_test.mk sc/CppunitTest_sc_range_test.mk sc/CppunitTest_sc_recentfunctionsobj.mk sc/CppunitTest_sc_recordchanges.mk sc/CppunitTest_sc_scenariosobj.mk sc/CppunitTest_sc_screenshots.mk sc/CppunitTest_sc_shapeobj.mk sc/CppunitTest_sc_sheetlinkobj.mk sc/CppunitTest_sc_sheetlinksobj.mk sc/CppunitTest_sc_sortdescriptorbaseobj.mk sc/CppunitTest_sc_spreadsheet_functions_test.mk sc/CppunitTest_sc_spreadsheetsettings.mk sc/CppunitTest_sc_spreadsheetsettingsobj.mk sc/CppunitTest_sc_statistical_functions_test.mk sc/CppunitTest_sc_stylefamiliesobj.mk sc/CppunitTest_sc_stylefamilyob j.mk sc/CppunitTest_sc_subsequent_export_test.mk sc/CppunitTest_sc_subsequent_filters_test.mk sc/CppunitTest_sc_subtotaldescriptorbase.mk sc/CppunitTest_sc_subtotalfieldobj.mk sc/CppunitTest_sc_tablecolumnobj.mk sc/CppunitTest_sc_tablecolumnsobj.mk sc/CppunitTest_sc_tableconditionalentryobj.mk sc/CppunitTest_sc_tableconditionalformat.mk sc/CppunitTest_sc_tablerowobj.mk sc/CppunitTest_sc_tablerowsobj.mk sc/CppunitTest_sc_tablesheetobj.mk sc/CppunitTest_sc_tablesheetsobj.mk sc/CppunitTest_sc_tablevalidationobj.mk sc/CppunitTest_sc_tabviewobj.mk sc/CppunitTest_sc_text_functions_test.mk sc/CppunitTest_sc_tiledrendering.mk sc/CppunitTest_sc_ucalc.mk sc/CppunitTest_sc_uniquecellformatsenumeration.mk sc/CppunitTest_sc_uniquecellformatsobj.mk sc/CppunitTest_sc_viewpaneobj.mk schema/libreoffice sc/inc sc/IwyuFilter_sc.yaml sc/Library_scd.mk sc/Library_scfilt.mk sc/Library_sc.mk sc/Library_scqahelper.mk sc/Library_scui.mk sc/Library_vbaobj.mk sc/Module_sc.mk scp2/AutoInstall.mk scp2/InstallMo dule_spsupp.mk scp2/InstallScript_setup_osl.mk scp2/Module_scp2.mk scp2/source sc/qa sc/README scripting/Jar_ScriptFramework.mk scripting/java scripting/README scripting/source sc/sdi sc/source sc/uiconfig sc/UIConfig_scalc.mk sc/UITest_calc_dialogs.mk sc/UITest_calc_tests9.mk sd/CppunitTest_sd_activex_controls_tests.mk sd/CppunitTest_sd_dialogs_test.mk 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_import_tests_smartart.mk sd/CppunitTest_sd_misc_tests.mk sd/CppunitTest_sd_svg_export_tests.mk sd/CppunitTest_sd_tiledrendering.mk sd/CppunitTest_sd_uiimpress.mk sd/CppunitTest_sd_uimpress.mk sdext/Executable_xpdfimport.mk sdext/Library_PresentationMinimizer.mk sdext/Library_PresenterScreen.mk sdext/source sd/inc sd/IwyuFilter_sd.yaml sd/Library_sdd.mk sd/Library_sdfilt.mk sd/Library_sd.mk sd/Library_sdui.mk sd/qa sd/sdi sd/source sd/uiconfig sd/UIConfig_sdraw.mk sd/UIConfig_simpress.mk sd/workben setup_native/scripts setup_native/source sfx2/classification sfx2/inc sfx2/Library_sfx.mk sfx2/qa sfx2/sdi sfx2/source sfx2/uiconfig shell/Executable_senddoc.mk shell/Executable_spsupp_helper.mk shell/inc shell/Library_kde5be.mk shell/Library_kf5be.mk shell/Module_shell.mk shell/qa shell/source slideshow/CppunitTest_slideshow.mk slideshow/Executable_demoshow.mk slideshow/Library_slideshow.mk slideshow/manifest.txt slideshow/Module_slideshow.mk slideshow/source slideshow/test smoketest/com solenv/bin solenv/clang-format solenv/CompilerTest_compilerplugins_clang.mk solenv/doc solenv/flatpak-manifest.in solenv/gbuild solenv/gbuildtojson solenv/gdb solenv/inc solenv/maven solenv/PythonTest_solenv_python.mk solenv/qa solenv/sanitizers solenv/vs soltools/cpp soltools/mkdepend sot/Library_sot.mk sot/source starmath/CppunitTest_starmath_qa_cppunit.mk starmath/inc starmath/Library_sm.mk starmath/qa sta rmath/source starmath/uiconfig stoc/CppunitTest_stoc_uriproc.mk stoc/Library_bootstrap.mk stoc/Module_stoc.mk stoc/source stoc/test svgio/inc svgio/Library_svgio.mk svgio/qa svgio/source svl/IwyuFilter_svl.yaml svl/Library_svl.mk svl/qa svl/source svl/unx svtools/inc svtools/IwyuFilter_svtools.yaml svtools/Library_svt.mk svtools/Module_svtools.mk svtools/qa svtools/source svtools/uiconfig svtools/UIConfig_svt.mk svx/Executable_gengal.mk svx/inc svx/Library_svxcore.mk svx/Library_svx.mk svx/qa svx/sdi svx/source svx/uiconfig sw/CppunitTest_sw_accessible_relation_set.mk sw/CppunitTest_sw_apitests.mk sw/CppunitTest_sw_dialogs_test_2.mk sw/CppunitTest_sw_dialogs_test.mk sw/CppunitTest_sw_docbookexport.mk sw/CppunitTest_sw_filters_test2.mk sw/CppunitTest_sw_filters_test.mk sw/CppunitTest_sw_fodfexport.mk sw/CppunitTest_sw_globalfilter.mk sw/CppunitTest_sw_htmlexport.mk sw/CppunitTest_sw_htmlimport.mk sw/CppunitTest_sw_layoutwriter.mk sw/CppunitTest_sw_macros_test.mk sw/CppunitTest_sw_mai lmerge.mk sw/CppunitTest_sw_odfexport.mk sw/CppunitTest_sw_odfimport.mk sw/CppunitTest_sw_ooxmlencryption.mk sw/CppunitTest_sw_ooxmlexport8.mk sw/CppunitTest_sw_ooxmlfieldexport.mk sw/CppunitTest_sw_ooxmlimport2.mk sw/CppunitTest_sw_ooxmlimport.mk sw/CppunitTest_sw_ooxmllinks.mk sw/CppunitTest_sw_ooxmlw14export.mk sw/CppunitTest_sw_rtfexport2.mk sw/CppunitTest_sw_rtfexport3.mk sw/CppunitTest_sw_rtfexport4.mk sw/CppunitTest_sw_rtfexport5.mk sw/CppunitTest_sw_rtfexport.mk sw/CppunitTest_sw_rtfimport.mk sw/CppunitTest_sw_tiledrendering.mk sw/CppunitTest_sw_txtexport.mk sw/CppunitTest_sw_uibase_unit.mk sw/CppunitTest_sw_uiwriter.mk sw/CppunitTest_sw_unowriter.mk sw/CppunitTest_sw_uwriter.mk sw/CppunitTest_sw_ww8export2.mk sw/CppunitTest_sw_ww8export3.mk sw/CppunitTest_sw_ww8export.mk sw/CppunitTest_sw_ww8import.mk sw/CppunitTest_sw_xhtmlexport.mk swext/mediawiki sw/inc sw/IwyuFilter_sw.yaml sw/Library_msword.mk sw/Library_swd.mk sw/Library_sw.mk sw/Library_swui.mk sw/Library_vbaswobj.mk sw/Module_sw.mk sw/ooxmlexport_setup.mk sw/PythonTest_sw_python.mk sw/qa sw/sdi sw/source sw/uiconfig sw/UIConfig_swriter.mk sw/UITest_writer_dialogs.mk sw/UITest_writer_macro_tests.mk sysui/CustomTarget_share.mk sysui/desktop sysui/Package_infoplist.mk test/source testtools/source toolkit/inc toolkit/IwyuFilter_toolkit.yaml toolkit/qa toolkit/source toolkit/test tools/CppunitTest_tools_test.mk tools/Library_tl.mk tools/qa tools/source translations ucbhelper/source ucb/IwyuFilter_ucb.yaml ucb/qa ucb/source udkapi/com udkapi/type_reference uitest/calc_tests uitest/demo_ui uitest/libreoffice uitest/test_main.py uitest/ui_logger_dsl uitest/uitest uitest/writer_tests UnoControls/source unodevtools/source unoidl/source unotest/source unotools/Library_utl.mk unotools/source unoxml/Library_unoxml.mk unoxml/qa unoxml/source uui/inc uui/Library_uui.mk uui/source vbahelper/Library_msforms.mk vbahelper/Library_vbahelper.mk vbahelper/source vcl/backendtest vcl/commonfuzzer.mk vcl/CppunitTest_v cl_bitmap_test.mk vcl/CppunitTest_vcl_fontmetric.mk vcl/CppunitTest_vcl_graphic_test.mk vcl/CppunitTest_vcl_timer.mk vcl/CustomTarget_kde5_moc.mk vcl/CustomTarget_kf5_moc.mk vcl/Executable_lo_kde5filepicker.mk vcl/Executable_ui-previewer.mk vcl/Executable_xid_fullscreen_on_all_monitors.mk vcl/headless vcl/inc vcl/ios vcl/IwyuFilter_vcl.yaml vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/Library_vclplug_gtk3_kde5.mk vcl/Library_vclplug_gtk3.mk vcl/Library_vclplug_gtk.mk vcl/Library_vclplug_kde5.mk vcl/Library_vclplug_kf5.mk vcl/Library_vclplug_win.mk vcl/Module_vcl.mk vcl/opengl vcl/osx vcl/Package_osxres.mk vcl/qa vcl/qt5 vcl/quartz vcl/README vcl/README.lifecycle vcl/README.scheduler vcl/README.vars vcl/skia vcl/source vcl/StaticLibrary_fuzzerstubs.mk vcl/uiconfig vcl/UIConfig_vcl.mk vcl/unx vcl/win vcl/workben winaccessibility/source wizards/com wizards/Package_access2base.mk wizards/source writerfilter/documentation writerfilter/inc writerfilter/Library_writerfilter.mk writerf ilter/source writerperfect/inc writerperfect/Library_wpftwriter.mk writerperfect/qa writerperfect/source xmerge/source xmlhelp/IwyuFilter_xmlhelp.yaml xmlhelp/source xmloff/dtd xmloff/inc xmloff/IwyuFilter_xmloff.yaml xmloff/Library_xof.mk xmloff/Library_xo.mk xmloff/qa xmloff/source xmloff/util xmlreader/source xmlscript/Library_xmlscript.mk xmlscript/source xmlsecurity/CppunitTest_xmlsecurity_signing.mk xmlsecurity/inc xmlsecurity/Library_xmlsecurity.mk xmlsecurity/Library_xsec_xmlsec.mk xmlsecurity/qa xmlsecurity/source xmlsecurity/test_docs xmlsecurity/uiconfig
Luboš Luňák (via logerrit)
logerrit at kemper.freedesktop.org
Sat Oct 12 18:11:55 UTC 2019
Rebased ref, commits from common ancestor:
commit 232b08684b199720f9fb3d06873aab589aad879f
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Oct 8 12:19:18 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 20:04:47 2019 +0200
initial implementation of Skia drawing on screen in Windows
Change-Id: I1562bd2cfd1862947042bef3343aefd851a65002
diff --git a/external/skia/make-api-visible.patch b/external/skia/make-api-visible.patch
index d2c3b1f794e3..45f4ee44ae71 100644
--- a/external/skia/make-api-visible.patch
+++ b/external/skia/make-api-visible.patch
@@ -15,3 +15,23 @@
} // namespace window_context_factory
+--- skia/tools/sk_app/win/WindowContextFactory_win.h
++++ skia/tools/sk_app/win/WindowContextFactory_win.h
+@@ -18,13 +18,13 @@ struct DisplayParams;
+
+ namespace window_context_factory {
+
+-WindowContext* NewVulkanForWin(HWND, const DisplayParams&);
++SK_API WindowContext* NewVulkanForWin(HWND, const DisplayParams&);
+
+-WindowContext* NewGLForWin(HWND, const DisplayParams&);
++SK_API WindowContext* NewGLForWin(HWND, const DisplayParams&);
+
+-WindowContext* NewANGLEForWin(HWND, const DisplayParams&);
++SK_API WindowContext* NewANGLEForWin(HWND, const DisplayParams&);
+
+-WindowContext* NewRasterForWin(HWND, const DisplayParams&);
++SK_API WindowContext* NewRasterForWin(HWND, const DisplayParams&);
+
+ } // namespace window_context_factory
+
diff --git a/vcl/Library_vclplug_win.mk b/vcl/Library_vclplug_win.mk
index f64cc0392d13..a2979674d00a 100644
--- a/vcl/Library_vclplug_win.mk
+++ b/vcl/Library_vclplug_win.mk
@@ -55,10 +55,12 @@ $(eval $(call gb_Library_use_externals,vclplug_win,\
epoxy \
glm_headers \
harfbuzz \
+ skia \
))
$(eval $(call gb_Library_add_exception_objects,vclplug_win,\
vcl/opengl/win/gdiimpl \
+ vcl/skia/win/gdiimpl \
vcl/win/app/saldata \
vcl/win/app/salinfo \
vcl/win/app/salinst \
diff --git a/vcl/inc/skia/win/gdiimpl.hxx b/vcl/inc/skia/win/gdiimpl.hxx
new file mode 100644
index 000000000000..621d8d4b4a78
--- /dev/null
+++ b/vcl/inc/skia/win/gdiimpl.hxx
@@ -0,0 +1,54 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_VCL_INC_SKIA_WIN_GDIIMPL_HXX
+#define INCLUDED_VCL_INC_SKIA_WIN_GDIIMPL_HXX
+
+#include <memory>
+#include <vcl/dllapi.h>
+
+#include <skia/gdiimpl.hxx>
+#include <win/salgdi.h>
+
+class ControlCacheKey;
+namespace sk_app
+{
+class WindowContext;
+}
+
+class WinSkiaSalGraphicsImpl : public SkiaSalGraphicsImpl
+{
+private:
+ WinSalGraphics& mWinParent;
+
+public:
+ WinSkiaSalGraphicsImpl(WinSalGraphics& rGraphics, SalGeometryProvider* mpProvider);
+
+ virtual void Init() override;
+ virtual void DeInit() override;
+ virtual void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override;
+
+ virtual void freeResources() override;
+
+ bool TryRenderCachedNativeControl(ControlCacheKey const& rControlCacheKey, int nX, int nY);
+
+ bool RenderAndCacheNativeControl(OpenGLCompatibleDC& rWhite, OpenGLCompatibleDC& rBlack, int nX,
+ int nY, ControlCacheKey& aControlCacheKey);
+
+protected:
+ virtual void createSurface() override;
+ virtual void performFlush() override;
+
+private:
+ std::unique_ptr<sk_app::WindowContext> mWindowContext;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx
new file mode 100644
index 000000000000..0763334f0ebf
--- /dev/null
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -0,0 +1,103 @@
+/* -*- 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 <skia/win/gdiimpl.hxx>
+
+#include <tools/sk_app/win/WindowContextFactory_win.h>
+#include <tools/sk_app/WindowContext.h>
+
+WinSkiaSalGraphicsImpl::WinSkiaSalGraphicsImpl(WinSalGraphics& rGraphics,
+ SalGeometryProvider* mpProvider)
+ : SkiaSalGraphicsImpl(rGraphics, mpProvider)
+ , mWinParent(rGraphics)
+{
+}
+
+void WinSkiaSalGraphicsImpl::copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics)
+{
+ (void)rPosAry;
+ (void)pSrcGraphics;
+ // TODO
+}
+
+void WinSkiaSalGraphicsImpl::Init()
+{
+#if 0 // TODO
+ if (!IsOffscreen() && mpContext.is() && mpContext->isInitialized())
+ {
+ const GLWinWindow& rGLWindow = static_cast<const GLWinWindow&>(mpContext->getOpenGLWindow());
+ if (rGLWindow.hWnd != mrWinParent.mhWnd || rGLWindow.hDC == mrWinParent.mhLocalDC)
+ {
+ // This can legitimately happen, SalFrame keeps 2x
+ // SalGraphics which share the same hWnd and hDC.
+ // The shape 'Area' dialog does reparenting to trigger this.
+ SAL_WARN("vcl.opengl", "Unusual: Windows handle / DC changed without DeInit");
+ DeInit();
+ }
+ }
+#endif
+ SkiaSalGraphicsImpl::Init();
+}
+
+void WinSkiaSalGraphicsImpl::createSurface()
+{
+ if (isOffscreen())
+ return SkiaSalGraphicsImpl::createSurface();
+ if (GetWidth() == 0 || GetHeight() == 0)
+ {
+ // When created, Init() gets called with size (0,0), which is invalid size
+ // for Skia. So fake a surface, Init() will get called later again with the correct size.
+ mSurface = SkSurface::MakeRasterN32Premul(1, 1);
+ return;
+ }
+ sk_app::DisplayParams displayParams;
+ mWindowContext.reset(
+ sk_app::window_context_factory::NewRasterForWin(mWinParent.gethWnd(), displayParams));
+ assert(SkToBool(mWindowContext)); // TODO
+ mSurface = mWindowContext->getBackbufferSurface();
+ assert(mSurface.get());
+}
+
+void WinSkiaSalGraphicsImpl::DeInit()
+{
+ mWindowContext.reset();
+ SkiaSalGraphicsImpl::DeInit();
+}
+
+void WinSkiaSalGraphicsImpl::freeResources() {}
+
+void WinSkiaSalGraphicsImpl::performFlush()
+{
+ if (mWindowContext)
+ mWindowContext->swapBuffers();
+}
+
+bool WinSkiaSalGraphicsImpl::TryRenderCachedNativeControl(ControlCacheKey const& rControlCacheKey,
+ int nX, int nY)
+{
+ (void)rControlCacheKey;
+ (void)nX;
+ (void)nY;
+ return false; // TODO
+}
+
+// TODO OpenGLCompatibleDC?
+bool WinSkiaSalGraphicsImpl::RenderAndCacheNativeControl(OpenGLCompatibleDC& rWhite,
+ OpenGLCompatibleDC& rBlack, int nX, int nY,
+ ControlCacheKey& aControlCacheKey)
+{
+ (void)rWhite;
+ (void)rBlack;
+ (void)nX;
+ (void)nY;
+ (void)aControlCacheKey;
+ return false; // TODO
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 2c68ec354bf2..09e96e49abe2 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -32,11 +32,13 @@
#include <vcl/inputtypes.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
#include <vcl/opengl/OpenGLContext.hxx>
+#include <vcl/skia/SkiaHelper.hxx>
#include <vcl/timer.hxx>
#include <vclpluginapi.h>
#include <opengl/salbmp.hxx>
#include <opengl/win/gdiimpl.hxx>
+#include <skia/salbmp.hxx>
#include <win/wincomp.hxx>
#include <win/salids.hrc>
#include <win/saldata.hxx>
@@ -966,7 +968,9 @@ SalTimer* WinSalInstance::CreateSalTimer()
std::shared_ptr<SalBitmap> WinSalInstance::CreateSalBitmap()
{
- if (OpenGLHelper::isVCLOpenGLEnabled())
+ if (SkiaHelper::isVCLSkiaEnabled())
+ return std::make_shared<SkiaSalBitmap>();
+ else if (OpenGLHelper::isVCLOpenGLEnabled())
return std::make_shared<OpenGLSalBitmap>();
else
return std::make_shared<WinSalBitmap>();
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index b09c6848a58d..45f6e7722b0d 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -781,6 +781,7 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
static BYTE nDefaultQuality = NONANTIALIASED_QUALITY;
if (nDefaultQuality == NONANTIALIASED_QUALITY)
{
+ // TODO SKIA
if (OpenGLWrapper::isVCLOpenGLEnabled())
nDefaultQuality = ANTIALIASED_QUALITY;
else
diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index 2d4a283bb818..19553f415eee 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -35,8 +35,10 @@
#include <salgdiimpl.hxx>
#include "gdiimpl.hxx"
#include <opengl/win/gdiimpl.hxx>
+#include <skia/win/gdiimpl.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
+#include <vcl/skia/SkiaHelper.hxx>
#define DITHER_PAL_DELTA 51
@@ -619,7 +621,9 @@ WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hW
mpStdClipRgnData(nullptr),
mnPenWidth(GSL_PEN_WIDTH)
{
- if (OpenGLHelper::isVCLOpenGLEnabled() && !mbPrinter)
+ if (SkiaHelper::isVCLSkiaEnabled() && !mbPrinter)
+ mpImpl.reset(new WinSkiaSalGraphicsImpl(*this, pProvider));
+ else if (OpenGLHelper::isVCLOpenGLEnabled() && !mbPrinter)
mpImpl.reset(new WinOpenGLSalGraphicsImpl(*this, pProvider));
else
mpImpl.reset(new WinSalGraphicsImpl(*this));
diff --git a/vcl/win/gdi/salgdi2.cxx b/vcl/win/gdi/salgdi2.cxx
index 9c8e9845ff91..795cc4d08284 100644
--- a/vcl/win/gdi/salgdi2.cxx
+++ b/vcl/win/gdi/salgdi2.cxx
@@ -39,6 +39,7 @@
#include <outdata.hxx>
#include <salgdiimpl.hxx>
#include <opengl/win/gdiimpl.hxx>
+#include <skia/win/gdiimpl.hxx>
bool WinSalGraphics::supportsOperation( OutDevSupportType eType ) const
@@ -168,6 +169,7 @@ void convertToWinSalBitmap(SalBitmap& rSalBitmap, WinSalBitmap& rWinSalBitmap)
void WinSalGraphics::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap)
{
if (dynamic_cast<WinOpenGLSalGraphicsImpl*>(mpImpl.get()) == nullptr &&
+ dynamic_cast<WinSkiaSalGraphicsImpl*>(mpImpl.get()) == nullptr &&
dynamic_cast<const WinSalBitmap*>(&rSalBitmap) == nullptr)
{
std::unique_ptr<WinSalBitmap> pWinSalBitmap(new WinSalBitmap());
@@ -186,6 +188,7 @@ void WinSalGraphics::drawBitmap( const SalTwoRect& rPosAry,
const SalBitmap& rSTransparentBitmap )
{
if (dynamic_cast<WinOpenGLSalGraphicsImpl*>(mpImpl.get()) == nullptr &&
+ dynamic_cast<WinSkiaSalGraphicsImpl*>(mpImpl.get()) == nullptr &&
dynamic_cast<const WinSalBitmap*>(&rSSalBitmap) == nullptr)
{
std::unique_ptr<WinSalBitmap> pWinSalBitmap(new WinSalBitmap());
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx
index 84a9bda35ec3..a4b6640ca88d 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -1159,6 +1159,7 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
tools::Rectangle cacheRect = rControlRegion;
Size keySize = cacheRect.GetSize();
+ // TODO SKIA
WinOpenGLSalGraphicsImpl* pImpl = dynamic_cast<WinOpenGLSalGraphicsImpl*>(mpImpl.get());
// tdf#95618 - A few controls render outside the region they're given.
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index b67f191c0b47..9c89a240ead0 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -434,6 +434,7 @@ bool WinSalGraphics::DrawCachedGlyphs(const GenericSalLayout& rLayout)
COLORREF color = GetTextColor(hDC);
Color salColor(GetRValue(color), GetGValue(color), GetBValue(color));
+ // TODO SKIA
WinOpenGLSalGraphicsImpl *pImpl = dynamic_cast<WinOpenGLSalGraphicsImpl*>(mpImpl.get());
if (!pImpl)
return false;
@@ -475,6 +476,7 @@ void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
const WinFontInstance* pWinFont = static_cast<const WinFontInstance*>(&rLayout.GetFont());
const HFONT hLayoutFont = pWinFont->GetHFONT();
+ // TODO SKIA
bool bUseOpenGL = OpenGLHelper::isVCLOpenGLEnabled() && !mbPrinter;
// Our DirectWrite renderer is incomplete, skip it for vertical text where glyphs are not
@@ -523,6 +525,7 @@ void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
tools::Rectangle aRect;
rLayout.GetBoundRect(aRect);
+ // TODO SKIA
WinOpenGLSalGraphicsImpl *pImpl = dynamic_cast<WinOpenGLSalGraphicsImpl*>(mpImpl.get());
if (pImpl)
commit d0653e9cf389b70f4058ad02726cd1f6d3ff3a07
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Oct 8 11:47:17 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 20:03:38 2019 +0200
make WinSalVirtualDevice::SetSize() always call Init() for all Impl's
I don't see why this should be OpenGL-only. For WinSalGraphicsImpl
it's a no-op anyway, and for other Impl's it may be useful to find
out that they have been in fact resized. For Skia this is necessary
because Init() the first time may get called with empty size.
Change-Id: I4a8fa0fc633b415735d3633e89f208ab1c1f1229
diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx
index 57ad9581b1c4..e1cacb8b098a 100644
--- a/vcl/win/gdi/salvd.cxx
+++ b/vcl/win/gdi/salvd.cxx
@@ -218,12 +218,7 @@ bool WinSalVirtualDevice::SetSize( long nDX, long nDY )
mhBmp.reset(hNewBmp);
if (mpGraphics)
- {
- WinOpenGLSalGraphicsImpl *pImpl;
- pImpl = dynamic_cast< WinOpenGLSalGraphicsImpl * >(mpGraphics->GetImpl());
- if (pImpl)
- pImpl->Init();
- }
+ mpGraphics->GetImpl()->Init();
return true;
}
commit 940d6e6df7f43ea976ba01b15adc3e024c957afd
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Oct 7 12:40:02 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:59:36 2019 +0200
make X11/Skia render to screen using Skia code
Change-Id: I3056afe2ba0a15e0798d209ab9bd833c773948be
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index 0caa70b5a557..96bc628e1dd6 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -197,6 +197,8 @@ public:
#endif
protected:
+ virtual void createSurface();
+
void setProvider(SalGeometryProvider* provider) { mProvider = provider; }
bool isOffscreen() const { return mProvider == nullptr || mProvider->IsOffScreen(); }
diff --git a/vcl/inc/skia/x11/gdiimpl.hxx b/vcl/inc/skia/x11/gdiimpl.hxx
index 5af02c377a63..8797fb583ab8 100644
--- a/vcl/inc/skia/x11/gdiimpl.hxx
+++ b/vcl/inc/skia/x11/gdiimpl.hxx
@@ -16,6 +16,11 @@
#include <unx/x11/x11gdiimpl.h>
#include <skia/gdiimpl.hxx>
+namespace sk_app
+{
+class WindowContext;
+}
+
class VCL_PLUGIN_PUBLIC X11SkiaSalGraphicsImpl : public SkiaSalGraphicsImpl, public X11GraphicsImpl
{
private:
@@ -26,14 +31,15 @@ public:
virtual ~X11SkiaSalGraphicsImpl() override;
virtual void Init() override;
+ virtual void DeInit() override;
virtual void freeResources() override;
protected:
+ virtual void createSurface() override;
virtual void performFlush() override;
private:
- GC getGC();
- GC mCopyGc;
+ std::unique_ptr<sk_app::WindowContext> mWindowContext;
};
#endif // INCLUDED_VCL_INC_SKIA_X11_GDIIMPL_HXX
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 07937c6b9cb0..c9936d675d66 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -67,8 +67,7 @@ SkiaSalGraphicsImpl::~SkiaSalGraphicsImpl() {}
void SkiaSalGraphicsImpl::Init()
{
- // TODO
- mSurface = SkSurface::MakeRasterN32Premul(GetWidth(), GetHeight());
+ createSurface();
mSurface->getCanvas()->save(); // see SetClipRegion()
mClipRegion = vcl::Region(tools::Rectangle(0, 0, GetWidth(), GetHeight()));
@@ -76,6 +75,12 @@ void SkiaSalGraphicsImpl::Init()
mFlush->SetPriority(TaskPriority::POST_PAINT);
}
+void SkiaSalGraphicsImpl::createSurface()
+{
+ // TODO
+ mSurface = SkSurface::MakeRasterN32Premul(GetWidth(), GetHeight());
+}
+
void SkiaSalGraphicsImpl::DeInit() { mSurface.reset(); }
static SkIRect toSkIRect(const tools::Rectangle& rectangle)
diff --git a/vcl/skia/x11/gdiimpl.cxx b/vcl/skia/x11/gdiimpl.cxx
index 93068721ae5a..778581050124 100644
--- a/vcl/skia/x11/gdiimpl.cxx
+++ b/vcl/skia/x11/gdiimpl.cxx
@@ -18,10 +18,16 @@
#include <skia/x11/gdiimpl.hxx>
+// TODO
+#define SK_ASSUME_GL 1
+#define SK_ASSUME_GL_ES 0
+
+#include <tools/sk_app/unix/WindowContextFactory_unix.h>
+#include <tools/sk_app/WindowContext.h>
+
X11SkiaSalGraphicsImpl::X11SkiaSalGraphicsImpl(X11SalGraphics& rParent)
: SkiaSalGraphicsImpl(rParent, rParent.GetGeometryProvider())
, mParent(rParent)
- , mCopyGc(None)
{
}
@@ -34,54 +40,42 @@ void X11SkiaSalGraphicsImpl::Init()
SkiaSalGraphicsImpl::Init();
}
-GC X11SkiaSalGraphicsImpl::getGC()
+void X11SkiaSalGraphicsImpl::createSurface()
{
- if (mCopyGc == None)
- {
- XGCValues values;
- values.graphics_exposures = False;
- values.subwindow_mode = ClipByChildren;
- mCopyGc = XCreateGC(mParent.GetXDisplay(), mParent.GetDrawable(),
- GCGraphicsExposures | GCSubwindowMode, &values);
- }
- return mCopyGc;
+ if (isOffscreen())
+ return SkiaSalGraphicsImpl::createSurface();
+ sk_app::DisplayParams displayParams;
+ // TODO The Skia Xlib code actually requires the non-native color type to work properly.
+ // Use a macro to hide an unreachable code warning.
+#define GET_FORMAT \
+ kN32_SkColorType == kBGRA_8888_SkColorType ? kRGBA_8888_SkColorType : kBGRA_8888_SkColorType
+ displayParams.fColorType = GET_FORMAT;
+#undef GET_FORMAT
+ sk_app::window_context_factory::XlibWindowInfo winInfo;
+ winInfo.fDisplay = mParent.GetXDisplay();
+ winInfo.fWindow = mParent.GetDrawable();
+ assert(winInfo.fDisplay && winInfo.fWindow != None);
+ winInfo.fFBConfig = nullptr; // not used
+ winInfo.fVisualInfo = const_cast<SalVisual*>(&mParent.GetVisual());
+ winInfo.fWidth = GetWidth();
+ winInfo.fHeight = GetHeight();
+ mWindowContext.reset(sk_app::window_context_factory::NewRasterForXlib(winInfo, displayParams));
+ assert(SkToBool(mWindowContext)); // TODO
+ mSurface = mWindowContext->getBackbufferSurface();
}
-void X11SkiaSalGraphicsImpl::freeResources()
+void X11SkiaSalGraphicsImpl::DeInit()
{
- if (mCopyGc != None)
- {
- XFreeGC(mParent.GetXDisplay(), mCopyGc);
- mCopyGc = None;
- }
+ mWindowContext.reset();
+ SkiaSalGraphicsImpl::DeInit();
}
+void X11SkiaSalGraphicsImpl::freeResources() {}
+
void X11SkiaSalGraphicsImpl::performFlush()
{
- Display* dpy = mParent.GetXDisplay();
- Drawable drawable = mParent.GetDrawable();
- GC gc = getGC();
- SkPixmap pm;
- if (!mSurface->peekPixels(&pm))
- abort();
- int bitsPerPixel = pm.info().bytesPerPixel() * 8;
- XImage image;
- memset(&image, 0, sizeof(image));
- image.width = pm.width();
- image.height = pm.height();
- image.format = ZPixmap;
- image.data = (char*)pm.addr();
- image.byte_order = LSBFirst;
- image.bitmap_unit = bitsPerPixel;
- image.bitmap_bit_order = LSBFirst;
- image.bitmap_pad = bitsPerPixel;
- image.depth = 24;
- image.bytes_per_line = pm.rowBytes() - pm.width() * pm.info().bytesPerPixel();
- image.bits_per_pixel = bitsPerPixel;
- if (!XInitImage(&image))
- abort();
// TODO XPutImage() is somewhat inefficient, XShmPutImage() should be preferred.
- XPutImage(dpy, drawable, gc, &image, 0, 0, 0, 0, pm.width(), pm.height());
+ mWindowContext->swapBuffers();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 29278db00a9be65e745c36dc4c58f29daeae50cf
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Oct 7 12:01:04 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:58:54 2019 +0200
build also the tools/sk_app part of Skia
That's basically code that allows intergrating the library with X11 etc.
Change-Id: I3f5506ef4ecc334b4e93c4450fb1aa4c53dbfefc
diff --git a/external/skia/Library_skia.mk b/external/skia/Library_skia.mk
index 87d85831e5bc..cc3856114d93 100644
--- a/external/skia/Library_skia.mk
+++ b/external/skia/Library_skia.mk
@@ -25,6 +25,8 @@ $(eval $(call gb_Library_add_defs,skia,\
-DSK_HAS_JPEG_LIBRARY=1 \
-DSK_HAS_PNG_LIBRARY=1 \
-DSK_GAMMA_APPLY_TO_A8 \
+ -DSK_ASSUME_GL=1 \
+ -DSK_ASSUME_GL_ES=0 \
))
ifneq (,$(gb_ENABLE_DBGUTIL))
@@ -92,6 +94,9 @@ $(eval $(call gb_Library_add_libs,skia,\
-lm \
-ldl \
-lGLX \
+ -lGL \
+ -lX11-xcb \
+ -lX11 \
))
endif
@@ -831,6 +836,12 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/ports/SkOSFile_stdio \
))
+$(eval $(call gb_Library_add_generated_exception_objects,skia,\
+ UnpackedTarball/skia/tools/gpu/vk/VkTestUtils \
+ UnpackedTarball/skia/tools/sk_app/GLWindowContext \
+ UnpackedTarball/skia/tools/sk_app/VulkanWindowContext \
+))
+
ifeq ($(OS),WNT)
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/gpu/gl/win/GrGLMakeNativeInterface_win \
@@ -852,6 +863,12 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/utils/win/SkIStream \
UnpackedTarball/skia/src/utils/win/SkWGL_win \
))
+
+$(eval $(call gb_Library_add_generated_exception_objects,skia,\
+ UnpackedTarball/skia/tools/sk_app/win/GLWindowContext_win \
+ UnpackedTarball/skia/tools/sk_app/win/RasterWindowContext_win \
+ UnpackedTarball/skia/tools/sk_app/win/VulkanWindowContext_win \
+))
else
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/gpu/gl/glx/GrGLMakeNativeInterface_glx \
@@ -868,6 +885,12 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/ports/SkOSLibrary_posix \
UnpackedTarball/skia/src/ports/SkTLS_pthread \
))
+
+$(eval $(call gb_Library_add_generated_exception_objects,skia,\
+ UnpackedTarball/skia/tools/sk_app/unix/GLWindowContext_unix \
+ UnpackedTarball/skia/tools/sk_app/unix/RasterWindowContext_unix \
+ UnpackedTarball/skia/tools/sk_app/unix/VulkanWindowContext_unix \
+))
endif
diff --git a/external/skia/UnpackedTarball_skia.mk b/external/skia/UnpackedTarball_skia.mk
index 7ae3bf4427fc..462d07edf8f2 100644
--- a/external/skia/UnpackedTarball_skia.mk
+++ b/external/skia/UnpackedTarball_skia.mk
@@ -12,7 +12,7 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,skia))
$(eval $(call gb_UnpackedTarball_set_tarball,skia,$(SKIA_TARBALL)))
# TODO
-skia_patches := lerp.patch fix-pch.patch fix-ddi.patch
+skia_patches := lerp.patch fix-pch.patch fix-ddi.patch make-api-visible.patch
$(eval $(call gb_UnpackedTarball_set_patchlevel,skia,1))
diff --git a/external/skia/make-api-visible.patch b/external/skia/make-api-visible.patch
new file mode 100644
index 000000000000..d2c3b1f794e3
--- /dev/null
+++ b/external/skia/make-api-visible.patch
@@ -0,0 +1,17 @@
+--- skia/tools/sk_app/unix/WindowContextFactory_unix.h.sav 2019-09-26 15:02:19.637587019 +0200
++++ skia/tools/sk_app/unix/WindowContextFactory_unix.h 2019-10-07 11:52:46.744194127 +0200
+@@ -33,11 +33,11 @@ struct XlibWindowInfo {
+ int fHeight;
+ };
+
+-WindowContext* NewVulkanForXlib(const XlibWindowInfo&, const DisplayParams&);
++SK_API WindowContext* NewVulkanForXlib(const XlibWindowInfo&, const DisplayParams&);
+
+-WindowContext* NewGLForXlib(const XlibWindowInfo&, const DisplayParams&);
++SK_API WindowContext* NewGLForXlib(const XlibWindowInfo&, const DisplayParams&);
+
+-WindowContext* NewRasterForXlib(const XlibWindowInfo&, const DisplayParams&);
++SK_API WindowContext* NewRasterForXlib(const XlibWindowInfo&, const DisplayParams&);
+
+ } // namespace window_context_factory
+
commit b49a9134398cc657425bbbeaee75592e57bff1d8
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Oct 3 15:47:08 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:55:58 2019 +0200
implement skia x11 cairo text drawing
Change-Id: Id7d29980d2ea82b98e478e24b7e3189c31fa7257
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index dbc8da62891d..0caa70b5a557 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -183,6 +183,8 @@ public:
virtual bool drawGradient(const tools::PolyPolygon& rPolygon,
const Gradient& rGradient) override;
+ void drawBitmap(const SalTwoRect& rPosAry, const SkBitmap& bitmap);
+
// To be called after any drawing.
void scheduleFlush();
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 4a42ea503985..07937c6b9cb0 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -490,14 +490,19 @@ bool SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBi
&paint);
paint.setBlendMode(SkBlendMode::kSrcIn);
canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rSourceBitmap).GetSkBitmap(), 0, 0, &paint);
+ drawBitmap(rPosAry, tmpBitmap);
+ return true;
+}
+
+void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SkBitmap& bitmap)
+{
mSurface->getCanvas()->drawBitmapRect(
- tmpBitmap,
+ bitmap,
SkRect::MakeXYWH(rPosAry.mnSrcX, rPosAry.mnSrcY, rPosAry.mnSrcWidth, rPosAry.mnSrcHeight),
SkRect::MakeXYWH(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth,
rPosAry.mnDestHeight),
nullptr);
scheduleFlush();
- return true;
}
bool SkiaSalGraphicsImpl::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
diff --git a/vcl/skia/x11/cairotextrender.cxx b/vcl/skia/x11/cairotextrender.cxx
index 8c25d6c5ce3a..82577d026ce9 100644
--- a/vcl/skia/x11/cairotextrender.cxx
+++ b/vcl/skia/x11/cairotextrender.cxx
@@ -37,7 +37,6 @@ cairo_t* SkiaX11CairoTextRender::getCairoContext()
if (!surface)
return nullptr;
cairo_t* cr = cairo_create(surface);
- // TODO SKIA
cairo_surface_destroy(surface);
return cr;
}
@@ -72,15 +71,13 @@ void SkiaX11CairoTextRender::releaseCairoContext(cairo_t* cr)
SalTwoRect aRect(0, 0, nWidth, nHeight, aClipRect.Left(), aClipRect.Top(), nWidth, nHeight);
- // Cairo surface data is ARGB with premultiplied alpha and is Y-inverted
- // TODO SKIA
- // SkiaTexture aTexture( nWidth, nHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, pSrc );
- // pImpl->PreDraw();
- // pImpl->DrawAlphaTexture( aTexture, aRect, true, true );
- // pImpl->PostDraw();
- // abort();
- (void)pSrc;
+ SkBitmap bitmap;
+ if (!bitmap.installPixels(SkImageInfo::MakeN32Premul(nWidth, nHeight), pSrc, nWidth * 4))
+ abort();
+ pImpl->drawBitmap(aRect, bitmap);
+
+ bitmap.reset();
cairo_destroy(cr);
}
commit 2a9b958bb87cd020716e64169a74b769fc2936b1
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Oct 2 17:15:07 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:53:39 2019 +0200
make the X11/Skia backend finally capable of drawing on screen
Change-Id: I5c847c1036c671137ee27053691189093b1dafae
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index 89f4f0b6664d..dbc8da62891d 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -27,6 +27,8 @@
#include <SkSurface.h>
+class SkiaFlushIdle;
+
class VCL_DLLPUBLIC SkiaSalGraphicsImpl : public SalGraphicsImpl
{
public:
@@ -37,8 +39,6 @@ public:
virtual void DeInit() override;
- virtual void freeResources() override;
-
const vcl::Region& getClipRegion() const;
virtual bool setClipRegion(const vcl::Region&) override;
@@ -183,6 +183,12 @@ public:
virtual bool drawGradient(const tools::PolyPolygon& rPolygon,
const Gradient& rGradient) override;
+ // To be called after any drawing.
+ void scheduleFlush();
+
+ // Internal, called by SkiaFlushIdle.
+ virtual void performFlush() = 0;
+
#ifdef DBG_UTIL
void dump(const char* file) const;
void dump(const SkBitmap& bitmap, const char* file) const;
@@ -191,7 +197,9 @@ public:
protected:
void setProvider(SalGeometryProvider* provider) { mProvider = provider; }
-private:
+ bool isOffscreen() const { return mProvider == nullptr || mProvider->IsOffScreen(); }
+
+protected:
// get the width of the device
int GetWidth() const { return mProvider ? mProvider->GetWidth() : 1; }
// get the height of the device
@@ -215,6 +223,7 @@ private:
vcl::Region mClipRegion;
Color mLineColor;
Color mFillColor;
+ std::unique_ptr<SkiaFlushIdle> mFlush;
};
#endif
diff --git a/vcl/inc/skia/x11/gdiimpl.hxx b/vcl/inc/skia/x11/gdiimpl.hxx
index d75ecb49e173..5af02c377a63 100644
--- a/vcl/inc/skia/x11/gdiimpl.hxx
+++ b/vcl/inc/skia/x11/gdiimpl.hxx
@@ -19,14 +19,21 @@
class VCL_PLUGIN_PUBLIC X11SkiaSalGraphicsImpl : public SkiaSalGraphicsImpl, public X11GraphicsImpl
{
private:
- X11SalGraphics& mrX11Parent;
+ X11SalGraphics& mParent;
public:
X11SkiaSalGraphicsImpl(X11SalGraphics& rParent);
virtual ~X11SkiaSalGraphicsImpl() override;
-public:
virtual void Init() override;
+ virtual void freeResources() override;
+
+protected:
+ virtual void performFlush() override;
+
+private:
+ GC getGC();
+ GC mCopyGc;
};
#endif // INCLUDED_VCL_INC_SKIA_X11_GDIIMPL_HXX
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index da8a917f50b5..4a42ea503985 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -21,6 +21,8 @@
#include <salgdi.hxx>
#include <skia/salbmp.hxx>
+#include <vcl/idle.hxx>
+#include <vcl/svapp.hxx>
#include <SkCanvas.h>
#include <SkPath.h>
@@ -30,11 +32,34 @@
#include <fstream>
#endif
+// Class that triggers flushing the backing buffer when idle.
+class SkiaFlushIdle : public Idle
+{
+ SkiaSalGraphicsImpl* graphics;
+
+public:
+ explicit SkiaFlushIdle(SkiaSalGraphicsImpl* graphics)
+ : Idle("skia idle swap")
+ , graphics(graphics)
+ {
+ // We don't want to be swapping before we've painted.
+ SetPriority(TaskPriority::POST_PAINT);
+ }
+
+ virtual void Invoke() override
+ {
+ graphics->performFlush();
+ Stop();
+ SetPriority(TaskPriority::HIGHEST);
+ }
+};
+
SkiaSalGraphicsImpl::SkiaSalGraphicsImpl(SalGraphics& rParent, SalGeometryProvider* pProvider)
: mParent(rParent)
, mProvider(pProvider)
, mLineColor(SALCOLOR_NONE)
, mFillColor(SALCOLOR_NONE)
+ , mFlush(new SkiaFlushIdle(this))
{
}
@@ -46,12 +71,13 @@ void SkiaSalGraphicsImpl::Init()
mSurface = SkSurface::MakeRasterN32Premul(GetWidth(), GetHeight());
mSurface->getCanvas()->save(); // see SetClipRegion()
mClipRegion = vcl::Region(tools::Rectangle(0, 0, GetWidth(), GetHeight()));
+
+ // We don't want to be swapping before we've painted.
+ mFlush->SetPriority(TaskPriority::POST_PAINT);
}
void SkiaSalGraphicsImpl::DeInit() { mSurface.reset(); }
-void SkiaSalGraphicsImpl::freeResources() {}
-
static SkIRect toSkIRect(const tools::Rectangle& rectangle)
{
return SkIRect::MakeXYWH(rectangle.Left(), rectangle.Top(), rectangle.GetWidth(),
@@ -129,6 +155,7 @@ void SkiaSalGraphicsImpl::drawPixel(long nX, long nY)
return;
SkCanvas* canvas = mSurface->getCanvas();
canvas->drawPoint(nX, nY, SkPaint());
+ scheduleFlush();
}
void SkiaSalGraphicsImpl::drawPixel(long nX, long nY, Color nColor)
@@ -141,6 +168,7 @@ void SkiaSalGraphicsImpl::drawPixel(long nX, long nY, Color nColor)
// Apparently drawPixel() is actually expected to set the pixel and not draw it.
paint.setBlendMode(SkBlendMode::kSrc); // set as is, including alpha
canvas->drawPoint(nX, nY, paint);
+ scheduleFlush();
}
void SkiaSalGraphicsImpl::drawLine(long nX1, long nY1, long nX2, long nY2)
@@ -151,6 +179,7 @@ void SkiaSalGraphicsImpl::drawLine(long nX1, long nY1, long nX2, long nY2)
SkPaint paint;
paint.setColor(toSkColor(mLineColor));
canvas->drawLine(nX1, nY1, nX2, nY2, paint);
+ scheduleFlush();
}
void SkiaSalGraphicsImpl::drawRect(long nX, long nY, long nWidth, long nHeight)
@@ -169,6 +198,7 @@ void SkiaSalGraphicsImpl::drawRect(long nX, long nY, long nWidth, long nHeight)
paint.setStyle(SkPaint::kStroke_Style);
canvas->drawIRect(SkIRect::MakeXYWH(nX, nY, nWidth - 1, nHeight - 1), paint);
}
+ scheduleFlush();
}
void SkiaSalGraphicsImpl::drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAry)
@@ -183,6 +213,7 @@ void SkiaSalGraphicsImpl::drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAr
paint.setColor(toSkColor(mLineColor));
mSurface->getCanvas()->drawPoints(SkCanvas::kLines_PointMode, nPoints, pointVector.data(),
paint);
+ scheduleFlush();
}
void SkiaSalGraphicsImpl::drawPolygon(sal_uInt32 nPoints, const SalPoint* pPtAry)
@@ -208,6 +239,7 @@ void SkiaSalGraphicsImpl::drawPolygon(sal_uInt32 nPoints, const SalPoint* pPtAry
paint.setStyle(SkPaint::kStroke_Style);
mSurface->getCanvas()->drawPath(path, paint);
}
+ scheduleFlush();
}
void SkiaSalGraphicsImpl::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints,
@@ -242,6 +274,7 @@ void SkiaSalGraphicsImpl::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pP
paint.setStyle(SkPaint::kStroke_Style);
mSurface->getCanvas()->drawPath(path, paint);
}
+ scheduleFlush();
}
bool SkiaSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice,
@@ -306,6 +339,7 @@ void SkiaSalGraphicsImpl::copyArea(long nDestX, long nDestY, long nSrcX, long nS
= mSurface->makeImageSnapshot(SkIRect::MakeXYWH(nSrcX, nSrcY, nSrcWidth, nSrcHeight));
// TODO makeNonTextureImage() ?
mSurface->getCanvas()->drawImage(image, nDestX, nDestY);
+ scheduleFlush();
}
void SkiaSalGraphicsImpl::copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics)
@@ -326,6 +360,7 @@ void SkiaSalGraphicsImpl::copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcG
rPosAry.mnDestWidth,
rPosAry.mnDestHeight),
nullptr);
+ scheduleFlush();
}
bool SkiaSalGraphicsImpl::blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap)
@@ -356,6 +391,7 @@ void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap&
SkRect::MakeXYWH(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth,
rPosAry.mnDestHeight),
nullptr);
+ scheduleFlush();
}
void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
@@ -385,6 +421,7 @@ void SkiaSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry, const SalBitmap& r
SkRect::MakeXYWH(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth,
rPosAry.mnDestHeight),
nullptr);
+ scheduleFlush();
}
std::shared_ptr<SalBitmap> SkiaSalGraphicsImpl::getBitmap(long nX, long nY, long nWidth,
@@ -459,6 +496,7 @@ bool SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBi
SkRect::MakeXYWH(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth,
rPosAry.mnDestHeight),
nullptr);
+ scheduleFlush();
return true;
}
@@ -495,6 +533,16 @@ bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolygon,
return false;
}
+void SkiaSalGraphicsImpl::scheduleFlush()
+{
+ if (isOffscreen())
+ return;
+ if (!Application::IsInExecute())
+ performFlush(); // otherwise nothing would trigger idle rendering
+ else if (!mFlush->IsActive())
+ mFlush->Start();
+}
+
#ifdef DBG_UTIL
void SkiaSalGraphicsImpl::dump(const char* file) const
{
diff --git a/vcl/skia/x11/gdiimpl.cxx b/vcl/skia/x11/gdiimpl.cxx
index 760ae1abf810..93068721ae5a 100644
--- a/vcl/skia/x11/gdiimpl.cxx
+++ b/vcl/skia/x11/gdiimpl.cxx
@@ -5,13 +5,23 @@
* 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/.
+ *
+ * Some of this code is based on Skia source code, covered by the following
+ * license notice (see readlicense_oo for the full license):
+ *
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
*/
#include <skia/x11/gdiimpl.hxx>
X11SkiaSalGraphicsImpl::X11SkiaSalGraphicsImpl(X11SalGraphics& rParent)
: SkiaSalGraphicsImpl(rParent, rParent.GetGeometryProvider())
- , mrX11Parent(rParent)
+ , mParent(rParent)
+ , mCopyGc(None)
{
}
@@ -20,8 +30,58 @@ X11SkiaSalGraphicsImpl::~X11SkiaSalGraphicsImpl() {}
void X11SkiaSalGraphicsImpl::Init()
{
// The m_pFrame and m_pVDev pointers are updated late in X11
- setProvider(mrX11Parent.GetGeometryProvider());
+ setProvider(mParent.GetGeometryProvider());
SkiaSalGraphicsImpl::Init();
}
+GC X11SkiaSalGraphicsImpl::getGC()
+{
+ if (mCopyGc == None)
+ {
+ XGCValues values;
+ values.graphics_exposures = False;
+ values.subwindow_mode = ClipByChildren;
+ mCopyGc = XCreateGC(mParent.GetXDisplay(), mParent.GetDrawable(),
+ GCGraphicsExposures | GCSubwindowMode, &values);
+ }
+ return mCopyGc;
+}
+
+void X11SkiaSalGraphicsImpl::freeResources()
+{
+ if (mCopyGc != None)
+ {
+ XFreeGC(mParent.GetXDisplay(), mCopyGc);
+ mCopyGc = None;
+ }
+}
+
+void X11SkiaSalGraphicsImpl::performFlush()
+{
+ Display* dpy = mParent.GetXDisplay();
+ Drawable drawable = mParent.GetDrawable();
+ GC gc = getGC();
+ SkPixmap pm;
+ if (!mSurface->peekPixels(&pm))
+ abort();
+ int bitsPerPixel = pm.info().bytesPerPixel() * 8;
+ XImage image;
+ memset(&image, 0, sizeof(image));
+ image.width = pm.width();
+ image.height = pm.height();
+ image.format = ZPixmap;
+ image.data = (char*)pm.addr();
+ image.byte_order = LSBFirst;
+ image.bitmap_unit = bitsPerPixel;
+ image.bitmap_bit_order = LSBFirst;
+ image.bitmap_pad = bitsPerPixel;
+ image.depth = 24;
+ image.bytes_per_line = pm.rowBytes() - pm.width() * pm.info().bytesPerPixel();
+ image.bits_per_pixel = bitsPerPixel;
+ if (!XInitImage(&image))
+ abort();
+ // TODO XPutImage() is somewhat inefficient, XShmPutImage() should be preferred.
+ XPutImage(dpy, drawable, gc, &image, 0, 0, 0, 0, pm.width(), pm.height());
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a9991a57e6e720f0e015cc6427df920d451bb17d
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Oct 2 14:25:02 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:48:45 2019 +0200
correct SkPaint usage when painting
Handle SALCOLOR_NONE properly. Also avoid reusing a global SkPaint,
creating a new one is as cheap as making a copy, and this way it's
less error-prone.
Change-Id: I12659cdc58b02f5105029b2b89d1b0c147c7a471
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index 33cb2e6078cf..89f4f0b6664d 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -25,7 +25,6 @@
#include <salgdiimpl.hxx>
#include <salgeom.hxx>
-#include <SkPaint.h>
#include <SkSurface.h>
class VCL_DLLPUBLIC SkiaSalGraphicsImpl : public SalGraphicsImpl
@@ -213,7 +212,6 @@ private:
SalGeometryProvider* mProvider;
// The Skia surface that is target of all the rendering.
sk_sp<SkSurface> mSurface;
- SkPaint mPaint; // The current paint object (contains paint setup, such as color to use).
vcl::Region mClipRegion;
Color mLineColor;
Color mFillColor;
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 90cb2bd04f1c..da8a917f50b5 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -87,6 +87,7 @@ bool SkiaSalGraphicsImpl::setClipRegion(const vcl::Region& region)
// So handle that by always having the full clip region saved on the stack
// and always go back to that. SkCanvas::restore() only affects the clip
// and the matrix.
+ assert(canvas->getSaveCount() == 2); // = there is just one save()
canvas->restore();
canvas->save();
canvas->clipRegion(toSkRegion(region));
@@ -124,14 +125,18 @@ void SkiaSalGraphicsImpl::SetROPFillColor(SalROPColor nROPColor) { (void)nROPCol
void SkiaSalGraphicsImpl::drawPixel(long nX, long nY)
{
+ if (mLineColor == SALCOLOR_NONE)
+ return;
SkCanvas* canvas = mSurface->getCanvas();
- canvas->drawPoint(nX, nY, mPaint);
+ canvas->drawPoint(nX, nY, SkPaint());
}
void SkiaSalGraphicsImpl::drawPixel(long nX, long nY, Color nColor)
{
+ if (nColor == SALCOLOR_NONE)
+ return;
SkCanvas* canvas = mSurface->getCanvas();
- SkPaint paint(mPaint);
+ SkPaint paint;
paint.setColor(toSkColor(nColor));
// Apparently drawPixel() is actually expected to set the pixel and not draw it.
paint.setBlendMode(SkBlendMode::kSrc); // set as is, including alpha
@@ -140,15 +145,18 @@ void SkiaSalGraphicsImpl::drawPixel(long nX, long nY, Color nColor)
void SkiaSalGraphicsImpl::drawLine(long nX1, long nY1, long nX2, long nY2)
{
+ if (mLineColor == SALCOLOR_NONE)
+ return;
SkCanvas* canvas = mSurface->getCanvas();
- canvas->drawLine(nX1, nY1, nX2, nY2, mPaint);
+ SkPaint paint;
+ paint.setColor(toSkColor(mLineColor));
+ canvas->drawLine(nX1, nY1, nX2, nY2, paint);
}
void SkiaSalGraphicsImpl::drawRect(long nX, long nY, long nWidth, long nHeight)
{
SkCanvas* canvas = mSurface->getCanvas();
- SkPaint paint(mPaint);
- paint.setStrokeWidth(0); // smallest possible
+ SkPaint paint;
if (mFillColor != SALCOLOR_NONE)
{
paint.setColor(toSkColor(mFillColor));
@@ -165,29 +173,47 @@ void SkiaSalGraphicsImpl::drawRect(long nX, long nY, long nWidth, long nHeight)
void SkiaSalGraphicsImpl::drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAry)
{
+ if (mLineColor == SALCOLOR_NONE)
+ return;
std::vector<SkPoint> pointVector;
pointVector.reserve(nPoints);
for (sal_uInt32 i = 0; i < nPoints; ++i)
pointVector.emplace_back(SkPoint::Make(pPtAry[i].mnX, pPtAry[i].mnY));
+ SkPaint paint;
+ paint.setColor(toSkColor(mLineColor));
mSurface->getCanvas()->drawPoints(SkCanvas::kLines_PointMode, nPoints, pointVector.data(),
- mPaint);
+ paint);
}
void SkiaSalGraphicsImpl::drawPolygon(sal_uInt32 nPoints, const SalPoint* pPtAry)
{
+ if (mLineColor == SALCOLOR_NONE && mFillColor == SALCOLOR_NONE)
+ return;
std::vector<SkPoint> pointVector;
pointVector.reserve(nPoints);
for (sal_uInt32 i = 0; i < nPoints; ++i)
pointVector.emplace_back(SkPoint::Make(pPtAry[i].mnX, pPtAry[i].mnY));
SkPath path;
- path.addPoly(pointVector.data(), nPoints, true);
- mSurface->getCanvas()->drawPath(path, mPaint);
+ path.addPoly(pointVector.data(), nPoints, false);
+ SkPaint paint;
+ if (mFillColor != SALCOLOR_NONE)
+ {
+ paint.setColor(toSkColor(mFillColor));
+ paint.setStyle(SkPaint::kFill_Style);
+ mSurface->getCanvas()->drawPath(path, paint);
+ }
+ if (mLineColor != SALCOLOR_NONE)
+ {
+ paint.setColor(toSkColor(mLineColor));
+ paint.setStyle(SkPaint::kStroke_Style);
+ mSurface->getCanvas()->drawPath(path, paint);
+ }
}
void SkiaSalGraphicsImpl::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints,
PCONSTSALPOINT* pPtAry)
{
- if (SALCOLOR_NONE == mFillColor && SALCOLOR_NONE == mLineColor)
+ if (mLineColor == SALCOLOR_NONE && mFillColor == SALCOLOR_NONE)
return;
std::vector<SkPoint> pointVector;
SkPath path;
@@ -203,12 +229,26 @@ void SkiaSalGraphicsImpl::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pP
path.addPoly(pointVector.data(), points, true);
}
}
- mSurface->getCanvas()->drawPath(path, mPaint);
+ SkPaint paint;
+ if (mFillColor != SALCOLOR_NONE)
+ {
+ paint.setColor(toSkColor(mFillColor));
+ paint.setStyle(SkPaint::kFill_Style);
+ mSurface->getCanvas()->drawPath(path, paint);
+ }
+ if (mLineColor != SALCOLOR_NONE)
+ {
+ paint.setColor(toSkColor(mLineColor));
+ paint.setStyle(SkPaint::kStroke_Style);
+ mSurface->getCanvas()->drawPath(path, paint);
+ }
}
bool SkiaSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice,
const basegfx::B2DPolyPolygon&, double fTransparency)
{
+ if (mLineColor == SALCOLOR_NONE && mFillColor == SALCOLOR_NONE)
+ return true;
(void)rObjectToDevice;
(void)fTransparency;
return false;
commit e5f9ef76dadf37cbec327fa33b2ed80261680883
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Oct 2 14:12:42 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:48:45 2019 +0200
flush SkSurface's SkCanvas before getting data from it
It seems this is necessary, otherwise there may be pending
operations.
Change-Id: I93650bbd622d8ab8b6535a950afd2b6ac6a87db7
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index b2341c90632c..90cb2bd04f1c 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -350,12 +350,14 @@ void SkiaSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry, const SalBitmap& r
std::shared_ptr<SalBitmap> SkiaSalGraphicsImpl::getBitmap(long nX, long nY, long nWidth,
long nHeight)
{
+ mSurface->getCanvas()->flush();
sk_sp<SkImage> image = mSurface->makeImageSnapshot(SkIRect::MakeXYWH(nX, nY, nWidth, nHeight));
return std::make_shared<SkiaSalBitmap>(*image);
}
Color SkiaSalGraphicsImpl::getPixel(long nX, long nY)
{
+ mSurface->getCanvas()->flush();
// TODO this is presumably slow, and possibly won't work with GPU surfaces
SkBitmap bitmap;
if (!bitmap.tryAllocN32Pixels(GetWidth(), GetHeight()))
@@ -456,6 +458,7 @@ bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolygon,
#ifdef DBG_UTIL
void SkiaSalGraphicsImpl::dump(const char* file) const
{
+ mSurface->getCanvas()->flush();
sk_sp<SkImage> image = mSurface->makeImageSnapshot();
sk_sp<SkData> data = image->encodeToData();
std::ofstream ostream(file, std::ios::binary);
commit 9d52136064b789ae0f23244f373de157def78e62
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Oct 2 14:11:25 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:48:44 2019 +0200
implement Skia setClipRegion()
Change-Id: I9e525936bba50b565704ee1b60d7464a7397dc80
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index ba764cbdd0b9..b2341c90632c 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -24,6 +24,7 @@
#include <SkCanvas.h>
#include <SkPath.h>
+#include <SkRegion.h>
#ifdef DBG_UTIL
#include <fstream>
@@ -43,26 +44,66 @@ void SkiaSalGraphicsImpl::Init()
{
// TODO
mSurface = SkSurface::MakeRasterN32Premul(GetWidth(), GetHeight());
+ mSurface->getCanvas()->save(); // see SetClipRegion()
+ mClipRegion = vcl::Region(tools::Rectangle(0, 0, GetWidth(), GetHeight()));
}
void SkiaSalGraphicsImpl::DeInit() { mSurface.reset(); }
void SkiaSalGraphicsImpl::freeResources() {}
-const vcl::Region& SkiaSalGraphicsImpl::getClipRegion() const { return mClipRegion; }
+static SkIRect toSkIRect(const tools::Rectangle& rectangle)
+{
+ return SkIRect::MakeXYWH(rectangle.Left(), rectangle.Top(), rectangle.GetWidth(),
+ rectangle.GetHeight());
+}
+
+static SkRegion toSkRegion(const vcl::Region& region)
+{
+ if (region.IsEmpty())
+ return SkRegion();
+ if (region.IsRectangle())
+ return SkRegion(toSkIRect(region.GetBoundRect()));
+ if (!region.HasPolyPolygonOrB2DPolyPolygon())
+ {
+ SkRegion skRegion;
+ RectangleVector rectangles;
+ region.GetRegionRectangles(rectangles);
+ for (const tools::Rectangle& rect : rectangles)
+ skRegion.op(toSkIRect(rect), SkRegion::kUnion_Op);
+ return skRegion;
+ }
+ abort();
+}
bool SkiaSalGraphicsImpl::setClipRegion(const vcl::Region& region)
{
+ if (mClipRegion == region)
+ return true;
mClipRegion = region;
+ SkCanvas* canvas = mSurface->getCanvas();
+ // SkCanvas::clipRegion() can only further reduce the clip region,
+ // but we need to set the given region, which may extend it.
+ // So handle that by always having the full clip region saved on the stack
+ // and always go back to that. SkCanvas::restore() only affects the clip
+ // and the matrix.
+ canvas->restore();
+ canvas->save();
+ canvas->clipRegion(toSkRegion(region));
return true;
}
+void SkiaSalGraphicsImpl::ResetClipRegion()
+{
+ setClipRegion(vcl::Region(tools::Rectangle(0, 0, GetWidth(), GetHeight())));
+}
+
+const vcl::Region& SkiaSalGraphicsImpl::getClipRegion() const { return mClipRegion; }
+
sal_uInt16 SkiaSalGraphicsImpl::GetBitCount() const { return 32; }
long SkiaSalGraphicsImpl::GetGraphicsWidth() const { return GetWidth(); }
-void SkiaSalGraphicsImpl::ResetClipRegion() { mClipRegion.SetEmpty(); }
-
void SkiaSalGraphicsImpl::SetLineColor() { mLineColor = SALCOLOR_NONE; }
void SkiaSalGraphicsImpl::SetLineColor(Color nColor) { mLineColor = nColor; }
commit 94bb973618d75735f48a4c6fc5a30ff651525790
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Oct 1 17:40:50 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:48:37 2019 +0200
better handling of bit depths in skia code
Change-Id: Ifb3103cc3494bc55a562d4b6a16b59a044782416
diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index 45af13a2b79f..4db31a0f88fc 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -384,9 +384,6 @@ void BitmapTest::testConvert()
CPPUNIT_ASSERT_EQUAL(sal_uInt32(30), pReadAccess->GetScanlineSize());
else
#endif
- if (SkiaHelper::isVCLSkiaEnabled())
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(40), pReadAccess->GetScanlineSize());
- else
CPPUNIT_ASSERT_EQUAL(sal_uInt32(32), pReadAccess->GetScanlineSize());
#else
#if defined(_WIN32)
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 68ea005e5784..8d5a61d32e83 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -37,21 +37,6 @@ SkiaSalBitmap::SkiaSalBitmap() {}
SkiaSalBitmap::~SkiaSalBitmap() {}
-static SkColorType getSkColorType(int bitCount)
-{
- switch (bitCount)
- {
- case 8:
- return kGray_8_SkColorType; // see GetAlphaSkBitmap()
- case 24:
- return kRGB_888x_SkColorType;
- case 32:
- return kN32_SkColorType;
- default:
- abort();
- }
-}
-
static bool isValidBitCount(sal_uInt16 nBitCount)
{
return (nBitCount == 1) || (nBitCount == 4) || (nBitCount == 8) || (nBitCount == 24)
@@ -60,7 +45,6 @@ static bool isValidBitCount(sal_uInt16 nBitCount)
SkiaSalBitmap::SkiaSalBitmap(const SkImage& image)
{
- assert(image.colorType() == kN32_SkColorType);
if (Create(Size(image.width(), image.height()), 32, BitmapPalette()))
{
SkCanvas canvas(mBitmap);
@@ -74,18 +58,34 @@ bool SkiaSalBitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const Bitmap
Destroy();
if (!isValidBitCount(nBitCount))
return false;
- // Skia does not support paletted images, so convert only types Skia supports.
- if (nBitCount > 8 || (nBitCount == 8 && (!rPal || rPal.IsGreyPalette())))
+ // Skia only supports 8bit gray, 16bit and 32bit formats (e.g. 24bpp is actually stored as 32bpp).
+ // But some of our code accessing the bitmap assumes that when it asked for 24bpp, the format
+ // really will be 24bpp (e.g. the png loader).
+ // TODO what is the performance impact of handling 24bpp ourselves instead of in Skia?
+ SkColorType colorType = kUnknown_SkColorType;
+ switch (nBitCount)
+ {
+ case 8:
+ if (rPal.IsGreyPalette()) // see GetAlphaSkBitmap()
+ colorType = kGray_8_SkColorType;
+ break;
+ case 32:
+ colorType = kN32_SkColorType;
+ break;
+ default:
+ break;
+ }
+ if (colorType != kUnknown_SkColorType)
{
- if (!mBitmap.tryAllocPixels(SkImageInfo::Make(
- rSize.Width(), rSize.Height(), getSkColorType(nBitCount), kPremul_SkAlphaType)))
+ if (!mBitmap.tryAllocPixels(
+ SkImageInfo::Make(rSize.Width(), rSize.Height(), colorType, kPremul_SkAlphaType)))
{
return false;
}
}
else
{
- // Paletted images are stored in a buffer and converted as necessary.
+ // Image formats not supported by Skia are stored in a buffer and converted as necessary.
int bitScanlineWidth;
if (o3tl::checked_multiply<int>(rSize.Width(), nBitCount, bitScanlineWidth))
{
@@ -201,13 +201,20 @@ BitmapBuffer* SkiaSalBitmap::AcquireBuffer(BitmapAccessMode nMode)
buffer->mnFormat = ScanlineFormat::N4BitMsnPal;
break;
case 8:
- // TODO or always N8BitPal?
- // buffer->mnFormat = !mPalette ? ScanlineFormat::N8BitTcMask : ScanlineFormat::N8BitPal;
buffer->mnFormat = ScanlineFormat::N8BitPal;
break;
case 24:
- buffer->mnFormat = ScanlineFormat::N24BitTcRgb;
+ {
+// Make the RGB/BGR format match the default Skia 32bpp format, to allow
+// easy conversion later.
+// Use a macro to hide an unreachable code warning.
+#define GET_FORMAT \
+ (kN32_SkColorType == kBGRA_8888_SkColorType ? ScanlineFormat::N24BitTcBgr \
+ : ScanlineFormat::N24BitTcRgb)
+ buffer->mnFormat = GET_FORMAT;
+#undef GET_FORMAT
break;
+ }
case 32:
// TODO are these correct?
buffer->mnFormat = mBitmap.colorType() == kRGBA_8888_SkColorType
@@ -266,15 +273,43 @@ const SkBitmap& SkiaSalBitmap::GetSkBitmap() const
{
if (mBuffer && mBitmap.drawsNothing())
{
- std::unique_ptr<sal_uInt8[]> data = convertDataBitCount(
- mBuffer.get(), mSize.Width(), mSize.Height(), mBitCount, mScanlineSize, mPalette,
- kN32_SkColorType == kBGRA_8888_SkColorType ? BitConvert::BGRA
- : BitConvert::RGBA); // TODO
- if (!const_cast<SkBitmap&>(mBitmap).installPixels(
- SkImageInfo::MakeS32(mSize.Width(), mSize.Height(), kOpaque_SkAlphaType),
- data.release(), mSize.Width() * 4,
- [](void* addr, void*) { delete[] static_cast<sal_uInt8*>(addr); }, nullptr))
- abort();
+ if (mBitCount == 24)
+ {
+ // Convert 24bpp RGB/BGR to 32bpp RGBA/BGRA.
+ std::unique_ptr<sal_uInt8[]> data(new sal_uInt8[mSize.Height() * mSize.Width() * 4]);
+ sal_uInt8* dest = data.get();
+ for (int y = 0; y < mSize.Height(); ++y)
+ {
+ const sal_uInt8* src = mBuffer.get() + mScanlineSize * y;
+ for (int x = 0; x < mSize.Width(); ++x)
+ {
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = 0xff;
+ }
+ }
+ if (!const_cast<SkBitmap&>(mBitmap).installPixels(
+ SkImageInfo::MakeS32(mSize.Width(), mSize.Height(), kOpaque_SkAlphaType),
+ data.release(), mSize.Width() * 4,
+ [](void* addr, void*) { delete[] static_cast<sal_uInt8*>(addr); }, nullptr))
+ abort();
+ }
+ else
+ {
+// Use a macro to hide an unreachable code warning.
+#define GET_FORMAT \
+ (kN32_SkColorType == kBGRA_8888_SkColorType ? BitConvert::BGRA : BitConvert::RGBA)
+ std::unique_ptr<sal_uInt8[]> data
+ = convertDataBitCount(mBuffer.get(), mSize.Width(), mSize.Height(), mBitCount,
+ mScanlineSize, mPalette, GET_FORMAT);
+#undef GET_FORMAT
+ if (!const_cast<SkBitmap&>(mBitmap).installPixels(
+ SkImageInfo::MakeS32(mSize.Width(), mSize.Height(), kOpaque_SkAlphaType),
+ data.release(), mSize.Width() * 4,
+ [](void* addr, void*) { delete[] static_cast<sal_uInt8*>(addr); }, nullptr))
+ abort();
+ }
}
return mBitmap;
}
commit 0f43ba12f02d7b549aed9e44a8ee28e9634e9abb
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Oct 1 17:37:14 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:39:45 2019 +0200
implement skia copyBits()
Change-Id: I6706de1daaac60ce493b60af129e7a8e92c73bed
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index 0b08c3c81c5f..33cb2e6078cf 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -114,6 +114,8 @@ public:
virtual void copyArea(long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth,
long nSrcHeight, bool bWindowInvalidate) override;
+ virtual void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override;
+
virtual bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override;
virtual bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap,
diff --git a/vcl/inc/skia/x11/gdiimpl.hxx b/vcl/inc/skia/x11/gdiimpl.hxx
index 7be2329902d9..d75ecb49e173 100644
--- a/vcl/inc/skia/x11/gdiimpl.hxx
+++ b/vcl/inc/skia/x11/gdiimpl.hxx
@@ -26,8 +26,6 @@ public:
virtual ~X11SkiaSalGraphicsImpl() override;
public:
- virtual void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override;
-
virtual void Init() override;
};
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 7141eab1cba5..ba764cbdd0b9 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -19,6 +19,7 @@
#include <skia/gdiimpl.hxx>
+#include <salgdi.hxx>
#include <skia/salbmp.hxx>
#include <SkCanvas.h>
@@ -226,6 +227,26 @@ void SkiaSalGraphicsImpl::copyArea(long nDestX, long nDestY, long nSrcX, long nS
mSurface->getCanvas()->drawImage(image, nDestX, nDestY);
}
+void SkiaSalGraphicsImpl::copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics)
+{
+ SkiaSalGraphicsImpl* src;
+ if (pSrcGraphics)
+ {
+ assert(dynamic_cast<SkiaSalGraphicsImpl*>(pSrcGraphics->GetImpl()));
+ src = static_cast<SkiaSalGraphicsImpl*>(pSrcGraphics->GetImpl());
+ }
+ else
+ src = this;
+ sk_sp<SkImage> image = src->mSurface->makeImageSnapshot(
+ SkIRect::MakeXYWH(rPosAry.mnSrcX, rPosAry.mnSrcY, rPosAry.mnSrcWidth, rPosAry.mnSrcHeight));
+ // TODO makeNonTextureImage() ?
+ mSurface->getCanvas()->drawImageRect(image,
+ SkRect::MakeXYWH(rPosAry.mnDestX, rPosAry.mnDestY,
+ rPosAry.mnDestWidth,
+ rPosAry.mnDestHeight),
+ nullptr);
+}
+
bool SkiaSalGraphicsImpl::blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap)
{
(void)rBitmap;
diff --git a/vcl/skia/x11/gdiimpl.cxx b/vcl/skia/x11/gdiimpl.cxx
index e175f558372f..760ae1abf810 100644
--- a/vcl/skia/x11/gdiimpl.cxx
+++ b/vcl/skia/x11/gdiimpl.cxx
@@ -24,10 +24,4 @@ void X11SkiaSalGraphicsImpl::Init()
SkiaSalGraphicsImpl::Init();
}
-void X11SkiaSalGraphicsImpl::copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics)
-{
- (void)rPosAry;
- (void)pSrcGraphics;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 48f35d09454fd00dd97eac499835190ddb0efe2d
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Sep 24 03:00:54 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:39:44 2019 +0200
more SkiaSalgraphicsImpl drawing
Change-Id: Ie17e8180a07ea96eff5f98b7a59efb8f576801ff
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index dfdd6a054cf8..7141eab1cba5 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -22,6 +22,7 @@
#include <skia/salbmp.hxx>
#include <SkCanvas.h>
+#include <SkPath.h>
#ifdef DBG_UTIL
#include <fstream>
@@ -122,25 +123,45 @@ void SkiaSalGraphicsImpl::drawRect(long nX, long nY, long nWidth, long nHeight)
void SkiaSalGraphicsImpl::drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAry)
{
- (void)nPoints;
- (void)pPtAry;
- abort();
+ std::vector<SkPoint> pointVector;
+ pointVector.reserve(nPoints);
+ for (sal_uInt32 i = 0; i < nPoints; ++i)
+ pointVector.emplace_back(SkPoint::Make(pPtAry[i].mnX, pPtAry[i].mnY));
+ mSurface->getCanvas()->drawPoints(SkCanvas::kLines_PointMode, nPoints, pointVector.data(),
+ mPaint);
}
void SkiaSalGraphicsImpl::drawPolygon(sal_uInt32 nPoints, const SalPoint* pPtAry)
{
- (void)nPoints;
- (void)pPtAry;
- abort();
+ std::vector<SkPoint> pointVector;
+ pointVector.reserve(nPoints);
+ for (sal_uInt32 i = 0; i < nPoints; ++i)
+ pointVector.emplace_back(SkPoint::Make(pPtAry[i].mnX, pPtAry[i].mnY));
+ SkPath path;
+ path.addPoly(pointVector.data(), nPoints, true);
+ mSurface->getCanvas()->drawPath(path, mPaint);
}
void SkiaSalGraphicsImpl::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints,
PCONSTSALPOINT* pPtAry)
{
- (void)nPoly;
- (void)pPoints;
- (void)pPtAry;
- abort();
+ if (SALCOLOR_NONE == mFillColor && SALCOLOR_NONE == mLineColor)
+ return;
+ std::vector<SkPoint> pointVector;
+ SkPath path;
+ for (sal_uInt32 poly = 0; poly < nPoly; ++poly)
+ {
+ const sal_uInt32 points = pPoints[poly];
+ if (points > 1)
+ {
+ pointVector.reserve(points);
+ const SalPoint* p = pPtAry[poly];
+ for (sal_uInt32 i = 0; i < points; ++i)
+ pointVector.emplace_back(SkPoint::Make(p->mnX, p->mnY));
+ path.addPoly(pointVector.data(), points, true);
+ }
+ }
+ mSurface->getCanvas()->drawPath(path, mPaint);
}
bool SkiaSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice,
@@ -195,16 +216,14 @@ bool SkiaSalGraphicsImpl::drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt
}
void SkiaSalGraphicsImpl::copyArea(long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth,
- long nSrcHeight, bool bWindowInvalidate)
-{
- (void)nDestX;
- (void)nDestY;
- (void)nSrcX;
- (void)nSrcY;
- (void)nSrcWidth;
- (void)nSrcHeight;
- (void)bWindowInvalidate;
- abort();
+ long nSrcHeight, bool /*bWindowInvalidate*/)
+{
+ if (nDestX == nSrcX && nDestY == nSrcY)
+ return;
+ sk_sp<SkImage> image
+ = mSurface->makeImageSnapshot(SkIRect::MakeXYWH(nSrcX, nSrcY, nSrcWidth, nSrcHeight));
+ // TODO makeNonTextureImage() ?
+ mSurface->getCanvas()->drawImage(image, nDestX, nDestY);
}
bool SkiaSalGraphicsImpl::blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap)
@@ -249,10 +268,21 @@ void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap&
void SkiaSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
Color nMaskColor)
{
- (void)rPosAry;
- (void)rSalBitmap;
- (void)nMaskColor;
- abort();
+ assert(dynamic_cast<const SkiaSalBitmap*>(&rSalBitmap));
+ SkBitmap tmpBitmap;
+ if (!tmpBitmap.tryAllocN32Pixels(rSalBitmap.GetSize().Width(), rSalBitmap.GetSize().Height()))
+ abort();
+ SkCanvas canvas(tmpBitmap);
+ SkPaint paint;
+ paint.setBlendMode(SkBlendMode::kSrc);
+ canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rSalBitmap).GetSkBitmap(), 0, 0, &paint);
+ tmpBitmap.eraseColor(toSkColor(nMaskColor));
+ mSurface->getCanvas()->drawBitmapRect(
+ tmpBitmap,
+ SkRect::MakeXYWH(rPosAry.mnSrcX, rPosAry.mnSrcY, rPosAry.mnSrcWidth, rPosAry.mnSrcHeight),
+ SkRect::MakeXYWH(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth,
+ rPosAry.mnDestHeight),
+ nullptr);
}
std::shared_ptr<SalBitmap> SkiaSalGraphicsImpl::getBitmap(long nX, long nY, long nWidth,
commit 8787cdcc021906331b001aabac70db7e6175545b
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Sep 24 02:18:38 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:39:44 2019 +0200
Skia alpha handling improvements
CppunitTest_vcl_bitmap_render_test now passes.
Change-Id: I88863c63de84f28b5dfeeaf73d3879bc7cbba1b2
diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index ecb1a1b7d7bf..a526e2b6ee65 100644
--- a/vcl/inc/salbmp.hxx
+++ b/vcl/inc/salbmp.hxx
@@ -102,11 +102,18 @@ protected:
protected:
virtual void updateChecksum() const;
- // helper function to convert data in 1,2,4 bpp formats to a 24bpp format
- static std::unique_ptr< sal_uInt8[] > convertDataTo24Bpp( const sal_uInt8* src,
- int width, int height, int bitCount, int bytesPerRow, const BitmapPalette& palette, bool toBgr );
- static std::unique_ptr< sal_uInt8[] > convertDataTo32Bpp( const sal_uInt8* src,
- int width, int height, int bitCount, int bytesPerRow, const BitmapPalette& palette, bool toBgra );
+ // helper function to convert data in 1,2,4 bpp formats to a 8/24/32bpp format
+ enum class BitConvert
+ {
+ A8,
+ RGB,
+ BGR,
+ RGBA,
+ BGRA
+ };
+ static std::unique_ptr< sal_uInt8[] > convertDataBitCount( const sal_uInt8* src,
+ int width, int height, int bitCount, int bytesPerRow, const BitmapPalette& palette,
+ BitConvert type );
};
#endif
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index 6c99669ba541..0b08c3c81c5f 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -184,6 +184,7 @@ public:
#ifdef DBG_UTIL
void dump(const char* file) const;
+ void dump(const SkBitmap& bitmap, const char* file) const;
#endif
protected:
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx
index 63a54a8555be..7c8ea900c241 100644
--- a/vcl/inc/skia/salbmp.hxx
+++ b/vcl/inc/skia/salbmp.hxx
@@ -64,14 +64,22 @@ public:
// to a 32bpp SkBitmap.
const SkBitmap& GetSkBitmap() const;
+ const SkBitmap& GetAlphaSkBitmap() const;
+
#ifdef DBG_UTIL
void dump(const char* file) const;
#endif
private:
void ResetCachedBitmap();
+#ifdef DBG_UTIL
+ void verify() const;
+#else
+ void verify() const {};
+#endif
SkBitmap mBitmap;
+ SkBitmap mAlphaBitmap; // TODO for use as an alpha channel or mask
BitmapPalette mPalette;
int mBitCount; // bpp
Size mSize;
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index c87da2fa12da..5fa3555480a4 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -403,8 +403,9 @@ GLuint OpenGLSalBitmap::CreateTexture()
VCL_GL_INFO( "::CreateTexture - convert from " << mnBits << " to 24 bits" );
// convert to 24 bits RGB using palette
determineTextureFormat(24, nFormat, nType);
- pData = convertDataTo24Bpp( mpUserBuffer.get(), mnWidth, mnHeight,
- mnBits, mnBytesPerRow, maPalette, nFormat == GL_BGR ).release();
+ pData = convertDataBitCount( mpUserBuffer.get(), mnWidth, mnHeight,
+ mnBits, mnBytesPerRow, maPalette,
+ nFormat == GL_BGR ? BitConvert::BGR : BitConvert::RGB ).release();
bAllocated = true;
}
}
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index a80bf73c0cbe..dfdd6a054cf8 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -90,6 +90,8 @@ void SkiaSalGraphicsImpl::drawPixel(long nX, long nY, Color nColor)
SkCanvas* canvas = mSurface->getCanvas();
SkPaint paint(mPaint);
paint.setColor(toSkColor(nColor));
+ // Apparently drawPixel() is actually expected to set the pixel and not draw it.
+ paint.setBlendMode(SkBlendMode::kSrc); // set as is, including alpha
canvas->drawPoint(nX, nY, paint);
}
@@ -307,16 +309,16 @@ bool SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBi
assert(dynamic_cast<const SkiaSalBitmap*>(&rSourceBitmap));
assert(dynamic_cast<const SkiaSalBitmap*>(&rAlphaBitmap));
SkBitmap tmpBitmap;
- if (!tmpBitmap.tryAllocPixels(SkImageInfo::Make(rSourceBitmap.GetSize().Width(),
- rSourceBitmap.GetSize().Height(),
- kN32_SkColorType, kUnpremul_SkAlphaType)))
+ if (!tmpBitmap.tryAllocN32Pixels(rSourceBitmap.GetSize().Width(),
+ rSourceBitmap.GetSize().Height()))
return false;
SkCanvas canvas(tmpBitmap);
SkPaint paint;
- paint.setBlendMode(SkBlendMode::kDst);
- canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rSourceBitmap).GetSkBitmap(), 0, 0, &paint);
+ paint.setBlendMode(SkBlendMode::kSrc); // copy as is, including alpha
+ canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rAlphaBitmap).GetAlphaSkBitmap(), 0, 0,
+ &paint);
paint.setBlendMode(SkBlendMode::kSrcIn);
- canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rAlphaBitmap).GetSkBitmap(), 0, 0, &paint);
+ canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rSourceBitmap).GetSkBitmap(), 0, 0, &paint);
mSurface->getCanvas()->drawBitmapRect(
tmpBitmap,
SkRect::MakeXYWH(rPosAry.mnSrcX, rPosAry.mnSrcY, rPosAry.mnSrcWidth, rPosAry.mnSrcHeight),
@@ -367,6 +369,14 @@ void SkiaSalGraphicsImpl::dump(const char* file) const
std::ofstream ostream(file, std::ios::binary);
ostream.write(static_cast<const char*>(data->data()), data->size());
}
+
+void SkiaSalGraphicsImpl::dump(const SkBitmap& bitmap, const char* file) const
+{
+ sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);
+ sk_sp<SkData> data = image->encodeToData();
+ std::ofstream ostream(file, std::ios::binary);
+ ostream.write(static_cast<const char*>(data->data()), data->size());
+}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 88677b6132ad..68ea005e5784 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -26,21 +26,23 @@
#include <SkCanvas.h>
#include <SkImage.h>
+#include <SkPixelRef.h>
#ifdef DBG_UTIL
#include <fstream>
+#define CANARY "skia-canary"
#endif
SkiaSalBitmap::SkiaSalBitmap() {}
SkiaSalBitmap::~SkiaSalBitmap() {}
-static SkColorType getSkColorType(int bitCount, const BitmapPalette& palette)
+static SkColorType getSkColorType(int bitCount)
{
switch (bitCount)
{
case 8:
- return palette.IsGreyPalette() ? kGray_8_SkColorType : kAlpha_8_SkColorType;
+ return kGray_8_SkColorType; // see GetAlphaSkBitmap()
case 24:
return kRGB_888x_SkColorType;
case 32:
@@ -72,18 +74,18 @@ bool SkiaSalBitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const Bitmap
Destroy();
if (!isValidBitCount(nBitCount))
return false;
- if (nBitCount >= 8)
+ // Skia does not support paletted images, so convert only types Skia supports.
+ if (nBitCount > 8 || (nBitCount == 8 && (!rPal || rPal.IsGreyPalette())))
{
- if (!mBitmap.tryAllocPixels(
- SkImageInfo::Make(rSize.Width(), rSize.Height(), getSkColorType(nBitCount, rPal),
- nBitCount == 32 ? kPremul_SkAlphaType : kOpaque_SkAlphaType)))
+ if (!mBitmap.tryAllocPixels(SkImageInfo::Make(
+ rSize.Width(), rSize.Height(), getSkColorType(nBitCount), kPremul_SkAlphaType)))
{
return false;
}
}
else
{
- // Skia doesn't support the (ancient) low bpp bit counts, so handle them manually
+ // Paletted images are stored in a buffer and converted as necessary.
int bitScanlineWidth;
if (o3tl::checked_multiply<int>(rSize.Width(), nBitCount, bitScanlineWidth))
{
@@ -93,7 +95,16 @@ bool SkiaSalBitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const Bitmap
mScanlineSize = AlignedWidth4Bytes(bitScanlineWidth);
sal_uInt8* buffer = nullptr;
if (mScanlineSize != 0 && rSize.Height() != 0)
- buffer = new sal_uInt8[mScanlineSize * rSize.Height()];
+ {
+ size_t allocate = mScanlineSize * rSize.Height();
+#ifdef DBG_UTIL
+ allocate += sizeof(CANARY);
+#endif
+ buffer = new sal_uInt8[allocate];
+#if OSL_DEBUG_LEVEL > 0
+ memcpy(buffer + allocate - sizeof(CANARY), CANARY, sizeof(CANARY));
+#endif
+ }
mBuffer.reset(buffer);
}
mPalette = rPal;
@@ -123,9 +134,13 @@ bool SkiaSalBitmap::Create(const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount)
mSize = src.mSize;
if (src.mBuffer != nullptr)
{
- sal_uInt32 dataSize = src.mScanlineSize * src.mSize.Height();
- sal_uInt8* newBuffer = new sal_uInt8[dataSize];
- memcpy(newBuffer, src.mBuffer.get(), dataSize);
+ sal_uInt32 allocate = src.mScanlineSize * src.mSize.Height();
+#ifdef DBG_UTIL
+ assert(memcmp(src.mBuffer.get() + allocate, CANARY, sizeof(CANARY)) == 0);
+ allocate += sizeof(CANARY);
+#endif
+ sal_uInt8* newBuffer = new sal_uInt8[allocate];
+ memcpy(newBuffer, src.mBuffer.get(), allocate);
mBuffer.reset(newBuffer);
mScanlineSize = src.mScanlineSize;
}
@@ -167,61 +182,58 @@ BitmapBuffer* SkiaSalBitmap::AcquireBuffer(BitmapAccessMode nMode)
buffer->mnHeight = mSize.Height();
buffer->mnBitCount = mBitCount;
buffer->maPalette = mPalette;
- if (mBitCount >= 8)
+ if (mBuffer)
{
- buffer->mpBits = static_cast<sal_uInt8*>(mBitmap.getPixels());
- buffer->mnScanlineSize = mBitmap.rowBytes();
+ buffer->mpBits = mBuffer.get();
+ buffer->mnScanlineSize = mScanlineSize;
}
else
{
- buffer->mpBits = mBuffer.get();
- buffer->mnScanlineSize = mScanlineSize;
+ buffer->mpBits = static_cast<sal_uInt8*>(mBitmap.getPixels());
+ buffer->mnScanlineSize = mBitmap.rowBytes();
}
switch (mBitCount)
{
case 1:
-#ifdef OSL_BIGENDIAN
- buffer->mnFormat = ScanlineFormat::N1BitMsbPal | ScanlineFormat::TopDown;
-#else
- buffer->mnFormat = ScanlineFormat::N1BitLsbPal | ScanlineFormat::TopDown;
-#endif
+ buffer->mnFormat = ScanlineFormat::N1BitMsbPal;
break;
case 4:
-#ifdef OSL_BIGENDIAN
- buffer->mnFormat = ScanlineFormat::N4BitMsnPal | ScanlineFormat::TopDown;
-#else
- buffer->mnFormat = ScanlineFormat::N4BitLsnPal | ScanlineFormat::TopDown;
-#endif
+ buffer->mnFormat = ScanlineFormat::N4BitMsnPal;
break;
case 8:
- buffer->mnFormat = ScanlineFormat::N8BitPal | ScanlineFormat::TopDown;
+ // TODO or always N8BitPal?
+ // buffer->mnFormat = !mPalette ? ScanlineFormat::N8BitTcMask : ScanlineFormat::N8BitPal;
+ buffer->mnFormat = ScanlineFormat::N8BitPal;
break;
case 24:
- buffer->mnFormat = ScanlineFormat::N24BitTcRgb | ScanlineFormat::TopDown;
+ buffer->mnFormat = ScanlineFormat::N24BitTcRgb;
break;
case 32:
// TODO are these correct?
buffer->mnFormat = mBitmap.colorType() == kRGBA_8888_SkColorType
- ? ScanlineFormat::N32BitTcBgra
- : ScanlineFormat::N32BitTcArgb;
- buffer->mnFormat |= ScanlineFormat::TopDown;
+ ? ScanlineFormat::N32BitTcRgba
+ : ScanlineFormat::N32BitTcBgra;
break;
default:
abort();
}
+ buffer->mnFormat |= ScanlineFormat::TopDown;
return buffer;
}
void SkiaSalBitmap::ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode)
{
- mPalette = pBuffer->maPalette;
+ if (nMode == BitmapAccessMode::Write) // TODO something more?
+ {
+ mPalette = pBuffer->maPalette;
+ ResetCachedBitmap();
+ }
// Are there any more ground movements underneath us ?
assert(pBuffer->mnWidth == mSize.Width());
assert(pBuffer->mnHeight == mSize.Height());
assert(pBuffer->mnBitCount == mBitCount);
+ verify();
delete pBuffer;
- if (nMode == BitmapAccessMode::Write) // TODO something more?
- ResetCachedBitmap();
}
bool SkiaSalBitmap::GetSystemData(BitmapSystemData& rData)
@@ -254,10 +266,10 @@ const SkBitmap& SkiaSalBitmap::GetSkBitmap() const
{
if (mBuffer && mBitmap.drawsNothing())
{
- assert(mBitCount == 1 || mBitCount == 2 || mBitCount == 4);
- std::unique_ptr<sal_uInt8[]> data = convertDataTo32Bpp(
+ std::unique_ptr<sal_uInt8[]> data = convertDataBitCount(
mBuffer.get(), mSize.Width(), mSize.Height(), mBitCount, mScanlineSize, mPalette,
- kN32_SkColorType == kBGRA_8888_SkColorType); // TODO
+ kN32_SkColorType == kBGRA_8888_SkColorType ? BitConvert::BGRA
+ : BitConvert::RGBA); // TODO
if (!const_cast<SkBitmap&>(mBitmap).installPixels(
SkImageInfo::MakeS32(mSize.Width(), mSize.Height(), kOpaque_SkAlphaType),
data.release(), mSize.Width() * 4,
@@ -267,9 +279,49 @@ const SkBitmap& SkiaSalBitmap::GetSkBitmap() const
return mBitmap;
}
-// Reset the cached bitmap allocatd in GetSkBitmap().
+const SkBitmap& SkiaSalBitmap::GetAlphaSkBitmap() const
+{
+ assert(mBitCount <= 8);
+ if (mAlphaBitmap.drawsNothing())
+ {
+ if (mBuffer)
+ {
+ assert(mBuffer.get());
+ verify();
+ std::unique_ptr<sal_uInt8[]> data
+ = convertDataBitCount(mBuffer.get(), mSize.Width(), mSize.Height(), mBitCount,
+ mScanlineSize, mPalette, BitConvert::A8);
+ if (!const_cast<SkBitmap&>(mAlphaBitmap)
+ .installPixels(
+ SkImageInfo::MakeA8(mSize.Width(), mSize.Height()), data.release(),
+ mSize.Width(),
+ [](void* addr, void*) { delete[] static_cast<sal_uInt8*>(addr); },
+ nullptr))
+ abort();
+ }
+ else
+ {
+ assert(mBitmap.colorType() == kGray_8_SkColorType);
+ // Skia uses a bitmap as an alpha channel only if it's set as kAlpha_8_SkColorType.
+ // But in SalBitmap::Create() it's not quite clear if the 8-bit image will be used
+ // as a mask or as a real bitmap. So mBitmap is always kGray_8_SkColorType
+ // and mAlphaBitmap is kAlpha_8_SkColorType that can be used as a mask.
+ // Make mAlphaBitmap share mBitmap's data.
+ const_cast<SkBitmap&>(mAlphaBitmap)
+ .setInfo(mBitmap.info().makeColorType(kAlpha_8_SkColorType), mBitmap.rowBytes());
+ const_cast<SkBitmap&>(mAlphaBitmap)
+ .setPixelRef(sk_ref_sp(mBitmap.pixelRef()), mBitmap.pixelRefOrigin().x(),
+ mBitmap.pixelRefOrigin().y());
+ return mAlphaBitmap;
+ }
+ }
+ return mAlphaBitmap;
+}
+
+// Reset the cached bitmap allocated in GetSkBitmap().
void SkiaSalBitmap::ResetCachedBitmap()
{
+ mAlphaBitmap.reset();
if (mBuffer)
mBitmap.reset();
}
@@ -282,6 +334,15 @@ void SkiaSalBitmap::dump(const char* file) const
std::ofstream ostream(file, std::ios::binary);
ostream.write(static_cast<const char*>(data->data()), data->size());
}
+
+void SkiaSalBitmap::verify() const
+{
+ if (!mBuffer)
+ return;
+ size_t canary = mScanlineSize * mSize.Height();
+ assert(memcmp(mBuffer.get() + canary, CANARY, sizeof(CANARY)) == 0);
+}
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/bitmap/salbmp.cxx b/vcl/source/bitmap/salbmp.cxx
index c7183e117598..59ff8ef2e5ec 100644
--- a/vcl/source/bitmap/salbmp.cxx
+++ b/vcl/source/bitmap/salbmp.cxx
@@ -143,10 +143,12 @@ ImplPixelFormat* ImplPixelFormat::GetFormat( sal_uInt16 nBits, const BitmapPalet
} // namespace
-std::unique_ptr< sal_uInt8[] > SalBitmap::convertDataTo24Bpp( const sal_uInt8* src,
- int width, int height, int bitCount, int bytesPerRow, const BitmapPalette& palette, bool toBgr )
+std::unique_ptr< sal_uInt8[] > SalBitmap::convertDataBitCount( const sal_uInt8* src,
+ int width, int height, int bitCount, int bytesPerRow, const BitmapPalette& palette, BitConvert type )
{
- std::unique_ptr< sal_uInt8[] > data( new sal_uInt8[width * height * 3] );
+ assert( bitCount == 1 || bitCount == 4 || bitCount == 8 );
+ static const int bpp[] = { 1, 3, 3, 4, 4 };
+ std::unique_ptr< sal_uInt8[] > data( new sal_uInt8[width * height * bpp[ (int)type ]] );
std::unique_ptr<ImplPixelFormat> pSrcFormat(ImplPixelFormat::GetFormat(bitCount, palette));
const sal_uInt8* pSrcData = src;
@@ -158,68 +160,53 @@ std::unique_ptr< sal_uInt8[] > SalBitmap::convertDataTo24Bpp( const sal_uInt8* s
pSrcFormat->StartLine( pSrcData );
sal_uInt32 nX = width;
- if (toBgr)
+ switch( type )
{
- while( nX-- )
- {
- const BitmapColor& c = pSrcFormat->ReadPixel();
- *pDstData++ = c.GetBlue();
- *pDstData++ = c.GetGreen();
- *pDstData++ = c.GetRed();
- }
- }
- else // RGB
- {
- while( nX-- )
- {
- const BitmapColor& c = pSrcFormat->ReadPixel();
- *pDstData++ = c.GetRed();
- *pDstData++ = c.GetGreen();
- *pDstData++ = c.GetBlue();
- }
- }
-
- pSrcData += bytesPerRow;
- }
- return data;
-}
-
-std::unique_ptr< sal_uInt8[] > SalBitmap::convertDataTo32Bpp( const sal_uInt8* src,
- int width, int height, int bitCount, int bytesPerRow, const BitmapPalette& palette, bool toBgra )
-{
- std::unique_ptr< sal_uInt8[] > data( new sal_uInt8[width * height * 4] );
- std::unique_ptr<ImplPixelFormat> pSrcFormat(ImplPixelFormat::GetFormat(bitCount, palette));
-
- const sal_uInt8* pSrcData = src;
- sal_uInt8* pDstData = data.get();
-
- sal_uInt32 nY = height;
- while( nY-- )
- {
- pSrcFormat->StartLine( pSrcData );
-
- sal_uInt32 nX = width;
- if (toBgra)
- {
- while( nX-- )
- {
- const BitmapColor& c = pSrcFormat->ReadPixel();
- *pDstData++ = c.GetBlue();
- *pDstData++ = c.GetGreen();
- *pDstData++ = c.GetRed();
- *pDstData++ = 0xff;
- }
- }
- else // RGBA
- {
- while( nX-- )
- {
- const BitmapColor& c = pSrcFormat->ReadPixel();
- *pDstData++ = c.GetRed();
- *pDstData++ = c.GetGreen();
- *pDstData++ = c.GetBlue();
- *pDstData++ = 0xff;
- }
+ case BitConvert::A8 :
+ while( nX-- )
+ {
+ const BitmapColor& c = pSrcFormat->ReadPixel();
+ *pDstData++ = 0xff - c.GetBlue();
+ }
+ break;
+ case BitConvert::BGR :
+ while( nX-- )
+ {
+ const BitmapColor& c = pSrcFormat->ReadPixel();
+ *pDstData++ = c.GetBlue();
+ *pDstData++ = c.GetGreen();
+ *pDstData++ = c.GetRed();
+ }
+ break;
+ case BitConvert::RGB :
+ while( nX-- )
+ {
+ const BitmapColor& c = pSrcFormat->ReadPixel();
+ *pDstData++ = c.GetRed();
+ *pDstData++ = c.GetGreen();
+ *pDstData++ = c.GetBlue();
+ }
+ break;
+ case BitConvert::BGRA :
+ while( nX-- )
+ {
+ const BitmapColor& c = pSrcFormat->ReadPixel();
+ *pDstData++ = c.GetBlue();
+ *pDstData++ = c.GetGreen();
+ *pDstData++ = c.GetRed();
+ *pDstData++ = 0xff;
+ }
+ break;
+ case BitConvert::RGBA :
+ while( nX-- )
+ {
+ const BitmapColor& c = pSrcFormat->ReadPixel();
+ *pDstData++ = c.GetRed();
+ *pDstData++ = c.GetGreen();
+ *pDstData++ = c.GetBlue();
+ *pDstData++ = 0xff;
+ }
+ break;
}
pSrcData += bytesPerRow;
commit 425bc1db92e84ee33c2b31582db725fd3e06d05d
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Sep 24 02:16:51 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:39:43 2019 +0200
Skia supports 32bit bitmaps
And I'd say OpenGL does as well, but enabling this for OpenGL
makes some tests fail, so let's keep this only for Skia.
Change-Id: Ibbbb460cd053f4a6caa4e3a8a9c6ec52e19dcd38
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index bd28d6895f78..db5241dbe1b9 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -81,6 +81,8 @@ public:
virtual void AfterAppInit() override;
+ std::shared_ptr<vcl::BackendCapabilities> GetBackendCapabilities() override;
+
// dtrans implementation
virtual css::uno::Reference< css::uno::XInterface >
CreateClipboard( const css::uno::Sequence< css::uno::Any >& i_rArguments ) override;
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index 8a076e762f4a..25c081281ea0 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -32,6 +32,9 @@
#include <salwtype.hxx>
+#include <config_features.h>
+#include <vcl/skia/SkiaHelper.hxx>
+
// plugin factory function
extern "C"
{
@@ -213,4 +216,14 @@ std::unique_ptr<GenPspGraphics> X11SalInstance::CreatePrintGraphics()
return std::make_unique<GenPspGraphics>();
}
+std::shared_ptr<vcl::BackendCapabilities> X11SalInstance::GetBackendCapabilities()
+{
+ auto pBackendCapabilities = SalInstance::GetBackendCapabilities();
+#if HAVE_FEATURE_SKIA
+ if( SkiaHelper::isVCLSkiaEnabled())
+ pBackendCapabilities->mbSupportsBitmap32 = true;
+#endif
+ return pBackendCapabilities;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 6d7fa6fe98c5e629ca8dbcc2116f21b0c78de18d
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Sep 23 18:53:09 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:39:42 2019 +0200
better support for <8 bpp in SkiaSalBitmap
Change-Id: Ife79abfb9c36925405fd0b7da40f5274c0339117
diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index b952c8ce4f61..ecb1a1b7d7bf 100644
--- a/vcl/inc/salbmp.hxx
+++ b/vcl/inc/salbmp.hxx
@@ -105,6 +105,8 @@ protected:
// helper function to convert data in 1,2,4 bpp formats to a 24bpp format
static std::unique_ptr< sal_uInt8[] > convertDataTo24Bpp( const sal_uInt8* src,
int width, int height, int bitCount, int bytesPerRow, const BitmapPalette& palette, bool toBgr );
+ static std::unique_ptr< sal_uInt8[] > convertDataTo32Bpp( const sal_uInt8* src,
+ int width, int height, int bitCount, int bytesPerRow, const BitmapPalette& palette, bool toBgra );
};
#endif
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx
index 005e83be76fc..63a54a8555be 100644
--- a/vcl/inc/skia/salbmp.hxx
+++ b/vcl/inc/skia/salbmp.hxx
@@ -59,18 +59,26 @@ public:
sal_uInt8 nTol) override;
virtual bool ConvertToGreyscale() override;
+ // Accesses the internal SkBitmap. If the bit count is one that Skia does
+ // not support natively, data from the internal buffer is converted
+ // to a 32bpp SkBitmap.
+ const SkBitmap& GetSkBitmap() const;
+
#ifdef DBG_UTIL
void dump(const char* file) const;
#endif
private:
+ void ResetCachedBitmap();
+
SkBitmap mBitmap;
BitmapPalette mPalette;
int mBitCount; // bpp
Size mSize;
- std::unique_ptr<sal_uInt8[]> mBuffer; // for 1bpp and 4bpp, Skia doesn't support those
+ // Skia does not natively support 1bpp and 4bpp, so such bitmaps are stored
+ // in a buffer (and converted to 32bpp SkBitmap on-demand using GetSkBitmap()).
+ std::unique_ptr<sal_uInt8[]> mBuffer;
int mScanlineSize; // size of one row in mBuffer
- friend class SkiaSalGraphicsImpl; // TODO
};
#endif // INCLUDED_VCL_INC_OPENGL_SALBMP_H
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index b397abd6af66..a80bf73c0cbe 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -228,7 +228,7 @@ void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap&
return;
assert(dynamic_cast<const SkiaSalBitmap*>(&rSalBitmap));
mSurface->getCanvas()->drawBitmapRect(
- static_cast<const SkiaSalBitmap&>(rSalBitmap).mBitmap,
+ static_cast<const SkiaSalBitmap&>(rSalBitmap).GetSkBitmap(),
SkRect::MakeXYWH(rPosAry.mnSrcX, rPosAry.mnSrcY, rPosAry.mnSrcWidth, rPosAry.mnSrcHeight),
SkRect::MakeXYWH(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth,
rPosAry.mnDestHeight),
@@ -314,11 +314,9 @@ bool SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBi
SkCanvas canvas(tmpBitmap);
SkPaint paint;
paint.setBlendMode(SkBlendMode::kDst);
- canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rSourceBitmap).mBitmap, 0, 0,
- &paint); // TODO bpp < 8?
+ canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rSourceBitmap).GetSkBitmap(), 0, 0, &paint);
paint.setBlendMode(SkBlendMode::kSrcIn);
- canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rAlphaBitmap).mBitmap, 0, 0,
- &paint); // TODO bpp < 8?
+ canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rAlphaBitmap).GetSkBitmap(), 0, 0, &paint);
mSurface->getCanvas()->drawBitmapRect(
tmpBitmap,
SkRect::MakeXYWH(rPosAry.mnSrcX, rPosAry.mnSrcY, rPosAry.mnSrcWidth, rPosAry.mnSrcHeight),
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index ff0a9ed1897b..88677b6132ad 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -215,12 +215,13 @@ BitmapBuffer* SkiaSalBitmap::AcquireBuffer(BitmapAccessMode nMode)
void SkiaSalBitmap::ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode)
{
mPalette = pBuffer->maPalette;
- (void)nMode; // TODO?
// Are there any more ground movements underneath us ?
assert(pBuffer->mnWidth == mSize.Width());
assert(pBuffer->mnHeight == mSize.Height());
assert(pBuffer->mnBitCount == mBitCount);
delete pBuffer;
+ if (nMode == BitmapAccessMode::Write) // TODO something more?
+ ResetCachedBitmap();
}
bool SkiaSalBitmap::GetSystemData(BitmapSystemData& rData)
@@ -249,10 +250,34 @@ bool SkiaSalBitmap::Replace(const Color& rSearchColor, const Color& rReplaceColo
bool SkiaSalBitmap::ConvertToGreyscale() { return false; }
+const SkBitmap& SkiaSalBitmap::GetSkBitmap() const
+{
+ if (mBuffer && mBitmap.drawsNothing())
+ {
+ assert(mBitCount == 1 || mBitCount == 2 || mBitCount == 4);
+ std::unique_ptr<sal_uInt8[]> data = convertDataTo32Bpp(
+ mBuffer.get(), mSize.Width(), mSize.Height(), mBitCount, mScanlineSize, mPalette,
+ kN32_SkColorType == kBGRA_8888_SkColorType); // TODO
+ if (!const_cast<SkBitmap&>(mBitmap).installPixels(
+ SkImageInfo::MakeS32(mSize.Width(), mSize.Height(), kOpaque_SkAlphaType),
+ data.release(), mSize.Width() * 4,
+ [](void* addr, void*) { delete[] static_cast<sal_uInt8*>(addr); }, nullptr))
+ abort();
+ }
+ return mBitmap;
+}
+
+// Reset the cached bitmap allocatd in GetSkBitmap().
+void SkiaSalBitmap::ResetCachedBitmap()
+{
+ if (mBuffer)
+ mBitmap.reset();
+}
+
#ifdef DBG_UTIL
void SkiaSalBitmap::dump(const char* file) const
{
- sk_sp<SkImage> image = SkImage::MakeFromBitmap(mBitmap);
+ sk_sp<SkImage> image = SkImage::MakeFromBitmap(GetSkBitmap());
sk_sp<SkData> data = image->encodeToData();
std::ofstream ostream(file, std::ios::binary);
ostream.write(static_cast<const char*>(data->data()), data->size());
diff --git a/vcl/source/bitmap/salbmp.cxx b/vcl/source/bitmap/salbmp.cxx
index 0cf6fd3ab93a..c7183e117598 100644
--- a/vcl/source/bitmap/salbmp.cxx
+++ b/vcl/source/bitmap/salbmp.cxx
@@ -184,4 +184,47 @@ std::unique_ptr< sal_uInt8[] > SalBitmap::convertDataTo24Bpp( const sal_uInt8* s
return data;
}
+std::unique_ptr< sal_uInt8[] > SalBitmap::convertDataTo32Bpp( const sal_uInt8* src,
+ int width, int height, int bitCount, int bytesPerRow, const BitmapPalette& palette, bool toBgra )
+{
+ std::unique_ptr< sal_uInt8[] > data( new sal_uInt8[width * height * 4] );
+ std::unique_ptr<ImplPixelFormat> pSrcFormat(ImplPixelFormat::GetFormat(bitCount, palette));
+
+ const sal_uInt8* pSrcData = src;
+ sal_uInt8* pDstData = data.get();
+
+ sal_uInt32 nY = height;
+ while( nY-- )
+ {
+ pSrcFormat->StartLine( pSrcData );
+
+ sal_uInt32 nX = width;
+ if (toBgra)
+ {
+ while( nX-- )
+ {
+ const BitmapColor& c = pSrcFormat->ReadPixel();
+ *pDstData++ = c.GetBlue();
+ *pDstData++ = c.GetGreen();
+ *pDstData++ = c.GetRed();
+ *pDstData++ = 0xff;
+ }
+ }
+ else // RGBA
+ {
+ while( nX-- )
+ {
+ const BitmapColor& c = pSrcFormat->ReadPixel();
+ *pDstData++ = c.GetRed();
+ *pDstData++ = c.GetGreen();
+ *pDstData++ = c.GetBlue();
+ *pDstData++ = 0xff;
+ }
+ }
+
+ pSrcData += bytesPerRow;
+ }
+ return data;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 0e65933db573cccb80512567abf7c4ab235a9377
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Sep 23 18:29:26 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Oct 12 19:39:41 2019 +0200
move opengl's code for converting 1,2,4bpp to 24bpp
To be reused by the Skia code.
Change-Id: If3befdbd86d98a2d931c7a366c47be57a0ae6c59
diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index 103856dfae26..b952c8ce4f61 100644
--- a/vcl/inc/salbmp.hxx
+++ b/vcl/inc/salbmp.hxx
@@ -102,6 +102,9 @@ protected:
protected:
virtual void updateChecksum() const;
+ // helper function to convert data in 1,2,4 bpp formats to a 24bpp format
+ static std::unique_ptr< sal_uInt8[] > convertDataTo24Bpp( const sal_uInt8* src,
+ int width, int height, int bitCount, int bytesPerRow, const BitmapPalette& palette, bool toBgr );
};
#endif
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index f626c207e488..c87da2fa12da 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -307,103 +307,6 @@ void OpenGLSalBitmap::DeallocateUserData()
namespace {
-class ImplPixelFormat
-{
-protected:
- sal_uInt8* mpData;
-public:
- static ImplPixelFormat* GetFormat( sal_uInt16 nBits, const BitmapPalette& rPalette );
-
- virtual void StartLine( sal_uInt8* pLine ) { mpData = pLine; }
- virtual const BitmapColor& ReadPixel() = 0;
- virtual ~ImplPixelFormat() { }
-};
-
-class ImplPixelFormat8 : public ImplPixelFormat
-{
-private:
- const BitmapPalette& mrPalette;
-
-public:
- explicit ImplPixelFormat8( const BitmapPalette& rPalette )
- : mrPalette( rPalette )
- {
- }
- virtual const BitmapColor& ReadPixel() override
- {
- assert( mrPalette.GetEntryCount() > *mpData );
- return mrPalette[ *mpData++ ];
- }
-};
-
-class ImplPixelFormat4 : public ImplPixelFormat
-{
-private:
- const BitmapPalette& mrPalette;
- sal_uInt32 mnX;
- sal_uInt32 mnShift;
-
-public:
- explicit ImplPixelFormat4( const BitmapPalette& rPalette )
- : mrPalette( rPalette )
- , mnX(0)
- , mnShift(4)
- {
- }
- virtual void StartLine( sal_uInt8* pLine ) override
- {
- mpData = pLine;
- mnX = 0;
- mnShift = 4;
- }
- virtual const BitmapColor& ReadPixel() override
- {
- sal_uInt32 nIdx = ( mpData[mnX >> 1] >> mnShift) & 0x0f;
- assert( mrPalette.GetEntryCount() > nIdx );
- const BitmapColor& rColor = mrPalette[nIdx];
- mnX++;
- mnShift ^= 4;
- return rColor;
- }
-};
-
-class ImplPixelFormat1 : public ImplPixelFormat
-{
-private:
- const BitmapPalette& mrPalette;
- sal_uInt32 mnX;
-
-public:
- explicit ImplPixelFormat1( const BitmapPalette& rPalette )
- : mrPalette(rPalette)
- , mnX(0)
- {
- }
- virtual void StartLine( sal_uInt8* pLine ) override
- {
- mpData = pLine;
- mnX = 0;
- }
- virtual const BitmapColor& ReadPixel() override
- {
- const BitmapColor& rColor = mrPalette[ (mpData[mnX >> 3 ] >> ( 7 - ( mnX & 7 ) )) & 1];
- mnX++;
- return rColor;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list