[Libreoffice-commits] core.git: Branch 'feature/opengl-canvas-rework' - 7980 commits - accessibility/inc accessibility/source android/Bootstrap android/CustomTarget_android_desktop.mk android/CustomTarget_lo_android.mk android/experimental android/Makefile android/mobile-config.py android/Module_android.mk animations/source apple_remote/source autogen.sh avmedia/inc avmedia/Library_avmediagst.mk avmedia/Library_avmedia.mk avmedia/Library_avmediaogl.mk avmedia/Library_avmediavlc.mk avmedia/Module_avmedia.mk avmedia/source basctl/inc basctl/Module_basctl.mk basctl/source basctl/uiconfig basebmp/Library_basebmp.mk basebmp/source basebmp/test basegfx/CppunitTest_basegfx.mk basegfx/inc basegfx/Library_basegfx.mk basegfx/source basegfx/test basic/inc basic/Library_sb.mk basic/Module_basic.mk basic/qa basic/source basic/util bean/com bean/inc bean/Library_officebean.mk bean/native bean/qa bean/test binaryurp/qa binaryurp/source bin/distro-install-file-lists bin/distro-install-sdk bin/extract-tooltip.py bin/find-german-comments bin/findunusedcode bin/find-unused-defines.awk bin/find-unused-defines.sh bin/gbuild-to-ide bin/generate-bash-completion bin/gen-iwyu-dummy-lib bin/gen-iwyu-dummy-lib.awk bin/get-bugzilla-attachments-by-mimetype bin/lo-all-static-libs bin/lo-generate-source-tarball bin/lolcat bin/parse-perfcheck.py bin/refcount_leak.py bin/run bin/update_pch.sh bridges/inc bridges/Jar_java_uno.mk bridges/Library_cpp_uno.mk bridges/source bridges/test canvas/Library_cairocanvas.mk canvas/Library_directx9canvas.mk canvas/Library_gdipluscanvas.mk canvas/Library_oglcanvas.mk canvas/opengl canvas/Package_opengl.mk canvas/source canvas/StaticLibrary_directxcanvas.mk canvas/workben chart2/CppunitTest_chart2_export.mk chart2/CppunitTest_chart2_import.mk chart2/CppunitTest_chart2_xshape.mk chart2/inc chart2/Library_chartcontroller.mk chart2/Library_chartcore.mk chart2/Library_chartopengl.mk chart2/opengl chart2/qa chart2/source chart2/uiconfig clew/Library_clew.mk clew/Makefile clew/ Module_clew.mk clew/source cli_ure/qa cli_ure/readme.txt cli_ure/source codemaker/source comphelper/inc comphelper/Library_comphelper.mk comphelper/qa comphelper/source compilerplugins/clang config_host/config_features.h.in config_host/config_folders.h.in config_host/config_global.h.in config_host/config_oauth2.h.in config_host.mk.in configmgr/CppunitTest_configmgr_unit.mk configmgr/inc configmgr/Module_configmgr.mk configmgr/qa configmgr/source configure.ac connectivity/com connectivity/CppunitTest_connectivity_commontools.mk connectivity/inc connectivity/Jar_ConnectivityTools.mk connectivity/JunitTest_complex.mk connectivity/Module_connectivity.mk connectivity/org connectivity/qa connectivity/registry connectivity/source cppcanvas/CppunitTest_cppcanvas_emfplus.mk cppcanvas/inc cppcanvas/qa cppcanvas/source cppuhelper/inc cppuhelper/qa cppuhelper/source cppuhelper/test cppu/qa cppu/source cpputools/source crashrep/CustomTarget_crashrep_res.mk crashrep/Executable_crashrep.mk crashre p/Makefile crashrep/Module_crashrep.mk crashrep/README crashrep/source crashrep/WinResTarget_crashrep.mk cui/inc cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk dbaccess/CppunitTest_dbaccess_dialog_save.mk dbaccess/CppunitTest_dbaccess_embeddeddb_performancetest.mk dbaccess/CppunitTest_dbaccess_empty_stdlib_save.mk dbaccess/CppunitTest_dbaccess_firebird_test.mk dbaccess/CppunitTest_dbaccess_hsqldb_test.mk dbaccess/CppunitTest_dbaccess_macros_test.mk dbaccess/CppunitTest_dbaccess_nolib_save.mk dbaccess/CppunitTest_dbaccess_RowSetClones.mk dbaccess/inc dbaccess/Library_dbu.mk dbaccess/Module_dbaccess.mk dbaccess/PythonTest_dbaccess_python.mk dbaccess/qa dbaccess/source dbaccess/uiconfig dbaccess/util desktop/Executable_crashrep_com.mk desktop/Executable_soffice_bin.mk desktop/Executable_soffice.mk desktop/Executable_unopkg.mk desktop/inc desktop/Library_active_native.mk desktop/Library_passive_native.mk desktop/Library_sofficeapp.mk desktop/Module_desktop.mk desktop/Pac kage_sbase_sh.mk desktop/Package_scalc_sh.mk desktop/Package_scripts.mk desktop/Package_sdraw_sh.mk desktop/Package_simpress_sh.mk desktop/Package_smath_sh.mk desktop/Package_swriter_sh.mk desktop/Pagein_common.mk desktop/scripts desktop/source desktop/StaticLibrary_winextendloaderenv.mk desktop/StaticLibrary_winloader.mk desktop/test desktop/uiconfig desktop/unx desktop/win32 dictionaries distro-configs/LibreOfficeAndroidAarch64.conf distro-configs/LibreOfficeAndroid.conf distro-configs/LibreOfficeAndroidX86.conf distro-configs/LibreOfficeCoverity.conf distro-configs/LibreOfficeLinux.conf distro-configs/LibreOfficeOpenBSD.conf distro-configs/LibreOfficeWin32.conf distro-configs/LibreOfficeWin64.conf distro-configs/OxygenOfficeLinux.conf download.lst drawinglayer/inc drawinglayer/source dtrans/source dtrans/test editeng/CppunitTest_editeng_core.mk editeng/CustomTarget_generated.mk editeng/inc editeng/Library_editeng.mk editeng/Module_editeng.mk editeng/qa editeng/source embeddedobj/ source embeddedobj/test embedserv/source eventattacher/source extensions/Executable_pluginapp.bin.mk extensions/inc extensions/Library_scn.mk extensions/qa extensions/source extensions/test extensions/uiconfig extensions/workben external/apache-commons external/beanshell external/boost external/coinmp external/collada2gltf external/cppunit external/curl external/firebird external/glew external/glm external/graphite external/harfbuzz external/hunspell external/icu external/jpeg-turbo external/languagetool external/lcms2 external/libabw external/libatomic_ops external/libcdr external/libcmis external/libebook external/libetonyek external/libexttextcat external/libfreehand external/libgltf external/liblangtag external/libmspub external/libmwaw external/libodfgen external/liborcus external/libpagemaker external/librevenge external/libvisio external/libwpd external/libwpg external/libwps external/libxml2 external/libxmlsec external/libxslt external/lpsolve external/Module_external.mk ext ernal/mysqlcppconn external/nss external/openldap external/openssl external/poppler external/python3 external/redland external/unixODBC external/vigra extras/Module_extras.mk extras/Package_tplofficorr.mk extras/Package_tploffimisc.mk extras/Package_tplpersonal.mk extras/Package_tplpresnt.mk extras/source filter/Configuration_filter.mk filter/CppunitTest_filter_eps_test.mk filter/CppunitTest_filter_met_test.mk filter/CppunitTest_filter_pcd_test.mk filter/Library_pdffilter.mk filter/Library_textfd.mk filter/Module_filter.mk filter/qa filter/source filter/uiconfig forms/inc forms/Library_frm.mk forms/qa forms/source forms/util formula/Library_for.mk formula/README formula/source formula/uiconfig fpicker/source fpicker/uiconfig framework/inc framework/JunitTest_framework_complex.mk framework/qa framework/source g .git-hooks/commit-msg .git-hooks/post-merge .gitignore helpcompiler/inc helpcompiler/source helpcontent2 hwpfilter/inc hwpfilter/source i18nlangtag/qa i18nlangtag/source i18np ool/inc i18npool/Library_i18npool.mk i18npool/qa i18npool/source i18npool/util i18nutil/source icon-themes/breeze icon-themes/crystal icon-themes/galaxy icon-themes/hicontrast icon-themes/human icon-themes/industrial icon-themes/oxygen icon-themes/sifr icon-themes/tango icon-themes/tango_testing idlc/inc idlc/source idl/inc idl/source include/avmedia include/basebmp include/basegfx include/basic include/canvas include/clew include/codemaker include/com include/comphelper include/connectivity include/cppcanvas include/cppu include/cppuhelper include/dbaccess include/drawinglayer include/editeng include/filter include/formula include/framework include/helpcompiler include/i18nlangtag include/i18nutil include/jvmaccess include/jvmfwk include/LibreOfficeKit include/linguistic include/o3tl include/oox include/opencl include/osl include/package include/postwin.h include/registry include/rsc include/rtl include/sal include/salhelper include/sax include/sfx2 include/sot include/store includ e/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 instsetoo_native/CustomTarget_install.mk instsetoo_native/CustomTarget_setup.mk instsetoo_native/inc_ooohelppack instsetoo_native/inc_openoffice instsetoo_native/inc_sdkoo instsetoo_native/Module_instsetoo_native.mk instsetoo_native/ooenv instsetoo_native/Package_instsetoo_native_ooenv.mk instsetoo_native/Package_setup.mk instsetoo_native/util io/CppunitTest_io_textinputstream.mk io/Module_io.mk io/qa ios/CustomTarget_LibreOffice_app.mk ios/CustomTarget_MobileLibreOffice_app.mk ios/CustomTarget_TiledLibreOffice_app.mk ios/Executable_LibreOffice.mk ios/experimental io/source ios/shared io/test javaunohelper/com javaunohelper/Jar_juh.mk javaunohelper/JunitTest_juh.mk javaunohelper/source javaunohelper/test jurt/com jurt/Jar_jurt.mk jurt/JunitTest_java_remote.mk jurt/Jun itTest_uno.mk jurt/Library_jpipe.mk jurt/source jurt/test jurt/workbench jvmaccess/source jvmfwk/CustomTarget_jvmfwk_jvmfwk3_ini.mk jvmfwk/inc jvmfwk/Module_jvmfwk.mk jvmfwk/Package_jvmfwk_jvmfwk3_ini.mk jvmfwk/Package_rcfiles.mk jvmfwk/plugins jvmfwk/source l10ntools/inc l10ntools/source Library_merged.mk librelogo/CustomTarget_librelogo.mk librelogo/Module_librelogo.mk libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk libreofficekit/Executable_gtktiledviewer.mk libreofficekit/Library_libreofficekitgtk.mk libreofficekit/Module_libreofficekit.mk libreofficekit/qa libreofficekit/README libreofficekit/source lingucomponent/source linguistic/inc linguistic/qa linguistic/source linguistic/workben lotuswordpro/source Makefile.fetch Makefile.in mysqlc/Library_mysqlc.mk mysqlc/source nlpsolver/Jar_EvolutionarySolver.mk nlpsolver/Jar_nlpsolver.mk nlpsolver/src nlpsolver/ThirdParty o3tl/CppunitTest_o3tl_tests.mk o3tl/qa odk/config odk/CppunitTest_odk_checkapi.mk odk/docs odk/exampl es odk/index.html odk/index_online.html odk/Package_config.mk odk/Package_odk_headers.mk odk/qa odk/settings odk/source odk/util offapi/com offapi/UnoApi_offapi.mk officecfg/Configuration_officecfg.mk officecfg/registry oox/CustomTarget_generated.mk oox/inc oox/README oox/source opencl/inc opencl/Library_opencl.mk opencl/Makefile opencl/Module_opencl.mk opencl/README opencl/source package/inc package/Library_package2.mk package/source postprocess/CppunitTest_services.mk postprocess/CustomTarget_images.mk postprocess/CustomTarget_registry.mk postprocess/qa postprocess/Rdb_services.mk pyuno/CustomTarget_python_shell.mk pyuno/CustomTarget_pyuno_pythonloader_ini.mk pyuno/demo pyuno/inc pyuno/Module_pyuno.mk pyuno/Package_python_scripts.mk pyuno/Package_pyuno_pythonloader_ini.mk pyuno/source pyuno/zipcore qadevOOo/Jar_OOoRunnerLight.mk qadevOOo/Jar_OOoRunner.mk qadevOOo/Module_qadevOOo.mk qadevOOo/qa qadevOOo/runner qadevOOo/testdocs qadevOOo/tests readlicense_oo/docs readlicense_oo/lice nse README.Android README.cross registry/source registry/tools registry/workben remotebridges/examples remotebridges/source reportbuilder/Jar_reportbuilder.mk reportbuilder/java reportdesign/inc reportdesign/qa reportdesign/source reportdesign/uiconfig RepositoryExternal.mk RepositoryFixes.mk Repository.mk RepositoryModule_host.mk ridljar/com ridljar/JunitTest_util.mk rsc/inc rsc/source sal/android sal/cpprt sal/cppunittester sal/CppunitTest_sal_rtl_oustringbuffer.mk salhelper/qa salhelper/source sal/inc sal/Library_sal.mk sal/osl sal/qa sal/rtl sal/test sal/textenc sal/workben sax/Library_expwrap.mk sax/qa sax/source sax/test scaddins/Library_analysis.mk scaddins/source sccomp/source sc/CppunitTest_sc_annotationobj.mk sc/CppunitTest_sc_annotationshapeobj.mk sc/CppunitTest_sc_annotationsobj.mk sc/CppunitTest_sc_bugfix_test.mk sc/CppunitTest_sc_cellrangeobj.mk sc/CppunitTest_sc_chart_regression_test.mk sc/CppunitTest_sc_condformats.mk sc/CppunitTest_sc_databaserangeobj.mk sc/CppunitT est_sc_datapilotfieldobj.mk sc/CppunitTest_sc_datapilottableobj.mk sc/CppunitTest_sc_editfieldobj_cell.mk sc/CppunitTest_sc_editfieldobj_header.mk sc/CppunitTest_sc_html_export_test.mk sc/CppunitTest_sc_macros_test.mk sc/CppunitTest_sc_modelobj.mk sc/CppunitTest_sc_namedrangeobj.mk sc/CppunitTest_sc_namedrangesobj.mk sc/CppunitTest_sc_opencl_test.mk sc/CppunitTest_sc_outlineobj.mk sc/CppunitTest_sc_perfobj.mk sc/CppunitTest_sc_rangelst_test.mk sc/CppunitTest_sc_recordchanges.mk sc/CppunitTest_sc_styleloaderobj.mk sc/CppunitTest_sc_subsequent_export_test.mk sc/CppunitTest_sc_tablesheetobj.mk sc/CppunitTest_sc_tablesheetsobj.mk sc/CppunitTest_sc_ucalc.mk sc/inc sc/Library_scfilt.mk sc/Library_sc.mk sc/Library_scopencl.mk sc/Library_scqahelper.mk sc/Library_scui.mk sc/Module_sc.mk scp2/AutoInstall.mk scp2/inc scp2/InstallModule_accessories.mk scp2/InstallModule_base.mk scp2/InstallModule_calc.mk scp2/InstallModule_crashrep.mk scp2/InstallModule_draw.mk scp2/InstallModule_extensions.mk scp2/InstallModule_impress.mk scp2/InstallModule_math.mk scp2/InstallModule_ooo.mk scp2/InstallModule_python.mk scp2/InstallModule_quickstart.mk scp2/InstallModule_writer.mk scp2/InstallModule_xsltfilter.mk scp2/InstallScript_setup_osl.mk scp2/Module_scp2.mk scp2/source sc/qa scripting/examples scripting/java scripting/Module_scripting.mk scripting/Pyuno_mailmerge.mk scripting/source sc/sdi sc/source sc/uiconfig sc/UIConfig_scalc.mk sc/workben sd/AllLangResTarget_sd.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_uimpress.mk sdext/inc sdext/source sd/inc sd/Module_sd.mk sd/qa sd/README_REMOTE sd/sdi sd/source sd/uiconfig sd/UIConfig_simpress.mk setup_native/Library_shlxtmsi.mk setup_native/Package_scripts.mk setup_native/scripts setup_native/source sfx2/inc sfx2/JunitTest_sfx2_complex.mk sfx2/Library_sfx.mk sfx2/qa sfx2/sdi sfx2/source sfx2/uiconfig shell/Executable_gnom e_open_url.mk shell/inc shell/Module_shell.mk shell/Package_scripts_kde.mk shell/source slideshow/inc slideshow/Library_OGLTrans.mk slideshow/Library_slideshow.mk slideshow/source slideshow/test smoketest/data smoketest/libtest.cxx solenv/bin solenv/doc solenv/gbuild solenv/gcc-wrappers solenv/gdb solenv/inc soltools/cpp soltools/mkdepend sot/inc sot/qa sot/source sot/workben starmath/CppunitTest_starmath_import.mk starmath/inc starmath/Library_sm.mk starmath/Module_starmath.mk starmath/qa starmath/source starmath/uiconfig starmath/UIConfig_smath.mk stoc/inc stoc/Library_bootstrap.mk stoc/Library_stocservices.mk stoc/source stoc/test stoc/util store/source store/workben svgio/CppunitTest_svgio.mk svgio/inc svgio/qa svgio/source svl/inc svl/Library_svl.mk svl/qa svl/source svl/unx svtools/CppunitTest_svtools_graphic.mk svtools/inc svtools/langsupport svtools/qa svtools/README svtools/source svtools/uiconfig svx/AllLangResTarget_ofa.mk svx/AllLangResTarget_svx.mk svx/Executable_gengal .mk svx/inc svx/Library_svxcore.mk svx/Library_svx.mk svx/qa svx/sdi svx/source svx/uiconfig svx/UIConfig_svx.mk svx/util svx/workben sw/AllLangResTarget_sw.mk sw/CppunitTest_sw_filters_test.mk sw/CppunitTest_sw_globalfilter.mk sw/CppunitTest_sw_htmlexport.mk sw/CppunitTest_sw_htmlimport.mk sw/CppunitTest_sw_layout_test.mk sw/CppunitTest_sw_macros_test.mk sw/CppunitTest_sw_mailmerge.mk sw/CppunitTest_sw_odfexport.mk sw/CppunitTest_sw_odfimport.mk sw/CppunitTest_sw_ooxmlfieldexport.mk sw/CppunitTest_sw_ooxmlimport.mk sw/CppunitTest_sw_ooxmlsdrexport.mk sw/CppunitTest_sw_ooxmlw14export.mk sw/CppunitTest_sw_rtfexport.mk sw/CppunitTest_sw_rtfimport.mk sw/CppunitTest_sw_tox.mk sw/CppunitTest_sw_uiwriter.mk sw/CppunitTest_sw_uwriter.mk sw/CppunitTest_sw_ww8export.mk sw/CppunitTest_sw_ww8import.mk sw/CustomTarget_generated.mk sw/Executable_tiledrendering.mk swext/mediawiki sw/inc sw/Library_swd.mk sw/Library_sw.mk sw/Library_swui.mk sw/Module_sw.mk sw/ooxmlexport_setup.mk sw/qa sw/README s w/sdi sw/source sw/uiconfig sw/UIConfig_swriter.mk sw/util sysui/CustomTarget_solaris.mk sysui/desktop test/Library_test.mk test/Package_unittest.mk test/source testtools/com testtools/qa testtools/source test/user-template toolkit/Library_tk.mk toolkit/qa toolkit/source toolkit/test tools/CppunitTest_tools_test.mk tools/inc tools/Library_tl.mk tools/qa tools/source touch/CustomTarget_touch_javamaker.mk touch/idl touch/InternalUnoApi_touch.mk touch/Library_libotouch.mk touch/Makefile touch/Module_touch.mk touch/README touch/source translations tubes/source ucbhelper/Library_ucbhelper.mk ucbhelper/source ucb/qa ucb/source ucb/test udkapi/com UnoControls/inc UnoControls/Makefile UnoControls/source unodevtools/source unoidl/source unotest/Library_unobootstrapprotector.mk unotest/source unotools/CppunitTest_unotools_fontdefs.mk unotools/inc unotools/JunitTest_unotools_complex.mk unotools/qa unotools/source unoxml/inc unoxml/Library_unoxml.mk unoxml/qa unoxml/source unusedcode.easy ure/P ackage_install.mk ure/Rdb_ure.mk ure/source uui/inc uui/Library_uui.mk uui/source uui/uiconfig uui/UIConfig_uui.mk vbahelper/inc vbahelper/Module_vbahelper.mk vbahelper/source vcl/android vcl/CppunitTest_vcl_outdev.mk vcl/Executable_icontest.mk vcl/Executable_mtfdemo.mk vcl/Executable_outdevgrind.mk vcl/Executable_ui-previewer.mk vcl/Executable_vcldemo.mk vcl/generic vcl/headless vcl/inc vcl/ios vcl/Library_vcl.mk vcl/Library_vclopengl.mk vcl/Library_vclplug_gen.mk vcl/Library_vclplug_gtk3.mk vcl/Library_vclplug_gtk.mk vcl/Library_vclplug_kde4.mk vcl/Library_vclplug_kde.mk vcl/Module_vcl.mk vcl/null vcl/opengl vcl/osx vcl/Package_fontunxppds.mk vcl/Package_opengl.mk vcl/qa vcl/quartz vcl/README vcl/README.GDIMetaFile vcl/source vcl/StaticLibrary_glxtest.mk vcl/StaticLibrary_headless.mk vcl/uiconfig vcl/unx vcl/win vcl/WinResTarget_vcl.mk vcl/workben winaccessibility/source wizards/com wizards/Jar_commonwizards.mk wizards/Package_access2base.mk wizards/source writerfilter/CppunitTest _writerfilter_misc.mk writerfilter/documentation writerfilter/inc writerfilter/Library_writerfilter.mk writerfilter/qa writerfilter/README writerfilter/source writerfilter/util writerperfect/inc writerperfect/Library_wpftdraw.mk writerperfect/Library_wpftimpress.mk writerperfect/Library_wpftwriter.mk writerperfect/qa writerperfect/source xmerge/source xmlhelp/source xmloff/dtd xmloff/inc xmloff/Module_xmloff.mk xmloff/qa xmloff/source xmlscript/dtd xmlscript/inc xmlscript/source xmlscript/test xmlsecurity/inc xmlsecurity/source xmlsecurity/test_docs xmlsecurity/uiconfig
Michael Jaumann
meta_dev at yahoo.com
Tue Mar 3 01:09:06 PST 2015
Rebased ref, commits from common ancestor:
commit ea3d468aa4407137b6d2e1dfd3e9a6bd43799956
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Mon Mar 2 08:37:57 2015 +0000
unecessary check, will be covered before
Change-Id: Idcad49eae7ae1ab272babec6dc8b00e8e55f275e
diff --git a/canvas/source/opengl/ogl_canvastools.cxx b/canvas/source/opengl/ogl_canvastools.cxx
index 3c09f96..6490cff 100644
--- a/canvas/source/opengl/ogl_canvastools.cxx
+++ b/canvas/source/opengl/ogl_canvastools.cxx
@@ -48,8 +48,7 @@ namespace oglcanvas
vertices.push_back(glm::vec2(rPt.getX(),rPt.getY()));
}
- if(vertices.size() !=0)
- renderHelper->renderVertexConstColor(vertices, color, GL_TRIANGLES);
+ renderHelper->renderVertexConstColor(vertices, color, GL_TRIANGLES);
}
}
@@ -73,8 +72,7 @@ namespace oglcanvas
const ::basegfx::B2DPoint& rPt( rTriangulatedPolygon.getB2DPoint(i) );
vertices.push_back(glm::vec2(rPt.getX(),rPt.getY()));
}
- if(vertices.size()!=0)
- renderHelper->renderTextureTransform( vertices, nWidth, nHeight, color, GL_TRIANGLES, transform);
+ renderHelper->renderTextureTransform( vertices, nWidth, nHeight, color, GL_TRIANGLES, transform);
}
}
@@ -104,8 +102,7 @@ namespace oglcanvas
const ::basegfx::B2DPoint& rPt( rPolygon.getB2DPoint( j % nPts ) );
vertices.push_back(glm::vec2(rPt.getX(),rPt.getY()));
}
- if(vertices.size()!=0)
- renderHelper->renderVertexConstColor(vertices, color, GL_LINE_STRIP);
+ renderHelper->renderVertexConstColor(vertices, color, GL_LINE_STRIP);
}
}
commit c65a8e19ea94ade34ce15fbf83a66960cd3f5d6b
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Fri Feb 27 10:46:49 2015 +0000
don't try to render with no vertices
Change-Id: I42a5c21b32771fcff1fd148b55cad2d697648409
diff --git a/canvas/source/opengl/ogl_canvascustomsprite.cxx b/canvas/source/opengl/ogl_canvascustomsprite.cxx
index 7acaceb..be4372e 100644
--- a/canvas/source/opengl/ogl_canvascustomsprite.cxx
+++ b/canvas/source/opengl/ogl_canvascustomsprite.cxx
@@ -218,14 +218,17 @@ namespace oglcanvas
aSpriteSizePixel.x,
aSpriteSizePixel.y)));
- std::vector<glm::vec2> vertices;
- vertices.reserve(rTriangulatedPolygon.count());
- for( sal_uInt32 i=0; i<rTriangulatedPolygon.count(); i++ )
+ if(rTriangulatedPolygon.count()!=0)
{
- const ::basegfx::B2DPoint& rPt( rTriangulatedPolygon.getB2DPoint(i) );
- vertices.push_back(glm::vec2(rPt.getX(), rPt.getY()));
+ std::vector<glm::vec2> vertices;
+ vertices.reserve(rTriangulatedPolygon.count());
+ for( sal_uInt32 i=0; i<rTriangulatedPolygon.count(); i++ )
+ {
+ const ::basegfx::B2DPoint& rPt( rTriangulatedPolygon.getB2DPoint(i) );
+ vertices.push_back(glm::vec2(rPt.getX(), rPt.getY()));
+ }
+ pRenderHelper->renderVertexTex( vertices, fWidth, fHeight, color, GL_TRIANGLES);
}
- pRenderHelper->renderVertexTex( vertices, fWidth, fHeight, color, GL_TRIANGLES);
}
else
{
diff --git a/canvas/source/opengl/ogl_canvastools.cxx b/canvas/source/opengl/ogl_canvastools.cxx
index 6490cff..3c09f96 100644
--- a/canvas/source/opengl/ogl_canvastools.cxx
+++ b/canvas/source/opengl/ogl_canvastools.cxx
@@ -48,7 +48,8 @@ namespace oglcanvas
vertices.push_back(glm::vec2(rPt.getX(),rPt.getY()));
}
- renderHelper->renderVertexConstColor(vertices, color, GL_TRIANGLES);
+ if(vertices.size() !=0)
+ renderHelper->renderVertexConstColor(vertices, color, GL_TRIANGLES);
}
}
@@ -72,7 +73,8 @@ namespace oglcanvas
const ::basegfx::B2DPoint& rPt( rTriangulatedPolygon.getB2DPoint(i) );
vertices.push_back(glm::vec2(rPt.getX(),rPt.getY()));
}
- renderHelper->renderTextureTransform( vertices, nWidth, nHeight, color, GL_TRIANGLES, transform);
+ if(vertices.size()!=0)
+ renderHelper->renderTextureTransform( vertices, nWidth, nHeight, color, GL_TRIANGLES, transform);
}
}
@@ -102,7 +104,8 @@ namespace oglcanvas
const ::basegfx::B2DPoint& rPt( rPolygon.getB2DPoint( j % nPts ) );
vertices.push_back(glm::vec2(rPt.getX(),rPt.getY()));
}
- renderHelper->renderVertexConstColor(vertices, color, GL_LINE_STRIP);
+ if(vertices.size()!=0)
+ renderHelper->renderVertexConstColor(vertices, color, GL_LINE_STRIP);
}
}
commit 0083e04a0fc588e9c218748e39c39e77c8aa49cf
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Fri Feb 20 08:40:35 2015 +0000
polite query the canvas backend
throw no more exception, check if xinterface is supportet
Change-Id: I18bbb672ad60c5cb6b5a88ac5cc1d8d597a47947
diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx
index 5e29d29..0c57efd 100644
--- a/slideshow/source/engine/shapes/viewshape.cxx
+++ b/slideshow/source/engine/shapes/viewshape.cxx
@@ -854,8 +854,10 @@ namespace slideshow
// Shall we render to a sprite, or to a plain canvas?
// Hack, force use of Sprites in case of ogl canvas
- uno::Reference< lang::XServiceInfo > xServiceInfo(mpViewLayer->getCanvas()->getUNOCanvas(),uno::UNO_QUERY_THROW);
- if( xServiceInfo->getImplementationName() == "com.sun.star.comp.rendering.SpriteCanvas.OGL" || isBackgroundDetached() )
+ const uno::Reference< rendering::XCanvas > xCanvas( mpViewLayer->getCanvas()->getUNOCanvas() );
+ const uno::Reference< lang::XServiceInfo > xServiceInfo(xCanvas ,uno::UNO_QUERY);
+ if(xServiceInfo.is()&& xServiceInfo->getImplementationName() == "com.sun.star.comp.rendering.SpriteCanvas.OGL"
+ || isBackgroundDetached() )
{
return renderSprite( mpViewLayer,
rMtf,
commit 429c2e03bb80aa167a6bf6853c08a88ab18b38ea
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Wed Feb 18 13:08:10 2015 +0000
this wrappers are alrdy in glm_canvastools.cxx
Change-Id: I164c7e55c39bb33903f50c9c3792eeae616c1841
diff --git a/basegfx/source/tools/canvastools.cxx b/basegfx/source/tools/canvastools.cxx
index c578e16..f59f447 100644
--- a/basegfx/source/tools/canvastools.cxx
+++ b/basegfx/source/tools/canvastools.cxx
@@ -334,41 +334,6 @@ namespace basegfx
return output;
}
- glm::mat4 glmMatrixFromAffineMatrix( const ::com::sun::star::geometry::AffineMatrix2D& input )
- {
- // ensure last row is [0,0,1] (and optimized away)
- glm::mat4 output;
- output[0][0] = input.m00;
- output[1][0] = input.m01;
- output[2][0] = input.m02;
- output[0][1] = input.m10;
- output[1][1] = input.m11;
- output[2][1] = input.m12;
-
- return output;
- }
-
- glm::mat4 glmMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& input )
- {
- glm::mat4 output;
- output[0][0] = input.m00;
- output[1][0] = input.m01;
- output[2][0] = input.m02;
- output[3][0] = input.m03;
-
- output[0][1] = input.m10;
- output[1][1] = input.m11;
- output[2][1] = input.m12;
- output[3][1] = input.m13;
-
- output[0][2] = input.m20;
- output[1][2] = input.m21;
- output[2][2] = input.m22;
- output[3][2] = input.m23;
-
- return output;
- }
-
::basegfx::B3DHomMatrix homMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& input )
{
::basegfx::B3DHomMatrix output;
@@ -404,40 +369,6 @@ namespace basegfx
return output;
}
- glm::mat4 glmMatFromHomMatrix( const ::basegfx::B2DHomMatrix& input)
- {
- glm::mat4 output;
- output[0][0] = input.get(0,0);
- output[1][0] = input.get(0,1);
- output[2][0] = input.get(0,2);
- output[0][1] = input.get(1,0);
- output[1][1] = input.get(1,1);
- output[2][1] = input.get(1,2);
-
- return output;
- }
-
- glm::mat4 glmMatFromHomMatrix3d( const ::basegfx::B3DHomMatrix& input)
- {
- glm::mat4 output;
- output[0][0] = input.get(0,0);
- output[1][0] = input.get(0,1);
- output[2][0] = input.get(0,2);
- output[3][0] = input.get(0,3);
-
- output[0][1] = input.get(1,0);
- output[1][1] = input.get(1,1);
- output[2][1] = input.get(1,2);
- output[3][1] = input.get(1,3);
-
- output[0][2] = input.get(2,0);
- output[1][2] = input.get(2,1);
- output[2][2] = input.get(2,2);
- output[3][2] = input.get(2,3);
-
- return output;
- }
-
geometry::AffineMatrix3D& affineMatrixFromHomMatrix3D(
geometry::AffineMatrix3D& output,
const ::basegfx::B3DHomMatrix& input)
commit fd72c571a66094be8131a9caa0e4fe742c63e03e
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Wed Feb 18 10:00:51 2015 +0000
only force sprites in case of ogl canvas, care
could end in an exception
Change-Id: I60c38a339ff80058f5e842d4bcfe4bf3d18b67c2
diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx
index f22699e..5e29d29 100644
--- a/slideshow/source/engine/shapes/viewshape.cxx
+++ b/slideshow/source/engine/shapes/viewshape.cxx
@@ -48,7 +48,7 @@
#include "tools.hxx"
#include <boost/bind.hpp>
-
+#include <com/sun/star/lang/XServiceInfo.hpp>
using namespace ::com::sun::star;
@@ -853,9 +853,10 @@ namespace slideshow
ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas(), "ViewShape::update(): Invalid layer canvas" );
// Shall we render to a sprite, or to a plain canvas?
- // Hack, force use of Sprites
- // TODO should be only the case by using ogl canvas-> getImplementationName()
- //if( isBackgroundDetached() )
+ // Hack, force use of Sprites in case of ogl canvas
+ uno::Reference< lang::XServiceInfo > xServiceInfo(mpViewLayer->getCanvas()->getUNOCanvas(),uno::UNO_QUERY_THROW);
+ if( xServiceInfo->getImplementationName() == "com.sun.star.comp.rendering.SpriteCanvas.OGL" || isBackgroundDetached() )
+ {
return renderSprite( mpViewLayer,
rMtf,
rArgs.maOrigBounds,
@@ -866,7 +867,8 @@ namespace slideshow
rArgs.mrSubsets,
rArgs.mnShapePriority,
bIsVisible );
- /*else
+ }
+ else
return render( mpViewLayer->getCanvas(),
rMtf,
rArgs.maBounds,
@@ -874,7 +876,7 @@ namespace slideshow
nUpdateFlags,
rArgs.mrAttr,
rArgs.mrSubsets,
- bIsVisible );*/
+ bIsVisible );
}
}
commit dcaa90249c6e8fa1db3fe674dee2964d241ea8ef
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Wed Feb 18 09:52:57 2015 +0000
mergeViewAndRenderTransform with glm
Change-Id: I5855760456de844b9d19af3467e59fc690bf2aae
diff --git a/include/basegfx/tools/glm_canvastools.hxx b/include/basegfx/tools/glm_canvastools.hxx
index e9b7b43..5404198 100644
--- a/include/basegfx/tools/glm_canvastools.hxx
+++ b/include/basegfx/tools/glm_canvastools.hxx
@@ -25,6 +25,17 @@
#include <basegfx/basegfxdllapi.h>
#include <glm/glm.hpp>
+namespace com { namespace sun { namespace star { namespace geometry
+ {
+ struct AffineMatrix2D;
+ struct AffineMatrix3D;
+ } } } }
+
+namespace com { namespace sun { namespace star { namespace rendering
+ {
+ struct RenderState;
+ struct ViewState;
+ }}}}
namespace basegfx
{
@@ -40,7 +51,15 @@ namespace basegfx
BASEGFX_DLLPUBLIC glm::mat4 glmMatFromHomMatrix( const ::basegfx::B2DHomMatrix& input);
BASEGFX_DLLPUBLIC glm::mat4 glmMatFromHomMatrix3d( const ::basegfx::B3DHomMatrix& input);
+ }
+}
+namespace canvas
+{
+ namespace tools
+ {
+ BASEGFX_DLLPUBLIC glm::mat4& mergeViewAndRenderTransform( const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
}
}
commit 33f7b4d6d95a53f38d3f404384150c02429c97db
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Mon Feb 16 15:00:23 2015 +0000
missing bracket
Change-Id: I99e1febab66b6bd04e516bd97725e9711eced35d
diff --git a/canvas/source/opengl/ogl_renderHelper.cxx b/canvas/source/opengl/ogl_renderHelper.cxx
index 21e03b4..ca7838b 100644
--- a/canvas/source/opengl/ogl_renderHelper.cxx
+++ b/canvas/source/opengl/ogl_renderHelper.cxx
@@ -87,6 +87,7 @@ namespace oglcanvas
void RenderHelper::SetVP(const float nwidth, const float nheight)
{
m_VP = glm::ortho(0.0f, nwidth, nheight, 0.0f);
+ }
void RenderHelper::SetVP(const glm::mat4 vp)
{
commit 57f5f1fdd0f7e4d6c0f16c755bd4e60a7db8d5fe
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Mon Feb 16 14:44:32 2015 +0000
Hack! force using sprites
Change-Id: If601a687a9c39394cc39b3b35956380378db4071
diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx
index edbd666..f22699e 100644
--- a/slideshow/source/engine/shapes/viewshape.cxx
+++ b/slideshow/source/engine/shapes/viewshape.cxx
@@ -853,7 +853,9 @@ namespace slideshow
ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas(), "ViewShape::update(): Invalid layer canvas" );
// Shall we render to a sprite, or to a plain canvas?
- if( isBackgroundDetached() )
+ // Hack, force use of Sprites
+ // TODO should be only the case by using ogl canvas-> getImplementationName()
+ //if( isBackgroundDetached() )
return renderSprite( mpViewLayer,
rMtf,
rArgs.maOrigBounds,
@@ -864,7 +866,7 @@ namespace slideshow
rArgs.mrSubsets,
rArgs.mnShapePriority,
bIsVisible );
- else
+ /*else
return render( mpViewLayer->getCanvas(),
rMtf,
rArgs.maBounds,
@@ -872,7 +874,7 @@ namespace slideshow
nUpdateFlags,
rArgs.mrAttr,
rArgs.mrSubsets,
- bIsVisible );
+ bIsVisible );*/
}
}
commit 4edf67cdb555285cfc85deb811fbbda3553fc841
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Tue Nov 4 08:18:40 2014 +0000
fdo#86190 glmwrappers for bdhommatrix/affinematrix
Conflicts:
include/basegfx/tools/canvastools.hxx
Change-Id: I0ff0b5ed82bbe9dc0ed264b71f6cea5a72809aff
diff --git a/.gitignore b/.gitignore
index b1e7a5b..92f2a56 100644
--- a/.gitignore
+++ b/.gitignore
@@ -56,6 +56,9 @@
/AUTHORS
/MAINTAINERS
+#lhm stuff
+build-lhm.sh
+
# make tags
/tags
@@ -109,3 +112,9 @@ xcuserdata
# gdb config
/.gdbinit
/.gdb_history
+
+#ctags
+/canvas/.tags
+/canvas/.tags_sorted_by_file
+/extras/source/gallery/gallery_system/sg1.sdv
+
diff --git a/basegfx/Library_basegfx.mk b/basegfx/Library_basegfx.mk
index 95ba931..7fd5541 100644
--- a/basegfx/Library_basegfx.mk
+++ b/basegfx/Library_basegfx.mk
@@ -9,7 +9,10 @@
$(eval $(call gb_Library_Library,basegfx))
-$(eval $(call gb_Library_use_external,basegfx,boost_headers))
+$(eval $(call gb_Library_use_externals,basegfx, \
+ boost_headers \
+ glm_headers \
+))
$(eval $(call gb_Library_set_precompiled_header,basegfx,$(SRCDIR)/basegfx/inc/pch/precompiled_basegfx))
@@ -70,6 +73,7 @@ $(eval $(call gb_Library_add_exception_objects,basegfx,\
basegfx/source/raster/rasterconvert3d \
basegfx/source/tools/b2dclipstate \
basegfx/source/tools/canvastools \
+ basegfx/source/tools/glm_canvastools \
basegfx/source/tools/gradienttools \
basegfx/source/tools/keystoplerp \
basegfx/source/tools/numbertools \
diff --git a/basegfx/source/tools/glm_canvastools.cxx b/basegfx/source/tools/glm_canvastools.cxx
new file mode 100644
index 0000000..e4a3907
--- /dev/null
+++ b/basegfx/source/tools/glm_canvastools.cxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <com/sun/star/geometry/AffineMatrix2D.hpp>
+#include <com/sun/star/geometry/AffineMatrix3D.hpp>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/tools/glm_canvastools.hxx>
+#include <limits>
+
+using namespace ::com::sun::star;
+
+namespace basegfx
+{
+
+ namespace unotools
+ {
+ namespace
+ {
+
+
+ glm::mat4 glmMatrixFromAffineMatrix( const ::com::sun::star::geometry::AffineMatrix2D& input )
+ {
+ // ensure last row is [0,0,1] (and optimized away)
+ glm::mat4 output;
+ output[0][0] = input.m00;
+ output[1][0] = input.m01;
+ output[2][0] = input.m02;
+ output[0][1] = input.m10;
+ output[1][1] = input.m11;
+ output[2][1] = input.m12;
+
+ return output;
+ }
+
+ glm::mat4 glmMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& input )
+ {
+ glm::mat4 output;
+ output[0][0] = input.m00;
+ output[1][0] = input.m01;
+ output[2][0] = input.m02;
+ output[3][0] = input.m03;
+
+ output[0][1] = input.m10;
+ output[1][1] = input.m11;
+ output[2][1] = input.m12;
+ output[3][1] = input.m13;
+
+ output[0][2] = input.m20;
+ output[1][2] = input.m21;
+ output[2][2] = input.m22;
+ output[3][2] = input.m23;
+
+ return output;
+ }
+
+
+ glm::mat4 glmMatFromHomMatrix( const ::basegfx::B2DHomMatrix& input)
+ {
+ glm::mat4 output;
+ output[0][0] = input.get(0,0);
+ output[1][0] = input.get(0,1);
+ output[2][0] = input.get(0,2);
+ output[0][1] = input.get(1,0);
+ output[1][1] = input.get(1,1);
+ output[2][1] = input.get(1,2);
+
+ return output;
+ }
+
+ glm::mat4 glmMatFromHomMatrix3d( const ::basegfx::B3DHomMatrix& input)
+ {
+ glm::mat4 output;
+ output[0][0] = input.get(0,0);
+ output[1][0] = input.get(0,1);
+ output[2][0] = input.get(0,2);
+ output[3][0] = input.get(0,3);
+
+ output[0][1] = input.get(1,0);
+ output[1][1] = input.get(1,1);
+ output[2][1] = input.get(1,2);
+ output[3][1] = input.get(1,3);
+
+ output[0][2] = input.get(2,0);
+ output[1][2] = input.get(2,1);
+ output[2][2] = input.get(2,2);
+ output[3][2] = input.get(2,3);
+
+ return output;
+ }
+ } // namespace bgfxtools
+
+} // namespace canvas
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/Library_oglcanvas.mk b/canvas/Library_oglcanvas.mk
index fcdb9ac..8655def 100644
--- a/canvas/Library_oglcanvas.mk
+++ b/canvas/Library_oglcanvas.mk
@@ -45,6 +45,7 @@ $(eval $(call gb_Library_use_externals,oglcanvas,\
boost_headers \
glew \
mesa_headers \
+ glm_headers \
))
ifeq ($(strip $(OS)),MACOSX)
diff --git a/include/basegfx/tools/canvastools.hxx b/include/basegfx/tools/canvastools.hxx
index 2a3030a..c1143fc 100644
--- a/include/basegfx/tools/canvastools.hxx
+++ b/include/basegfx/tools/canvastools.hxx
@@ -23,7 +23,6 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <basegfx/basegfxdllapi.h>
-#include <glm/glm.hpp>
namespace com { namespace sun { namespace star { namespace geometry
@@ -129,21 +128,12 @@ namespace basegfx
BASEGFX_DLLPUBLIC ::basegfx::B2DHomMatrix&
homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix& transform,
const ::com::sun::star::geometry::AffineMatrix2D& matrix );
- BASEGFX_DLLPUBLIC ::basegfx::B3DHomMatrix
+ BASEGFX_DLLPUBLIC ::basegfx::B3DHomMatrix
homMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& matrix );
-
-
- BASEGFX_DLLPUBLIC glm::mat4 glmMatrixFromAffineMatrix( const ::com::sun::star::geometry::AffineMatrix2D& matrix );
-
- BASEGFX_DLLPUBLIC glm::mat4 glmMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& matrix );
-
BASEGFX_DLLPUBLIC ::com::sun::star::geometry::Matrix2D&
matrixFromHomMatrix( ::com::sun::star::geometry::Matrix2D& matrix,
const ::basegfx::B2DHomMatrix& transform);
- BASEGFX_DLLPUBLIC glm::mat4 glmMatFromHomMatrix( const ::basegfx::B2DHomMatrix& input);
-
- BASEGFX_DLLPUBLIC glm::mat4 glmMatFromHomMatrix3d( const ::basegfx::B3DHomMatrix& input);
// Geometry conversions
diff --git a/include/basegfx/tools/glm_canvastools.hxx b/include/basegfx/tools/glm_canvastools.hxx
new file mode 100644
index 0000000..e9b7b43
--- /dev/null
+++ b/include/basegfx/tools/glm_canvastools.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEGFX_TOOLS_GLM_CANVASTOOLS_HXX
+#define INCLUDED_BASEGFX_TOOLS_GLM_CANVASTOOLS_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <basegfx/basegfxdllapi.h>
+#include <glm/glm.hpp>
+
+
+namespace basegfx
+{
+
+
+ namespace unotools
+ {
+
+ BASEGFX_DLLPUBLIC glm::mat4 glmMatrixFromAffineMatrix( const ::com::sun::star::geometry::AffineMatrix2D& matrix );
+
+ BASEGFX_DLLPUBLIC glm::mat4 glmMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& matrix );
+
+ BASEGFX_DLLPUBLIC glm::mat4 glmMatFromHomMatrix( const ::basegfx::B2DHomMatrix& input);
+
+ BASEGFX_DLLPUBLIC glm::mat4 glmMatFromHomMatrix3d( const ::basegfx::B3DHomMatrix& input);
+
+ }
+}
+
+#endif // INCLUDED_BASEGFX_TOOLS_GLM_CANVASTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e95240946c615bd7ebc3bcd6335ab93704734939
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Wed Feb 11 12:13:10 2015 +0000
removed unnecessary conversion
Change-Id: Id5c1c7d9d26bb74d34a652655ddac8dae7568a41
diff --git a/canvas/source/opengl/ogl_canvastools.cxx b/canvas/source/opengl/ogl_canvastools.cxx
index eacac6b..6490cff 100644
--- a/canvas/source/opengl/ogl_canvastools.cxx
+++ b/canvas/source/opengl/ogl_canvastools.cxx
@@ -112,16 +112,14 @@ namespace oglcanvas
GLenum eSrcBlend,
GLenum eDstBlend)
{
- float aGLTransform[] =
- {
+ const glm::mat4 aGLTransform = glm::mat4(
(float) rTransform.get(0,0), (float) rTransform.get(1,0), 0, 0,
(float) rTransform.get(0,1), (float) rTransform.get(1,1), 0, 0,
0, 0, 1, 0,
- (float) rTransform.get(0,2), (float) rTransform.get(1,2), 0, 1
- };
+ (float) rTransform.get(0,2), (float) rTransform.get(1,2), 0, 1);
glEnable(GL_BLEND);
glBlendFunc(eSrcBlend, eDstBlend);
- return glm::make_mat4(aGLTransform);
+ return aGLTransform;
}
void renderOSD( const std::vector<double>& rNumbers, double scale, RenderHelper *renderHelper)
commit c5ad876695951a0df58446ff03b81129ee65c1eb
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Wed Feb 11 12:05:41 2015 +0000
general transformation for canvasbitmaps
applys the same transformation matrix additional to the
basic transformation matrix for each action
-> the background image is composed and drawn to the same offset
relative to the right border
Change-Id: I85bc670841c9f884fd276451233cd1812ed6d9f7
diff --git a/canvas/source/opengl/ogl_canvasbitmap.cxx b/canvas/source/opengl/ogl_canvasbitmap.cxx
index b7c5d9b..e0f0361 100644
--- a/canvas/source/opengl/ogl_canvasbitmap.cxx
+++ b/canvas/source/opengl/ogl_canvasbitmap.cxx
@@ -50,6 +50,11 @@ namespace oglcanvas
{
return maCanvasHelper.renderRecordedActions();
}
+
+ bool CanvasBitmap::renderRecordedActions(const ::basegfx::B2DHomMatrix& rGeneralTransform) const
+ {
+ return maCanvasHelper.renderRecordedActions(rGeneralTransform);
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/source/opengl/ogl_canvasbitmap.hxx b/canvas/source/opengl/ogl_canvasbitmap.hxx
index 534837a..c5c3202 100644
--- a/canvas/source/opengl/ogl_canvasbitmap.hxx
+++ b/canvas/source/opengl/ogl_canvasbitmap.hxx
@@ -65,6 +65,10 @@ namespace oglcanvas
*/
bool renderRecordedActions() const;
+ /** Write out recorded actions
+ apply transformation for each action
+ */
+ bool renderRecordedActions( const ::basegfx::B2DHomMatrix& rGeneralTransform) const;
private:
/** MUST hold here, too, since CanvasHelper only contains a
raw pointer (without refcounting)
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index 58e8072..c0b94ec 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -326,23 +326,21 @@ namespace oglcanvas
return true;
}
- bool lcl_drawOwnBitmap( const CanvasHelper& rHelper,
+ bool lcl_drawOwnBitmap( const CanvasHelper& /*rHelper*/,
const ::basegfx::B2DHomMatrix& rTransform,
- GLenum eSrcBlend,
- GLenum eDstBlend,
+ GLenum /*eSrcBlend*/,
+ GLenum /*eDstBlend*/,
const rendering::ARGBColor& /*rColor*/,
const CanvasBitmap& rBitmap )
{
- RenderHelper* pRenderHelper = rHelper.getDeviceHelper()->getRenderHelper();
- pRenderHelper->SetModelAndMVP(setupState(rTransform, eSrcBlend, eDstBlend));
- return rBitmap.renderRecordedActions();
+ return rBitmap.renderRecordedActions(rTransform);
}
bool lcl_drawGenericBitmap( const CanvasHelper& rHelper,
const ::basegfx::B2DHomMatrix& rTransform,
GLenum eSrcBlend,
GLenum eDstBlend,
- const rendering::ARGBColor& rColor,
+ const rendering::ARGBColor& /*rColor*/,
const geometry::IntegerSize2D& rPixelSize,
const uno::Sequence<sal_Int8>& rPixelData,
sal_uInt32 nPixelCrc32)
@@ -553,7 +551,6 @@ namespace oglcanvas
rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
rAct.maFunction = lcl_drawPolyPolygon;
- // TODO(F2): subdivide&render whole curve
/* rAct.maFunction = ::boost::bind(&lcl_drawLine,
_1,_2,_3,_4,_5,
geometry::RealPoint2D(
@@ -659,10 +656,8 @@ namespace oglcanvas
unoCapeFromCap(strokeAttributes.StartCapType)
));
}
- // Note: the generated stroke poly-polygon is NOT free of
- // self-intersections. Therefore, if we would render it
- // via OutDev::DrawPolyPolygon(), on/off fill would
- // generate off areas on those self-intersections.
+
+ //Render each subpolygon for itself
const sal_uInt16 nSize( aStrokedPolyPoly.count() );
@@ -1163,10 +1158,33 @@ namespace oglcanvas
return true;
}
+ bool CanvasHelper::renderRecordedActions( const ::basegfx::B2DHomMatrix& rGeneralTransform) const
+ {
+ std::vector<Action>::const_iterator aCurr(mpRecordedActions->begin());
+ const std::vector<Action>::const_iterator aEnd(mpRecordedActions->end());
+ while( aCurr != aEnd )
+ {
+ const ::basegfx::B2DHomMatrix& combinedTransform = rGeneralTransform * aCurr->maTransform;
+ if( !aCurr->maFunction( *this,
+ combinedTransform,
+ aCurr->meSrcBlendMode,
+ aCurr->meDstBlendMode,
+ aCurr->maARGBColor,
+ aCurr->maPolyPolys ) )
+ return false;
+
+ ++aCurr;
+ }
+
+ return true;
+ }
+
size_t CanvasHelper::getRecordedActionCount() const
{
return mpRecordedActions->size();
}
+
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/source/opengl/ogl_canvashelper.hxx b/canvas/source/opengl/ogl_canvashelper.hxx
index acd0b4c..7c74780 100644
--- a/canvas/source/opengl/ogl_canvashelper.hxx
+++ b/canvas/source/opengl/ogl_canvashelper.hxx
@@ -14,11 +14,13 @@
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/vector/b2dsize.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
#include <o3tl/cow_wrapper.hxx>
#include <vector>
#include "ogl_renderHelper.hxx"
+
namespace oglcanvas
{
class SpriteDeviceHelper;
@@ -194,6 +196,11 @@ namespace oglcanvas
*/
bool renderRecordedActions() const;
+ /** Write out recorded actions
+ Apply the general transformation for each action
+ */
+ bool renderRecordedActions( const ::basegfx::B2DHomMatrix& rGeneralTransform) const;
+
/** Retrieve number of recorded actions
*/
size_t getRecordedActionCount() const;
@@ -205,6 +212,7 @@ namespace oglcanvas
typedef o3tl::cow_wrapper< std::vector<Action>,
o3tl::ThreadSafeRefCountingPolicy > RecordVectorT;
+
private:
CanvasHelper( const CanvasHelper& ) SAL_DELETED_FUNCTION;
commit 24585d29317d14c362c2f12ee254b1aa5a943c8a
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Thu Jan 22 09:55:43 2015 +0000
related to last commit, forget a line :)
Change-Id: I18b3b2046ac6ba54635a022c3268a5264cf6b05b
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index 7cdc7e6..58e8072 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -664,12 +664,14 @@ namespace oglcanvas
// via OutDev::DrawPolyPolygon(), on/off fill would
// generate off areas on those self-intersections.
+ const sal_uInt16 nSize( aStrokedPolyPoly.count() );
+
for(sal_uInt32 i=0;i<nSize; ++i)
{
- ::basegfx::B2DPolyPolygon tempStrokedPoly;
- tempStrokedPoly.append(aStrokedPolyPoly.getB2DPolygon(i));
+ ::basegfx::B2DPolyPolygon aSingleStrokedPoly;
+ aSingleStrokedPoly.append(aStrokedPolyPoly.getB2DPolygon(i));
- rAct.maPolyPolys.push_back(tempStrokedPoly);
+ rAct.maPolyPolys.push_back(aSingleStrokedPoly);
rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
rAct.maFunction = &lcl_fillPolyPolygon;
commit 464673f22b810097eabf9d329afab9335ab09bb4
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Wed Jan 21 09:15:59 2015 +0000
draw strokes correct
dont connect single polygons from createAreaGeometry
draw each polygone for itself
Change-Id: Iff10fc7a221453d48ca042dd556f86b4342b60ef
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index 6397f4f0..7cdc7e6 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -659,10 +659,22 @@ namespace oglcanvas
unoCapeFromCap(strokeAttributes.StartCapType)
));
}
- rAct.maPolyPolys.push_back(aStrokedPolyPoly);
- rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
+ // Note: the generated stroke poly-polygon is NOT free of
+ // self-intersections. Therefore, if we would render it
+ // via OutDev::DrawPolyPolygon(), on/off fill would
+ // generate off areas on those self-intersections.
- rAct.maFunction = &lcl_fillPolyPolygon;
+ for(sal_uInt32 i=0;i<nSize; ++i)
+ {
+ ::basegfx::B2DPolyPolygon tempStrokedPoly;
+ tempStrokedPoly.append(aStrokedPolyPoly.getB2DPolygon(i));
+
+ rAct.maPolyPolys.push_back(tempStrokedPoly);
+ rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
+
+ rAct.maFunction = &lcl_fillPolyPolygon;
+
+ }
}
}
commit 686472e1a000f0cd0ff15aabe8c86436639723f9
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Wed Jan 21 09:09:51 2015 +0000
no need here for color
Change-Id: I7bde6d916e801eda6bb4c5db4a050b86b6758178
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index c3b9800..6397f4f0 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -249,10 +249,6 @@ namespace oglcanvas
{
RenderHelper* pRenderHelper = rHelper.getDeviceHelper()->getRenderHelper();
pRenderHelper->SetModelAndMVP(setupState(rTransform, eSrcBlend, eDstBlend));
- glm::vec4 color = glm::vec4( (float) rendering::ARGBColor().Red,
- (float) rendering::ARGBColor().Green,
- (float) rendering::ARGBColor().Blue,
- (float) rendering::ARGBColor().Alpha);
// convert to weird canvas textur coordinate system (not
// [0,1]^2, but path coordinate system)
@@ -334,7 +330,7 @@ namespace oglcanvas
const ::basegfx::B2DHomMatrix& rTransform,
GLenum eSrcBlend,
GLenum eDstBlend,
- const rendering::ARGBColor& rColor,
+ const rendering::ARGBColor& /*rColor*/,
const CanvasBitmap& rBitmap )
{
RenderHelper* pRenderHelper = rHelper.getDeviceHelper()->getRenderHelper();
commit ff50a6be5ccfc3d141f5d7f51a42002b733e3dc4
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Thu Jan 15 13:25:21 2015 +0000
fill polypolygons fully transparent
Change-Id: I76711d305bc672e70b4ecdd2f8e1fa1b7fbf44b6
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index 9aa92e2..c3b9800 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -227,6 +227,7 @@ namespace oglcanvas
(float) rColor.Green,
(float) rColor.Blue,
(float) rColor.Alpha);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
::basegfx::B2DPolyPolygonVector::const_iterator aCurr=rPolyPolygons.begin();
const ::basegfx::B2DPolyPolygonVector::const_iterator aEnd=rPolyPolygons.end();
commit dd2e9fd0279aa6f721f8b0332e5cbfd92f356b66
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Wed Jan 14 12:51:43 2015 +0000
set correct projection and viewport for sprites
each sprite is drawn to a framebuffer/ texture
set projection and viewport to the sprite resolution
Change-Id: I3c6c53729c76ee1dc4fcb53b5b31b912be782d49
diff --git a/canvas/source/opengl/ogl_canvascustomsprite.cxx b/canvas/source/opengl/ogl_canvascustomsprite.cxx
index ac8272e..7acaceb 100644
--- a/canvas/source/opengl/ogl_canvascustomsprite.cxx
+++ b/canvas/source/opengl/ogl_canvascustomsprite.cxx
@@ -139,6 +139,9 @@ namespace oglcanvas
RenderHelper* pRenderHelper = maCanvasHelper.getDeviceHelper()->getRenderHelper();
IBufferContextSharedPtr pBufferContext;
+ GLint myviewport[4];
+ glGetIntegerv(GL_VIEWPORT, myviewport);
+
if( mfAlpha != 0.0 || mxClip.is() )
{
// drats. need to render to temp surface before, and then
@@ -146,12 +149,20 @@ namespace oglcanvas
// TODO(P3): buffer texture
pBufferContext = maCanvasHelper.getDeviceHelper()->createBufferContext(aSpriteSizePixel);
- //glViewport(0, 0,aSpriteSizePixel.x,aSpriteSizePixel.y);
pBufferContext->startBufferRendering();
}
// this ends up in pBufferContext, if that one's "current"
+ // Draw in spriteresolution
+ const glm::mat4 oldResulution = pRenderHelper->GetVP();
+ pRenderHelper->SetVP(aSpriteSizePixel.x, aSpriteSizePixel.y);
+ glViewport(0, 0,aSpriteSizePixel.x,aSpriteSizePixel.y);
+
if( !maCanvasHelper.renderRecordedActions() )
return false;
+
+ //go back to window resolution
+ pRenderHelper->SetVP(oldResulution);
+ glViewport(myviewport[0], myviewport[1],myviewport[2],myviewport[3]);
const glm::mat4 translate = glm::translate(glm::vec3(maPosition.getX(), maPosition.getY(), 0));
if( pBufferContext )
{
@@ -172,6 +183,7 @@ namespace oglcanvas
pRenderHelper->SetModelAndMVP( translate *aGLTransform );
+
GLuint nTexture = pBufferContext->getTextureId();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, nTexture);
@@ -237,16 +249,6 @@ namespace oglcanvas
glBindTexture(GL_TEXTURE_2D, 0);
}
- std::vector<glm::vec2> vertices;
- vertices.reserve(6);
- vertices.push_back(glm::vec2(-2, -2));
- vertices.push_back(glm::vec2(-2, (float) maSize.Height+4));
- vertices.push_back(glm::vec2((float) maSize.Width+4, (float) maSize.Height+4));
- vertices.push_back(glm::vec2((float) maSize.Width+4, -2));
- vertices.push_back(glm::vec2(-2, -2));
- vertices.push_back(glm::vec2((float) maSize.Width+4, (float) maSize.Height+4));
-
- pRenderHelper->renderVertexConstColor(vertices, glm::vec4(1, 0, 0, 1), GL_LINE_STRIP);
#ifdef DEBUG_RENDERING
std::vector<double> aVec;
diff --git a/canvas/source/opengl/ogl_renderHelper.cxx b/canvas/source/opengl/ogl_renderHelper.cxx
index 50e1269..21e03b4 100644
--- a/canvas/source/opengl/ogl_renderHelper.cxx
+++ b/canvas/source/opengl/ogl_renderHelper.cxx
@@ -87,6 +87,15 @@ namespace oglcanvas
void RenderHelper::SetVP(const float nwidth, const float nheight)
{
m_VP = glm::ortho(0.0f, nwidth, nheight, 0.0f);
+
+ void RenderHelper::SetVP(const glm::mat4 vp)
+ {
+ m_VP = vp;
+ }
+
+ glm::mat4 RenderHelper::GetVP()
+ {
+ return m_VP;
}
static void cleanUp()
@@ -142,6 +151,7 @@ namespace oglcanvas
glDeleteProgram( m_texManProgID);
glDeleteProgram( m_simpleProgID);
glDeleteProgram( m_texProgID);
+ glDeleteProgram( m_texTransProgID);
glDeleteProgram( mnRectangularTwoColorGradientProgram );
glDeleteProgram( mnRectangularMultiColorGradientProgram );
glDeleteProgram( mnRadialTwoColorGradientProgram );
diff --git a/canvas/source/opengl/ogl_renderHelper.hxx b/canvas/source/opengl/ogl_renderHelper.hxx
index 011120a..383bbbc 100644
--- a/canvas/source/opengl/ogl_renderHelper.hxx
+++ b/canvas/source/opengl/ogl_renderHelper.hxx
@@ -55,6 +55,11 @@ namespace oglcanvas
RenderHelper();
void SetVP(const float width, const float height);
+
+ void SetVP(const glm::mat4 vp);
+
+ glm::mat4 GetVP();
+
void SetModelAndMVP(const glm::mat4& mat);
void dispose();
void InitOpenGL();
commit 55c43793b744d4341e93cba984d080e68c73780a
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Tue Jan 13 13:21:05 2015 +0000
show backbuffer
Change-Id: Iefec84321103ca0d5ac28585403dbeed74d1a9f3
diff --git a/canvas/source/opengl/ogl_spritedevicehelper.cxx b/canvas/source/opengl/ogl_spritedevicehelper.cxx
index 087cedd..ce2a5f3 100644
--- a/canvas/source/opengl/ogl_spritedevicehelper.cxx
+++ b/canvas/source/opengl/ogl_spritedevicehelper.cxx
@@ -310,6 +310,7 @@ namespace oglcanvas
unx::glXWaitGL();
XSync( reinterpret_cast<unx::Display*>(mpDisplay), false );
*/
+ pChildWindow->Show();
mpContext->swapBuffers();
// flush texture cache, such that it does not build up
commit 9db3b64c33a61c879240583a01ae6119335568d0
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Fri Dec 19 08:45:59 2014 +0000
subdevide bezier segments into more points
Change-Id: I239bb6cba30c5a01c0b7973d55b94779898ddb90
diff --git a/canvas/source/opengl/ogl_canvastools.cxx b/canvas/source/opengl/ogl_canvastools.cxx
index cc41d1c..eacac6b 100644
--- a/canvas/source/opengl/ogl_canvastools.cxx
+++ b/canvas/source/opengl/ogl_canvastools.cxx
@@ -21,8 +21,9 @@
#include <com/sun/star/rendering/ARGBColor.hpp>
#include <GL/glew.h>
-#include <glm/gtc/type_ptr.hpp>
+//subdivision count of bezier segments
+#define COUNT_OF_ADAPTIVE_SUBDIVISION 40
using namespace ::com::sun::star;
@@ -34,7 +35,7 @@ namespace oglcanvas
{
::basegfx::B2DPolyPolygon aPolyPoly(rPolyPoly);
if( aPolyPoly.areControlPointsUsed() )
- aPolyPoly = rPolyPoly.getDefaultAdaptiveSubdivision();
+ aPolyPoly = rPolyPoly.getAdaptiveSubdivision(COUNT_OF_ADAPTIVE_SUBDIVISION);
const ::basegfx::B2DPolygon& rTriangulatedPolygon(
::basegfx::triangulator::triangulate(aPolyPoly));
if(rTriangulatedPolygon.count()>0)
@@ -56,7 +57,7 @@ namespace oglcanvas
{
::basegfx::B2DPolyPolygon aPolyPoly(rPolyPoly);
if( aPolyPoly.areControlPointsUsed() )
- aPolyPoly = rPolyPoly.getDefaultAdaptiveSubdivision();
+ aPolyPoly = rPolyPoly.getAdaptiveSubdivision(COUNT_OF_ADAPTIVE_SUBDIVISION);
const ::basegfx::B2DRange& rBounds(aPolyPoly.getB2DRange());
const double nWidth=rBounds.getWidth();
const double nHeight=rBounds.getHeight();
@@ -75,6 +76,7 @@ namespace oglcanvas
}
}
+
/** only use this for line polygons.
better not leave triangulation to OpenGL. also, ignores texturing
@@ -83,11 +85,10 @@ namespace oglcanvas
{
::basegfx::B2DPolyPolygon aPolyPoly(rPolyPoly);
if( aPolyPoly.areControlPointsUsed() )
- aPolyPoly = rPolyPoly.getDefaultAdaptiveSubdivision();
+ aPolyPoly = rPolyPoly.getAdaptiveSubdivision(COUNT_OF_ADAPTIVE_SUBDIVISION);
for(sal_uInt32 i=0; i<aPolyPoly.count(); i++ )
{
-
const ::basegfx::B2DPolygon& rPolygon( aPolyPoly.getB2DPolygon(i) );
const sal_uInt32 nPts=rPolygon.count();
commit 9552fea081a4aff3fbcd35e0507e5a1f6910c7c2
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Fri Dec 19 08:38:47 2014 +0000
adaptive subdivision of bezier curves
additional method with a parameter, count of calculated points,
instead of default point count
Change-Id: I60d8977f6785dfb804228b0c88118897e860db6c
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx
index 096c4a0..850c41e 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -481,12 +481,17 @@ public:
const basegfx::B2DPolygon& getDefaultAdaptiveSubdivision(const basegfx::B2DPolygon& rSource) const
{
- if(!mpDefaultSubdivision)
- {
- const_cast< ImplBufferedData* >(this)->mpDefaultSubdivision.reset(new basegfx::B2DPolygon(basegfx::tools::adaptiveSubdivideByCount(rSource, 9)));
- }
+ return getAdaptiveSubdivision(rSource, 9);
+ }
- return *mpDefaultSubdivision;
+
+ const basegfx::B2DPolygon& getAdaptiveSubdivision(const basegfx::B2DPolygon& rSource, const sal_uInt32 nCount) const
+ {
+ if(!mpDefaultSubdivision)
+ {
+ const_cast< ImplBufferedData* >(this)->mpDefaultSubdivision.reset(new basegfx ::B2DPolygon(basegfx::tools::adaptiveSubdivideByCount(rSource,nCount)));
+ }
+ return *mpDefaultSubdivision;
}
const basegfx::B2DRange& getB2DRange(const basegfx::B2DPolygon& rSource) const
@@ -591,6 +596,22 @@ public:
return mpBufferedData->getDefaultAdaptiveSubdivision(rSource);
}
+
+ const basegfx::B2DPolygon& getAdaptiveSubdivision(const basegfx::B2DPolygon& rSource, const sal_uInt32 nCount) const
+ {
+ if(!mpControlVector || !mpControlVector->isUsed())
+ {
+ return rSource;
+ }
+
+ if(!mpBufferedData)
+ {
+ const_cast< ImplB2DPolygon* >(this)->mpBufferedData.reset(new ImplBufferedData);
+ }
+
+ return mpBufferedData->getAdaptiveSubdivision(rSource, nCount);
+ }
+
const basegfx::B2DRange& getB2DRange(const basegfx::B2DPolygon& rSource) const
{
if(!mpBufferedData)
@@ -1379,6 +1400,11 @@ namespace basegfx
return mpPolygon->getDefaultAdaptiveSubdivision(*this);
}
+ B2DPolygon B2DPolygon::getAdaptiveSubdivision(const sal_uInt32 nCount) const
+ {
+ return mpPolygon->getAdaptiveSubdivision(*this, nCount);
+ }
+
B2DRange B2DPolygon::getB2DRange() const
{
return mpPolygon->getB2DRange(*this);
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index 92b74e7..4b0dfe9 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -283,6 +283,18 @@ namespace basegfx
return aRetval;
}
+ B2DPolyPolygon B2DPolyPolygon::getAdaptiveSubdivision(const sal_uInt32 nCount) const
+ {
+ B2DPolyPolygon aRetval;
+
+ for(sal_uInt32 a(0L); a < mpPolyPolygon->count(); a++)
+ {
+ aRetval.append(mpPolyPolygon->getB2DPolygon(a).getAdaptiveSubdivision(nCount));
+ }
+
+ return aRetval;
+ }
+
B2DRange B2DPolyPolygon::getB2DRange() const
{
B2DRange aRetval;
diff --git a/include/basegfx/polygon/b2dpolygon.hxx b/include/basegfx/polygon/b2dpolygon.hxx
index da88050..a74fdfb 100644
--- a/include/basegfx/polygon/b2dpolygon.hxx
+++ b/include/basegfx/polygon/b2dpolygon.hxx
@@ -148,6 +148,15 @@ namespace basegfx
*/
B2DPolygon getDefaultAdaptiveSubdivision() const;
+ /** adaptive subdivision access
+
+ see getDefaultAdaptiveSubdivision
+
+ @nCount
+ count of subdivision, creates nCount+1 edges
+ and nCount +2 points
+ */
+ B2DPolygon getAdaptiveSubdivision(const sal_uInt32 nCount) const;
/** Get the B2DRange (Rectangle dimensions) of this B2DPolygon
A polygon may have up to three ranges:
diff --git a/include/basegfx/polygon/b2dpolypolygon.hxx b/include/basegfx/polygon/b2dpolypolygon.hxx
index 07bffcd..37a9a36 100644
--- a/include/basegfx/polygon/b2dpolypolygon.hxx
+++ b/include/basegfx/polygon/b2dpolypolygon.hxx
@@ -85,6 +85,15 @@ namespace basegfx
*/
B2DPolyPolygon getDefaultAdaptiveSubdivision() const;
+ /** adaptive subdivision access
+
+ For details refer to B2DPolygon::getAdaptiveSubdivision()
+
+ @return
+ The default subdivision of this polygon
+ */
+ B2DPolyPolygon getAdaptiveSubdivision(const sal_uInt32 nCount) const;
+
/** Get the B2DRange (Rectangle dimensions) of this B2DPolyPolygon
For details refer to B2DPolygon::getB2DRange()
commit aebbe9807f62cb9e2fcd0acd9ae9932e1cb40ce9
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Thu Dec 18 12:17:45 2014 +0000
subdivide bezier curves
Change-Id: I616eefabc083d78bd259689c77908edd45788cd6
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index 992fe87..9aa92e2 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -543,14 +543,27 @@ namespace oglcanvas
Action& rAct=mpRecordedActions->back();
setupGraphicsState( rAct, viewState, renderState );
+ //untested code, otherways commented out should work...
+ basegfx::B2DPolygon aPoly;
+ aPoly.append(basegfx::B2DPoint(aBezierSegment.Px, aBezierSegment.Py));
+ aPoly.appendBezierSegment( basegfx::B2DPoint(aBezierSegment.C1x, aBezierSegment.C1y),
+ basegfx::B2DPoint(aBezierSegment.C1x, aBezierSegment.C1y),
+ basegfx::B2DPoint(aEndPoint.X,aEndPoint.Y));
+
+ basegfx::B2DPolyPolygon aPolyPoly;
+ aPolyPoly.append(aPoly);
+ rAct.maPolyPolys.push_back(aPolyPoly);
+ rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
+ rAct.maFunction = lcl_drawPolyPolygon;
// TODO(F2): subdivide&render whole curve
- rAct.maFunction = ::boost::bind(&lcl_drawLine,
+ /* rAct.maFunction = ::boost::bind(&lcl_drawLine,
_1,_2,_3,_4,_5,
geometry::RealPoint2D(
aBezierSegment.Px,
aBezierSegment.Py),
- aEndPoint);
+ aEndPoint);*/
+
}
}
commit b2e71678924e8373d1db1af574af7501200ae702
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Thu Dec 18 12:11:17 2014 +0000
renderSprite
renders still to framebuffer with the wrong offset ( polygon is
clipped, or entire out of texture bounds )
Change-Id: I485fd141c73d1e9783db7f4638bb33875e3af9be
diff --git a/canvas/source/opengl/ogl_canvascustomsprite.cxx b/canvas/source/opengl/ogl_canvascustomsprite.cxx
index 9962eb4..ac8272e 100644
--- a/canvas/source/opengl/ogl_canvascustomsprite.cxx
+++ b/canvas/source/opengl/ogl_canvascustomsprite.cxx
@@ -25,6 +25,7 @@
#include <basegfx/polygon/b2dpolygontriangulator.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <GL/glew.h>
+#include <vcl/opengl/GLMHelper.hxx>
using namespace ::com::sun::star;
@@ -131,42 +132,46 @@ namespace oglcanvas
if( ::basegfx::fTools::equalZero( mfAlpha ) )
return true;
- const glm::vec2 aSpriteSizePixel(
- ::canvas::tools::roundUp( maSize.Width ),
- ::canvas::tools::roundUp( maSize.Height ));
- RenderHelper* pRenderHelper = maCanvasHelper.getDeviceHelper()->getRenderHelper();
+ const glm::vec2 aSpriteSizePixel(
+ ::canvas::tools::roundUp( maSize.Width),
+ ::canvas::tools::roundUp( maSize.Height));
+
+ RenderHelper* pRenderHelper = maCanvasHelper.getDeviceHelper()->getRenderHelper();
IBufferContextSharedPtr pBufferContext;
- if( mfAlpha != 1.0 || mxClip.is() )
+
+ if( mfAlpha != 0.0 || mxClip.is() )
{
// drats. need to render to temp surface before, and then
// composite that to screen
// TODO(P3): buffer texture
pBufferContext = maCanvasHelper.getDeviceHelper()->createBufferContext(aSpriteSizePixel);
+ //glViewport(0, 0,aSpriteSizePixel.x,aSpriteSizePixel.y);
pBufferContext->startBufferRendering();
}
-
// this ends up in pBufferContext, if that one's "current"
if( !maCanvasHelper.renderRecordedActions() )
return false;
-
const glm::mat4 translate = glm::translate(glm::vec3(maPosition.getX(), maPosition.getY(), 0));
if( pBufferContext )
{
+ //pRenderHelper->SetModelAndMVP( aGLTransform);
+ // content ended up in background buffer - compose to
+ // screen now. Calls below switches us back to window
+ // context, and binds to generated, dynamic texture
+
+ pBufferContext->endBufferRendering();
+
const glm::mat4 aGLTransform = glm::mat4(
maTransformation.m00, maTransformation.m10, 0, 0,
maTransformation.m01, maTransformation.m11, 0, 0,
0, 0, 1, 0,
maTransformation.m02, maTransformation.m12, 0, 1
- );
+ );
+
+ pRenderHelper->SetModelAndMVP( translate *aGLTransform );
- //pRenderHelper->SetModelAndMVP(translate * aGLTransform);
- pRenderHelper->SetModelAndMVP( aGLTransform);
- // content ended up in background buffer - compose to
- // screen now. Calls below switches us back to window
- // context, and binds to generated, dynamic texture
- pBufferContext->endBufferRendering();
GLuint nTexture = pBufferContext->getTextureId();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, nTexture);
@@ -212,22 +217,19 @@ namespace oglcanvas
}
else
{
- const double fWidth=maSize.Width/aSpriteSizePixel.x;
- const double fHeight=maSize.Height/aSpriteSizePixel.y;
-
std::vector<glm::vec2> vertices;
vertices.reserve(4);
- vertices.push_back(glm::vec2(0, 0));
- vertices.push_back(glm::vec2(0, (float) aSpriteSizePixel.y));
vertices.push_back(glm::vec2((float) aSpriteSizePixel.x, 0));
vertices.push_back(glm::vec2((float) aSpriteSizePixel.x, (float) aSpriteSizePixel.y));
+ vertices.push_back(glm::vec2(0, 0));
+ vertices.push_back(glm::vec2(0, (float) aSpriteSizePixel.y));
std::vector<glm::vec2> uvCoordinates;
uvCoordinates.reserve(4);
+ uvCoordinates.push_back(glm::vec2(1, 1));
+ uvCoordinates.push_back(glm::vec2(1, 0));
+ uvCoordinates.push_back(glm::vec2(0, 1));
uvCoordinates.push_back(glm::vec2(0, 0));
- uvCoordinates.push_back(glm::vec2(0, (float) fHeight));
- uvCoordinates.push_back(glm::vec2((float) fWidth, 0));
- uvCoordinates.push_back(glm::vec2((float) fWidth, (float) fHeight));
pRenderHelper->renderVertexUVTex(vertices, uvCoordinates, color, GL_TRIANGLE_STRIP );
}
@@ -235,7 +237,6 @@ namespace oglcanvas
glBindTexture(GL_TEXTURE_2D, 0);
}
-
std::vector<glm::vec2> vertices;
vertices.reserve(6);
vertices.push_back(glm::vec2(-2, -2));
commit 65ab4896697a7c1adb839c52d1aa2d1136d64911
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Thu Dec 11 12:15:23 2014 +0000
testcase for createAreaGeometry
Change-Id: Ie9b6dcad91549feba738e0b3e010982a54cd327d
diff --git a/basegfx/CppunitTest_basegfx.mk b/basegfx/CppunitTest_basegfx.mk
index fdffba3..60abff7 100644
--- a/basegfx/CppunitTest_basegfx.mk
+++ b/basegfx/CppunitTest_basegfx.mk
@@ -25,6 +25,8 @@ $(eval $(call gb_CppunitTest_use_libraries,basegfx,\
$(gb_UWINAPI) \
))
+
+
$(eval $(call gb_CppunitTest_add_exception_objects,basegfx,\
basegfx/test/basegfx2d \
basegfx/test/basegfx3d \
@@ -32,6 +34,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,basegfx,\
basegfx/test/basegfxtools \
basegfx/test/clipstate \
basegfx/test/genericclipper \
+ basegfx/test/minimalCreateAreaGeometryTest \
))
# vim: set noet sw=4 ts=4:
diff --git a/basegfx/test/minimalCreateAreaGeometryTest.cxx b/basegfx/test/minimalCreateAreaGeometryTest.cxx
new file mode 100644
index 0000000..11e91a9
--- /dev/null
+++ b/basegfx/test/minimalCreateAreaGeometryTest.cxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/types.h>
+#include <cppunit/TestAssert.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <basegfx/tools/tools.hxx>
+#include <com/sun/star/rendering/PathCapType.hpp>
+#include <com/sun/star/rendering/PathJoinType.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dlinegeometry.hxx>
+
+
+using namespace ::basegfx;
+
+namespace basegfxtools
+{
+
+class createAreaGeometryTest : public CppUnit::TestFixture
+{
+ B2DPolygon mPoly;
+ const float mStrokeWidth;
+ static B2DPolygon getTestVector()
+ {
+ B2DPolygon aTestPoly;
+ aTestPoly.reserve(6);
+ aTestPoly.append(B2DPoint(2.26965,2.33533));
+ aTestPoly.append(B2DPoint(523.855,2.33533));
+ aTestPoly.append(B2DPoint(523.855,312.263));
+ aTestPoly.append(B2DPoint(2.26965,2.33533));
+ aTestPoly.append(B2DPoint(523.855,2.33533));
+ aTestPoly.append(B2DPoint(523.855,312.263));
+ return aTestPoly;
+ }
+
+public:
+ createAreaGeometryTest():
+ mPoly(getTestVector()),
+ mStrokeWidth(2.3*0.5)
+ {}
+ void setUp() SAL_OVERRIDE
+ {}
+
+ void tearDown() SAL_OVERRIDE
+ {}
+
+ void test()
+ {
+ ::basegfx::B2DPolyPolygon aStrokedPolyPoly;
+ aStrokedPolyPoly.append(basegfx::tools::createAreaGeometry(
+ mPoly,
+ mStrokeWidth,
+ basegfx::B2DLINEJOIN_NONE,
+ com::sun::star::drawing::LineCap_SQUARE));
+ }
+
+ // Change the following lines only, if you add, remove or rename
+ // member functions of the current class,
+ // because these macros are need by auto register mechanism.
+
+ CPPUNIT_TEST_SUITE(createAreaGeometryTest);
+ CPPUNIT_TEST(test);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(basegfxtools::createAreaGeometryTest);
+} // namespace basegfxtools
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 9094174c967651749cce086034e4106771bb3b97
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Thu Dec 11 10:38:10 2014 +0000
draw stroke polygons
Change-Id: I55e35eabc59ce45b9cd271f8bc8596c0082a8fde
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index ec08cf8..992fe87 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -17,6 +17,8 @@
#include <basegfx/polygon/b2dpolygontriangulator.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
+ #include <basegfx/polygon/b2dpolygontools.hxx>
+
#include <com/sun/star/rendering/TexturingMode.hpp>
#include <com/sun/star/rendering/CompositeOperation.hpp>
#include <com/sun/star/rendering/RepaintResult.hpp>
@@ -27,6 +29,8 @@
#include <vcl/metric.hxx>
#include <vcl/font.hxx>
+#include <basegfx/polygon/b2dlinegeometry.hxx>
+
#include "ogl_canvasfont.hxx"
#include "ogl_canvastools.hxx"
#include "ogl_canvasbitmap.hxx"
@@ -36,6 +40,7 @@
#include <GL/glew.h>
#include <glm/gtc/type_ptr.hpp>
+#include <vcl/opengl/GLMHelper.hxx>
#include <boost/scoped_array.hpp>
@@ -94,6 +99,53 @@ namespace oglcanvas
namespace
{
+
+
+ basegfx::B2DLineJoin b2DJoineFromJoin( sal_Int8 nJoinType )
+ {
+ switch( nJoinType )
+ {
+ case rendering::PathJoinType::NONE:
+ return basegfx::B2DLINEJOIN_NONE;
+
+ case rendering::PathJoinType::MITER:
+ return basegfx::B2DLINEJOIN_MITER;
+
+ case rendering::PathJoinType::ROUND:
+ return basegfx::B2DLINEJOIN_ROUND;
+
+ case rendering::PathJoinType::BEVEL:
+ return basegfx::B2DLINEJOIN_BEVEL;
+
+ default:
+ ENSURE_OR_THROW( false,
+ "b2DJoineFromJoin(): Unexpected join type" );
+ }
+
+ return basegfx::B2DLINEJOIN_NONE;
+ }
+
+ drawing::LineCap unoCapeFromCap( sal_Int8 nCapType)
+ {
+ switch ( nCapType)
+ {
+ case rendering::PathCapType::BUTT:
+ return drawing::LineCap_BUTT;
+
+ case rendering::PathCapType::ROUND:
+ return drawing::LineCap_ROUND;
+
+ case rendering::PathCapType::SQUARE:
+ return drawing::LineCap_SQUARE;
+
+ default:
+ ENSURE_OR_THROW( false,
+ "unoCapeFromCap(): Unexpected cap type" );
+ }
+ return drawing::LineCap_BUTT;
+ }
+
+
bool lcl_drawPoint( const CanvasHelper& rHelper,
const ::basegfx::B2DHomMatrix& rTransform,
GLenum eSrcBlend,
@@ -531,7 +583,7 @@ namespace oglcanvas
const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon,
const rendering::ViewState& viewState,
const rendering::RenderState& renderState,
- const rendering::StrokeAttributes& /*strokeAttributes*/ )
+ const rendering::StrokeAttributes& strokeAttributes )
{
ENSURE_OR_THROW( xPolyPolygon.is(),
"CanvasHelper::strokePolyPolygon: polygon is NULL");
@@ -542,12 +594,66 @@ namespace oglcanvas
Action& rAct=mpRecordedActions->back();
setupGraphicsState( rAct, viewState, renderState );
- rAct.maPolyPolys.push_back(
- ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon));
- rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
+ ::basegfx::B2DSize aLinePixelSize(strokeAttributes.StrokeWidth,
+ strokeAttributes.StrokeWidth);
+ ::basegfx::B2DPolyPolygon aPolyPoly(
+ ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon) );
- // TODO(F3): fallback to drawPolyPolygon currently
- rAct.maFunction = &lcl_drawPolyPolygon;
+
+ if( strokeAttributes.DashArray.getLength() )
+ {
+ const ::std::vector<double>& aDashArray(
+ ::comphelper::sequenceToContainer< ::std::vector<double> >(strokeAttributes.DashArray) );
+
+ ::basegfx::B2DPolyPolygon aDashedPolyPoly;
+
+ for( sal_uInt32 i=0; i<aPolyPoly.count(); ++i )
+ {
+ // AW: new interface; You may also get gaps in the same run now
+ basegfx::tools::applyLineDashing(aPolyPoly.getB2DPolygon(i),
+ aDashArray,
+ &aDashedPolyPoly);
+ }
+
+ aPolyPoly = aDashedPolyPoly;
+ }
+
+ if( aLinePixelSize.getLength() < 1.42 )
+ {
+ // line width < 1.0 in device pixel, thus, output as a
+ // simple hairline poly-polygon
+ rAct.maPolyPolys.push_back(aPolyPoly);
+ rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
+
+ rAct.maFunction = &lcl_drawPolyPolygon;
+ }
+ else
+ {
+ // render as a 'thick' line
+ ::basegfx::B2DPolyPolygon aStrokedPolyPoly;
+ for( sal_uInt32 i=0; i<aPolyPoly.count(); ++i )
+ {
+ // TODO(F2): Use MiterLimit from StrokeAttributes,
+ // need to convert it here to angle.
+
+ // TODO(F2): Also use Cap settings from
+ // StrokeAttributes, the
+ // createAreaGeometryForLineStartEnd() method does not
+ // seem to fit very well here
+
+ // AW: New interface, will create bezier polygons now
+ aStrokedPolyPoly.append(basegfx::tools::createAreaGeometry(
+ aPolyPoly.getB2DPolygon(i),
+ strokeAttributes.StrokeWidth*0.5,
+ b2DJoineFromJoin(strokeAttributes.JoinType),
+ unoCapeFromCap(strokeAttributes.StartCapType)
+ ));
+ }
+ rAct.maPolyPolys.push_back(aStrokedPolyPoly);
+ rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
+
+ rAct.maFunction = &lcl_fillPolyPolygon;
+ }
}
// TODO(P1): Provide caching here.
commit d9f35cff34b125c0dbb02ad5e5ae07862817264d
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Wed Dec 10 08:40:39 2014 +0000
fix, transformation matrix for gradients
Change-Id: Ib93937ab944c7197824b7c618eada4ad70e64cb0
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index de8ef93..ec08cf8 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -213,11 +213,12 @@ namespace oglcanvas
aBounds.expand(::basegfx::tools::getRange(*aCurr++));
aTextureTransform.translate(-aBounds.getMinX(), -aBounds.getMinY());
aTextureTransform.scale(1/aBounds.getWidth(), 1/aBounds.getHeight());
+ aTextureTransform.invert();
const float aTextureTransformation[] =
{
- float(aTextureTransform.get(1,0)), float(aTextureTransform.get(1,1)),
- float(aTextureTransform.get(1,2)), float(aTextureTransform.get(0,0)),
- float(aTextureTransform.get(0,1)), float(aTextureTransform.get(0,2))
+ float(aTextureTransform.get(0,0)), float(aTextureTransform.get(1,0)),
+ float(aTextureTransform.get(0,1)), float(aTextureTransform.get(1,1)),
+ float(aTextureTransform.get(0,2)), float(aTextureTransform.get(1,2))
};
const glm::mat3x2 aTexTransform = glm::make_mat3x2(aTextureTransformation);
commit e3c0e262021f56cbae6f7cfbc04ee65dca7fece8
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Tue Dec 9 12:19:21 2014 +0000
use gradients in canvashelper
Change-Id: I242f63bb055336d208dad5efced3618c9f89e47f
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index eb645f6..de8ef93 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -180,7 +180,7 @@ namespace oglcanvas
const ::basegfx::B2DPolyPolygonVector::const_iterator aEnd=rPolyPolygons.end();
while( aCurr != aEnd )
{
- renderComplexPolyPolygon(*aCurr++, pRenderHelper, color, false);
+ renderComplexPolyPolygon(*aCurr++, pRenderHelper, color);
}
return true;
@@ -213,6 +213,13 @@ namespace oglcanvas
aBounds.expand(::basegfx::tools::getRange(*aCurr++));
aTextureTransform.translate(-aBounds.getMinX(), -aBounds.getMinY());
aTextureTransform.scale(1/aBounds.getWidth(), 1/aBounds.getHeight());
+ const float aTextureTransformation[] =
+ {
+ float(aTextureTransform.get(1,0)), float(aTextureTransform.get(1,1)),
+ float(aTextureTransform.get(1,2)), float(aTextureTransform.get(0,0)),
+ float(aTextureTransform.get(0,1)), float(aTextureTransform.get(0,2))
+ };
+ const glm::mat3x2 aTexTransform = glm::make_mat3x2(aTextureTransformation);
const sal_Int32 nNumCols=rValues.maColors.getLength();
uno::Sequence< rendering::ARGBColor > aColors(nNumCols);
@@ -223,36 +230,45 @@ namespace oglcanvas
OSL_ASSERT(nNumCols == rValues.maStops.getLength());
- switch( rValues.meType )
- {
- case ::canvas::ParametricPolyPolygon::GRADIENT_LINEAR:
- rHelper.getDeviceHelper()->useLinearGradientShader(pColors,
- rValues.maStops,
- aTextureTransform);
- break;
-
- case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL:
- rHelper.getDeviceHelper()->useRadialGradientShader(pColors,
- rValues.maStops,
- aTextureTransform);
- break;
-
- case ::canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR:
- rHelper.getDeviceHelper()->useRectangularGradientShader(pColors,
- rValues.maStops,
- aTextureTransform);
- break;
-
- default:
- ENSURE_OR_THROW( false,
- "CanvasHelper lcl_fillGradientPolyPolygon(): Unexpected case" );
- }
-
-
aCurr=rPolyPolygons.begin();
while( aCurr != aEnd )
{
- renderComplexPolyPolygon(*aCurr++, pRenderHelper, color, true);
+ ::basegfx::B2DPolyPolygon aPolyPoly(*aCurr++);
+ if( aPolyPoly.areControlPointsUsed() )
+ aPolyPoly = aPolyPoly.getDefaultAdaptiveSubdivision();
+ const ::basegfx::B2DRange& rBounds(aPolyPoly.getB2DRange());
+ const double nWidth=rBounds.getWidth();
+ const double nHeight=rBounds.getHeight();
+ const ::basegfx::B2DPolygon& rTriangulatedPolygon(
+ ::basegfx::triangulator::triangulate(aPolyPoly));
+ if(rTriangulatedPolygon.count()>0)
+ {
+ std::vector<glm::vec2> vertices;
+ vertices.reserve(rTriangulatedPolygon.count());
+ for( sal_uInt32 i=0; i<rTriangulatedPolygon.count(); i++ )
+ {
+ const ::basegfx::B2DPoint& rPt( rTriangulatedPolygon.getB2DPoint(i) );
+ vertices.push_back(glm::vec2(rPt.getX(),rPt.getY()));
+ }
+ switch(rValues.meType)
+ {
+ case ::canvas::ParametricPolyPolygon::GRADIENT_LINEAR:
+ pRenderHelper->renderLinearGradient( vertices, nWidth, nHeight, GL_TRIANGLES,
+ pColors, rValues.maStops, aTexTransform);
+ break;
+ case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL:
+ pRenderHelper->renderRadialGradient( vertices, nWidth, nHeight, GL_TRIANGLES,
+ pColors, rValues.maStops, aTexTransform);
+ break;
+ case ::canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR:
+ pRenderHelper->renderRectangularGradient( vertices, nWidth, nHeight, GL_TRIANGLES,
+ pColors, rValues.maStops, aTexTransform);
+ break;
+ default:
+ ENSURE_OR_THROW( false,
+ "CanvasHelper lcl_fillGradientPolyPolygon(): Unexpected case" );
+ }
+ }
}
glUseProgram(0);
diff --git a/canvas/source/opengl/ogl_canvastools.cxx b/canvas/source/opengl/ogl_canvastools.cxx
index 0894853..cc41d1c 100644
--- a/canvas/source/opengl/ogl_canvastools.cxx
+++ b/canvas/source/opengl/ogl_canvastools.cxx
@@ -30,14 +30,11 @@ namespace oglcanvas
{
// triangulates polygon before
void renderComplexPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly, RenderHelper *renderHelper,
- glm::vec4 color, const bool hasTexture)
+ glm::vec4 color)
{
::basegfx::B2DPolyPolygon aPolyPoly(rPolyPoly);
if( aPolyPoly.areControlPointsUsed() )
aPolyPoly = rPolyPoly.getDefaultAdaptiveSubdivision();
- const ::basegfx::B2DRange& rBounds(aPolyPoly.getB2DRange());
- const double nWidth=rBounds.getWidth();
- const double nHeight=rBounds.getHeight();
const ::basegfx::B2DPolygon& rTriangulatedPolygon(
::basegfx::triangulator::triangulate(aPolyPoly));
if(rTriangulatedPolygon.count()>0)
@@ -50,10 +47,7 @@ namespace oglcanvas
vertices.push_back(glm::vec2(rPt.getX(),rPt.getY()));
}
- if(hasTexture)
- renderHelper->renderVertexTex( vertices, nWidth, nHeight, color, GL_TRIANGLES);
- else
- renderHelper->renderVertexConstColor(vertices, color, GL_TRIANGLES);
+ renderHelper->renderVertexConstColor(vertices, color, GL_TRIANGLES);
}
}
diff --git a/canvas/source/opengl/ogl_canvastools.hxx b/canvas/source/opengl/ogl_canvastools.hxx
index 5c7e1e6..229c56d 100644
--- a/canvas/source/opengl/ogl_canvastools.hxx
+++ b/canvas/source/opengl/ogl_canvastools.hxx
@@ -26,7 +26,7 @@ namespace basegfx {
namespace oglcanvas
{
void renderComplexPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly,
- RenderHelper *renderHelper, glm::vec4 color, const bool hasTexture);
+ RenderHelper *renderHelper, glm::vec4 color);
void renderPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly, RenderHelper *renderHelper, glm::vec4 color );
void renderTransformComplexPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly, RenderHelper *renderHelper,
glm::vec4 color, glm::mat4 transform);
commit 9e68fd78bd363de52de52f3a1ea74380cb5d9339
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Tue Dec 9 09:38:21 2014 +0000
gradients
move gradients from spritedevicehelper to renderHelper,
render them with shaders.
Change-Id: Id1b7c2d435e15d0e5f12ca32e7fe7311301a705b
diff --git a/canvas/source/opengl/ogl_renderHelper.cxx b/canvas/source/opengl/ogl_renderHelper.cxx
index e235a66..50e1269 100644
--- a/canvas/source/opengl/ogl_renderHelper.cxx
+++ b/canvas/source/opengl/ogl_renderHelper.cxx
@@ -11,6 +11,7 @@
#include "ogl_renderHelper.hxx"
#include <vcl/opengl/OpenGLHelper.hxx>
#include <vcl/opengl/GLMHelper.hxx>
+
namespace oglcanvas
{
RenderHelper::RenderHelper():
@@ -25,6 +26,20 @@ namespace oglcanvas
m_simpleProgID = OpenGLHelper::LoadShaders("simpleVertexShader", "textFragmentShader");
m_texProgID = OpenGLHelper::LoadShaders("texVertexShader", "constantFragmentShader");
m_texTransProgID = OpenGLHelper::LoadShaders("textManipulatingVertexShader", "transformationFragmentShader");
+ mnLinearMultiColorGradientProgram =
+ OpenGLHelper::LoadShaders("textManipulatingVertexShader", "linearMultiColorGradientFragmentShader");
+
+ mnLinearTwoColorGradientProgram =
+ OpenGLHelper::LoadShaders("textManipulatingVertexShader", "linearTwoColorGradientFragmentShader");
+ mnRadialMultiColorGradientProgram =
+ OpenGLHelper::LoadShaders("textManipulatingVertexShader", "radialMultiColorGradientFragmentShader");
+ mnRadialTwoColorGradientProgram =
+ OpenGLHelper::LoadShaders("textManipulatingVertexShader", "radialTwoColorGradientFragmentShader");
+ mnRectangularMultiColorGradientProgram =
+ OpenGLHelper::LoadShaders("textManipulatingVertexShader", "rectangularMultiColorGradientFragmentShader");
+ mnRectangularTwoColorGradientProgram =
+ OpenGLHelper::LoadShaders("textManipulatingVertexShader", "rectangularTwoColorGradientFragmentShader");
+
// Get a handle for uniforms
m_manTexUnf = glGetUniformLocation(m_texManProgID, "TextTex");
m_simpleTexUnf = glGetUniformLocation(m_simpleProgID, "TextTex");
@@ -127,11 +142,15 @@ namespace oglcanvas
glDeleteProgram( m_texManProgID);
glDeleteProgram( m_simpleProgID);
glDeleteProgram( m_texProgID);
+ glDeleteProgram( mnRectangularTwoColorGradientProgram );
+ glDeleteProgram( mnRectangularMultiColorGradientProgram );
+ glDeleteProgram( mnRadialTwoColorGradientProgram );
+ glDeleteProgram( mnRadialMultiColorGradientProgram );
+ glDeleteProgram( mnLinearTwoColorGradientProgram );
+ glDeleteProgram( mnLinearMultiColorGradientProgram );
}
- // Renders a Polygon, Texture has to be stored in TextureUnit0
- // Uses fWidth,fHeight to generate texture coordinates in vertex-shader.
- void RenderHelper::renderVertexTex(const std::vector<glm::vec2>& rVertices, GLfloat fWidth, GLfloat fHeight,
+ void RenderHelper::renderVertexTex(const std::vector<glm::vec2>& rVertices, const GLfloat fWidth, const GLfloat fHeight,
const glm::vec4& vColor, GLenum mode) const
{
@@ -143,7 +162,7 @@ namespace oglcanvas
setupColorMVP(m_texManProgID, vColor);
const GLint nVertices = setupAttrb(rVertices,m_vertexBuffer, m_texManProgID, "vPosition");
-
+ glDisableVertexAttribArray(nVertices);
glDrawArrays(mode, 0, rVertices.size());
cleanUp();
@@ -170,6 +189,163 @@ namespace oglcanvas
glDisableVertexAttribArray(nVertices);
cleanUp();
}
+
+ void RenderHelper::setupGradientTransformation( unsigned int nProgramId,
+ const glm::mat3x2& rTexTransform,
+ GLfloat fWidth, GLfloat fHeight) const
+ {
+ const GLint nTransformLocation = glGetUniformLocation(nProgramId,
+ "m_transform" );
+ glUniformMatrix3x2fv(nTransformLocation,1,false,&rTexTransform[0][0]);
+
+ const GLint nMVPLocation = glGetUniformLocation(nProgramId,"MVP");
+ glUniformMatrix4fv(nMVPLocation, 1, GL_FALSE, &m_MVP[0][0]);
+
+ const GLint nTextTexLocation = glGetUniformLocation(mnLinearTwoColorGradientProgram, "texCord");
+ glUniform2f(nTextTexLocation, fWidth, fHeight);
+ }
+
+
+ static void setupGradientUniform( unsigned int nProgramId,
+ const ::com::sun::star::rendering::ARGBColor* pColors,
+ const ::com::sun::star::uno::Sequence< double >& rStops)
+ {
+ glUseProgram(nProgramId);
+
+ GLuint nColorsTexture;
+ glActiveTexture(GL_TEXTURE0);
+ glGenTextures(1, &nColorsTexture);
+ glBindTexture(GL_TEXTURE_1D, nColorsTexture);
+
+ const sal_Int32 nColors=rStops.getLength();
+ glTexImage1D( GL_TEXTURE_1D, 0, GL_RGBA, nColors, 0, GL_RGBA, GL_DOUBLE, pColors );
+ glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
+ glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
+
+ GLuint nStopsTexture;
+ glActiveTexture(GL_TEXTURE1);
+ glGenTextures(1, &nStopsTexture);
+ glBindTexture(GL_TEXTURE_1D, nStopsTexture);
+
+ glTexImage1D( GL_TEXTURE_1D, 0, GL_ALPHA, nColors, 0, GL_ALPHA, GL_DOUBLE, rStops.getConstArray() );
+ glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
+ glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
+
+ const GLint nColorArrayLocation = glGetUniformLocation(nProgramId,
+ "t_colorArray4d" );
+ glUniform1i( nColorArrayLocation, 0 ); // unit 0
+
+ const GLint nStopArrayLocation = glGetUniformLocation(nProgramId,
+ "t_stopArray1d" );
+ glUniform1i( nStopArrayLocation, 1 ); // unit 1
+
+ const GLint nNumColorLocation = glGetUniformLocation(nProgramId,
+ "i_nColors" );
+ glUniform1i( nNumColorLocation, nColors-1 );
+ }
+
+ static void setupGradientUniform( unsigned int nProgramId,
+ const ::com::sun::star::rendering::ARGBColor& rStartColor,
+ const ::com::sun::star::rendering::ARGBColor& rEndColor)
+ {
+ glUseProgram(nProgramId);
+
+ const GLint nStartColorLocation = glGetUniformLocation(nProgramId,
+ "v_startColor4d" );
+ glUniform4f(nStartColorLocation,
+ rStartColor.Red,
+ rStartColor.Green,
+ rStartColor.Blue,
+ rStartColor.Alpha);
+
+ const GLint nEndColorLocation = glGetUniformLocation(nProgramId,
+ "v_endColor4d" );
+ glUniform4f(nEndColorLocation,
+ rEndColor.Red,
+ rEndColor.Green,
+ rEndColor.Blue,
+ rEndColor.Alpha);
+ }
+
+ void RenderHelper::renderLinearGradient(const std::vector<glm::vec2>& rVertices,
+ const GLfloat fWidth, const GLfloat fHeight,
+ const GLenum mode,
+ const ::com::sun::star::rendering::ARGBColor* pColors,
+ const ::com::sun::star::uno::Sequence< double >& rStops,
+ const glm::mat3x2& rTexTransform) const
+ {
+ if( rStops.getLength() > 2 )
+ {
+ setupGradientUniform(mnLinearMultiColorGradientProgram, pColors, rStops);
+ setupGradientTransformation(mnLinearMultiColorGradientProgram, rTexTransform, fWidth, fHeight);
+ }
+ else
+ {
+ setupGradientUniform(mnLinearTwoColorGradientProgram, pColors[0], pColors[1]);
+ setupGradientTransformation(mnLinearTwoColorGradientProgram, rTexTransform, fWidth, fHeight);
+ }
+ const GLint nVertices = setupAttrb(rVertices,m_vertexBuffer, m_simpleProgID, "vPosition");
+
+ glDrawArrays(mode, 0, rVertices.size());
+
+ glDisableVertexAttribArray(nVertices);
+ cleanUp();
+ }
+
+ void RenderHelper::renderRadialGradient(const std::vector<glm::vec2>& rVertices,
+ const GLfloat fWidth, const GLfloat fHeight,
+ const GLenum mode,
+ const ::com::sun::star::rendering::ARGBColor* pColors,
+ const ::com::sun::star::uno::Sequence< double >& rStops,
+ const glm::mat3x2& rTexTransform) const
+ {
+ if( rStops.getLength() > 2 )
+ {
+ setupGradientUniform(mnRadialMultiColorGradientProgram, pColors, rStops);
+ setupGradientTransformation(mnRadialMultiColorGradientProgram, rTexTransform, fWidth, fHeight);
+ }
+ else
+ {
+ setupGradientUniform(mnRadialTwoColorGradientProgram, pColors[0], pColors[1]);
+ setupGradientTransformation(mnRadialTwoColorGradientProgram , rTexTransform, fWidth, fHeight);
+ }
+
+ const GLint nVertices = setupAttrb(rVertices,m_vertexBuffer, m_simpleProgID, "vPosition");
+
+ glDrawArrays(mode, 0, rVertices.size());
+
+ glDisableVertexAttribArray(nVertices);
+ cleanUp();
+ }
+
+ void RenderHelper::renderRectangularGradient(const std::vector<glm::vec2>& rVertices,
+ const GLfloat fWidth, const GLfloat fHeight,
+ const GLenum mode,
+ const ::com::sun::star::rendering::ARGBColor* pColors,
+ const ::com::sun::star::uno::Sequence< double >& rStops,
+ const glm::mat3x2& rTexTransform) const
+ {
+ if( rStops.getLength() > 2 )
+ {
+ setupGradientUniform(mnRectangularMultiColorGradientProgram, pColors, rStops);
+ setupGradientTransformation(mnRectangularMultiColorGradientProgram, rTexTransform, fWidth, fHeight);
+ }
+ else
+ {
+ setupGradientUniform(mnRectangularTwoColorGradientProgram, pColors[0], pColors[1]);
+ setupGradientTransformation(mnRectangularTwoColorGradientProgram , rTexTransform, fWidth, fHeight);
+ }
+
+ const GLint nVertices = setupAttrb(rVertices,m_vertexBuffer, m_simpleProgID, "vPosition");
+
+ glDrawArrays(mode, 0, rVertices.size());
+
+ glDisableVertexAttribArray(nVertices);
+ cleanUp();
+ }
+
+
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/source/opengl/ogl_renderHelper.hxx b/canvas/source/opengl/ogl_renderHelper.hxx
index 82d0ff4..011120a 100644
--- a/canvas/source/opengl/ogl_renderHelper.hxx
+++ b/canvas/source/opengl/ogl_renderHelper.hxx
@@ -13,20 +13,45 @@
#include <glm/glm.hpp>
#include "glm/gtx/transform.hpp"
#include <vector>
+#include <com/sun/star/rendering/XGraphicDevice.hpp>
+
namespace oglcanvas
{
class RenderHelper
{
public:
-
+ //renders vertices with a const color
void renderVertexConstColor(const std::vector<glm::vec2>& rVertices, const glm::vec4& vColor, GLenum mode) const;
+ //renders a texture bound in texture units 0, with the given texture coordinates
void renderVertexUVTex(const std::vector<glm::vec2>& rVertices, const std::vector<glm::vec2>& rUVcoords,
const glm::vec4& vColor, GLenum mode) const;
- void renderVertexTex(const std::vector<glm::vec2>& rVertices, GLfloat, GLfloat,
+ //renders a texture (texture unit 0) with texture coordinates at (vertice coord /(fWidth, fHeight))
+ void renderVertexTex(const std::vector<glm::vec2>& rVertices, const GLfloat fWidth, const GLfloat gHeight,
const glm::vec4& vColor, GLenum mode) const;
+ //see renderVertexTex description, just with an additional texture transformation matrix
void renderTextureTransform(const std::vector<glm::vec2>& rVertices, GLfloat fWidth,
GLfloat fHeight, const glm::vec4& color, GLenum mode, const glm::mat4& transform) const;
-
+ //Gradients
+ void renderLinearGradient( const std::vector<glm::vec2>& rVertices,
+ const GLfloat fWidth, const GLfloat fHeight,
+ const GLenum mode,
+ const ::com::sun::star::rendering::ARGBColor* pColors,
+ const ::com::sun::star::uno::Sequence< double >& rStops,
+ const glm::mat3x2& rTexTransform) const;
+
+ void renderRadialGradient( const std::vector<glm::vec2>& rVertices,
+ const GLfloat fWidth, const GLfloat fHeight,
+ const GLenum mode,
+ const ::com::sun::star::rendering::ARGBColor* pColors,
+ const ::com::sun::star::uno::Sequence< double >& rStops,
+ const glm::mat3x2& rTexTransform) const;
+
+ void renderRectangularGradient( const std::vector<glm::vec2>& rVertices,
+ const GLfloat fWidth, const GLfloat fHeight,
+ const GLenum mode,
+ const ::com::sun::star::rendering::ARGBColor* pColors,
+ const ::com::sun::star::uno::Sequence< double >& rStops,
+ const glm::mat3x2& rTexTransform) const;
RenderHelper();
void SetVP(const float width, const float height);
@@ -40,6 +65,9 @@ namespace oglcanvas
RenderHelper(const RenderHelper& other);
void setupColorMVP(const unsigned int nProgramID, const glm::vec4& color) const;
+ void setupGradientTransformation( unsigned int nProgramId,
+ const glm::mat3x2& rTexTransform,
+ GLfloat fWidth, GLfloat fHeight) const;
GLuint m_vertexBuffer;
GLuint m_uvBuffer;
@@ -64,6 +92,14 @@ namespace oglcanvas
// Our ModelViewProjection : multiplication of our 3 matrices
glm::mat4 m_MVP;
+ GLuint mnLinearTwoColorGradientProgram;
+ GLuint mnLinearMultiColorGradientProgram;
+ GLuint mnRadialMultiColorGradientProgram;
+ GLuint mnRadialTwoColorGradientProgram;
+ GLuint mnRectangularMultiColorGradientProgram;
+ GLuint mnRectangularTwoColorGradientProgram;
+
+
};
}
diff --git a/canvas/source/opengl/ogl_spritedevicehelper.cxx b/canvas/source/opengl/ogl_spritedevicehelper.cxx
index ba49896..087cedd 100644
--- a/canvas/source/opengl/ogl_spritedevicehelper.cxx
+++ b/canvas/source/opengl/ogl_spritedevicehelper.cxx
@@ -70,13 +70,7 @@ namespace oglcanvas
mpSpriteCanvas(NULL),
maActiveSprites(),
maLastUpdate(),
- mpTextureCache(new TextureCache()),
- mnLinearTwoColorGradientProgram(0),
- mnLinearMultiColorGradientProgram(0),
- mnRadialTwoColorGradientProgram(0),
- mnRadialMultiColorGradientProgram(0),
- mnRectangularTwoColorGradientProgram(0),
- mnRectangularMultiColorGradientProgram(0)
+ mpTextureCache(new TextureCache())
{}
SpriteDeviceHelper::~SpriteDeviceHelper()
@@ -99,26 +93,6 @@ namespace oglcanvas
// init window context
initContext();
mRenderHelper.InitOpenGL();
-
-
- mnLinearMultiColorGradientProgram =
- OpenGLHelper::LoadShaders("dummyVertexShader", "linearMultiColorGradientFragmentShader");
-
- mnLinearTwoColorGradientProgram =
- OpenGLHelper::LoadShaders("dummyVertexShader", "linearTwoColorGradientFragmentShader");
-
- mnRadialMultiColorGradientProgram =
- OpenGLHelper::LoadShaders("dummyVertexShader", "radialMultiColorGradientFragmentShader");
-
- mnRadialTwoColorGradientProgram =
- OpenGLHelper::LoadShaders("dummyVertexShader", "radialTwoColorGradientFragmentShader");
-
- mnRectangularMultiColorGradientProgram =
- OpenGLHelper::LoadShaders("dummyVertexShader", "rectangularMultiColorGradientFragmentShader");
-
- mnRectangularTwoColorGradientProgram =
- OpenGLHelper::LoadShaders("dummyVertexShader", "rectangularTwoColorGradientFragmentShader");
-
mpContext->makeCurrent();
notifySizeUpdate(rViewArea);
@@ -131,16 +105,6 @@ namespace oglcanvas
mpSpriteCanvas = NULL;
mpDevice = NULL;
mpTextureCache.reset();
-
- if( mpContext->isInitialized() )
- {
- glDeleteProgram( mnRectangularTwoColorGradientProgram );
- glDeleteProgram( mnRectangularMultiColorGradientProgram );
- glDeleteProgram( mnRadialTwoColorGradientProgram );
- glDeleteProgram( mnRadialMultiColorGradientProgram );
- glDeleteProgram( mnLinearTwoColorGradientProgram );
- glDeleteProgram( mnLinearMultiColorGradientProgram );
- }
mpContext.reset();
mRenderHelper.dispose();
}
@@ -318,14 +282,15 @@ namespace oglcanvas
aSprites.end(),
boost::mem_fn(&CanvasCustomSprite::renderSprite));
-
+#ifdef DEBUG_RENDERING
// frame counter, other info
const double denominator( maLastUpdate.getElapsedTime() );
maLastUpdate.reset();
+
const double fps(denominator == 0.0 ? 100.0 : 1.0/denominator);
-#ifdef DEBUG_RENDERING
+
std::vector<double> aVec;
aVec.push_back(mfAlpha);
aVec.push_back(mfPriority);
@@ -412,117 +377,6 @@ namespace oglcanvas
maActiveSprites.erase(xSprite);
}
- static void setupUniforms( unsigned int nProgramId,
- const ::basegfx::B2DHomMatrix& rTexTransform )
- {
- const GLint nTransformLocation = glGetUniformLocation(nProgramId,
- "m_transform" );
- // OGL is column-major
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list