summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-02-26 14:42:02 +0100
committerThorsten Behrens <thorsten.behrens@allotropia.de>2021-05-05 21:41:11 +0200
commitbf8f4cd1000e77b997c51d85b40b16c69e90bc6c (patch)
tree4ca5c589a517a41478c4353ec565d8085b2ff6c5
parent383ded27aa5a8770de7c1cb1127a178df99cb167 (diff)
catchall
Change-Id: If3eadcc396ab500f1a08a334a957ee0494aef033
-rw-r--r--RepositoryModule_host.mk8
-rw-r--r--configure.ac4
-rw-r--r--postprocess/Rdb_services.mk15
-rw-r--r--solenv/gbuild/LinkTarget.mk7
-rw-r--r--solenv/gbuild/platform/unxgcc.mk2
-rw-r--r--solenv/gbuild/static.mk2
-rw-r--r--vcl/Module_vcl.mk3
-rw-r--r--wasm/CustomTarget_wasm-qt5-mandelbrot_moc.mk37
-rw-r--r--wasm/Executable_wasm-qt5-mandelbrot.mk32
-rw-r--r--wasm/Module_wasm.mk2
-rw-r--r--wasm/source/qt5-mandelbrot/main.cxx66
-rw-r--r--wasm/source/qt5-mandelbrot/mandelbrotwidget.cxx228
-rw-r--r--wasm/source/qt5-mandelbrot/mandelbrotwidget.h91
-rw-r--r--wasm/source/qt5-mandelbrot/renderthread.cxx232
-rw-r--r--wasm/source/qt5-mandelbrot/renderthread.h97
15 files changed, 15 insertions, 811 deletions
diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk
index 25a314e9785a..64068ffc0e49 100644
--- a/RepositoryModule_host.mk
+++ b/RepositoryModule_host.mk
@@ -107,12 +107,10 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
$(call gb_Helper_optional,DESKTOP,setup_native) \
sfx2 \
shell \
- slideshow \
smoketest \
solenv \
soltools \
sot \
- starmath \
stoc \
store \
svl \
@@ -143,6 +141,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
vbahelper \
vcl \
wasm \
+ wasm-qt \
winaccessibility \
wizards \
writerfilter \
@@ -177,11 +176,10 @@ endef
# the default goal is build (see Module.mk)
ifeq (,$(filter-out build check unitcheck slowcheck screenshot subsequentcheck uicheck,$(MAKECMDGOALS)))
$(eval $(call repositorymodule_serialize,\
- scfilt \
$(call gb_Helper_optional,SCRIPTING,vbaobj) \
- sc msword \
+ msword \
$(call gb_Helper_optional,DESKTOP,swui) \
- sw sd \
+ sw \
$(call gb_Helper_optional,DBCONNECTIVITY,dbu) \
writerfilter cui chartcontroller chartcore oox \
$(if $(MERGELIBS), merged, \
diff --git a/configure.ac b/configure.ac
index 7e714ccc78f5..aa033a0c13ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4401,6 +4401,10 @@ if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no"
else
AC_MSG_RESULT([yes])
fi
+ if test "$_os" = "Emscripten" -a -z "$enable_optimized"; then
+ # Otherwise binaries simply become too large (linker OOM + browser fails to load)
+ enable_optimized=debug
+ fi
else
ENABLE_DEBUG=""
AC_MSG_RESULT([no])
diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk
index 0154db097caf..1f5d530a81f6 100644
--- a/postprocess/Rdb_services.mk
+++ b/postprocess/Rdb_services.mk
@@ -101,20 +101,6 @@ $(eval $(call gb_Rdb_add_components,services,\
lotuswordpro/util/lwpfilter \
) \
oox/util/oox \
- sc/util/sc \
- sc/util/scd \
- sc/util/scfilt \
- scaddins/source/analysis/analysis \
- scaddins/source/datefunc/date \
- scaddins/source/pricing/pricing \
- sd/util/sd \
- sd/util/sdd \
- sd/util/sdfilt \
- sdext/source/presenter/presenter \
- sdext/source/minimizer/minimizer \
- slideshow/util/slideshow \
- starmath/util/sm \
- starmath/util/smd \
svx/util/svx \
svx/util/textconversiondlgs \
sw/util/msword \
@@ -144,7 +130,6 @@ $(eval $(call gb_Rdb_add_components,services,\
$(if $(ENABLE_LPSOLVE), \
sccomp/source/solver/lpsolvesolver \
) \
- sccomp/source/solver/swarmsolver \
writerfilter/util/writerfilter \
writerperfect/source/draw/wpftdraw \
writerperfect/source/impress/wpftimpress \
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 404b394d4e0c..f71525c835de 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -45,10 +45,9 @@ gb_LinkTarget__symbols_enabled = \
# debug flags, if the LinkTarget is named in the list of libraries of ENABLE_SYMBOLS_FOR
gb_LinkTarget__get_debugflags= \
-$(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS), \
-$(if $(ENABLE_OPTIMIZED_DEBUG),$(gb_COMPILERDEBUGOPTFLAGS), \
-$(gb_COMPILERNOOPTFLAGS))) \
-$(if $(call gb_LinkTarget__symbols_enabled,$(1)),$(gb_DEBUGINFO_FLAGS))
+ $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS), \
+ $(if $(ENABLE_OPTIMIZED_DEBUG),$(gb_COMPILERDEBUGOPTFLAGS),$(gb_COMPILERNOOPTFLAGS))) \
+ $(if $(call gb_LinkTarget__symbols_enabled,$(1)),$(gb_DEBUGINFO_FLAGS))
# T_LDFLAGS is just expanded once. Override the flags here, so that the linker and compiler use the same.
ifeq (EMSCRIPTEN,$(OS))
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index d56b642382d2..515a2b37c9d4 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -158,7 +158,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(WORKDIR)/LinkTarget/$(2).exports,$(1))))
$(if $(and $(filter CppunitTest Executable,$(TARGETTYPE)),$(filter EMSCRIPTEN,$(OS)),$(filter TRUE,$(ENABLE_QT5))), \
cp $(QT5_PLATFORMS_SRCDIR)/qtlogo.svg $(QT5_PLATFORMS_SRCDIR)/qtloader.js $(dir $(1)) ; \
- sed -e 's/@APPNAME@/$(subst $(gb_Executable_EXT),,$(notdir $(1)))/' $(QT5_PLATFORMS_SRCDIR)/wasm_shell.html > $(1))
+ sed -e 's/@APPNAME@/$(subst $(gb_Executable_EXT),,$(notdir $(1)))/' $(QT5_PLATFORMS_SRCDIR)/wasm_shell.html > $(dir $(1))qt_$(notdir $(1)))
endef
define gb_LinkTarget__command_staticlink
diff --git a/solenv/gbuild/static.mk b/solenv/gbuild/static.mk
index da16724520d2..7928a699d42f 100644
--- a/solenv/gbuild/static.mk
+++ b/solenv/gbuild/static.mk
@@ -232,7 +232,7 @@ $$(if $$(filter-out GBUILD_TOUCHED,$$(call gb_$(2)__get_all_externals,$(3))), \
$$(eval $$(call gb_$(2)_use_externals,$(3),$$(filter-out GBUILD_TOUCHED,$$(call gb_$(2)__get_all_externals,$(3)))))) \
$$(if $$(filter icui28n icuuc,$$(call gb_$(2)__get_all_externals,$(3))), \
$$(eval $$(call gb_$(2)_use_externals,$(3),icudata))) \
-$$(if $$(and $$(filter EMSCRIPTEN,$$(OS)),$$(call gb_$(2)__has_any_dependencies,$(3))), \
+$$(if $$(and $$(filter EMSCRIPTEN,$$(OS)),$$(call gb_$(2)__has_any_dependencies,$(3)),), \
$$(if $$(gb_$(2)__LAST_KNOWN), \
$$(if $$(gb_DEBUG_STATIC),$$(info $$(call gb_$(2)_get_linktargetfile,$(3)) => $$(call gb_$(2)_get_linktargetfile,$$(gb_$(2)__LAST_KNOWN)))) \
$$(eval $$(call gb_$(2)_get_linktargetfile,$(3)) : $$(call gb_$(2)_get_linktargetfile,$$(gb_$(2)__LAST_KNOWN)))) \
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 3cf84ac21210..f01de5e0a89c 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -31,6 +31,9 @@ $(eval $(call gb_Module_add_targets,vcl,\
Package_skia_denylist ) \
$(if $(filter DESKTOP,$(BUILD_TYPE))$(filter EMSCRIPTEN,$(OS)), \
StaticLibrary_vclmain \
+ $(if $(ENABLE_MACOSX_SANDBOX),, \
+ $(if $(DISABLE_GUI),, \
+ Executable_ui-previewer)) \
$(if $(filter EMSCRIPTEN LINUX MACOSX SOLARIS WNT %BSD,$(OS)), \
$(if $(DISABLE_GUI),, \
Executable_vcldemo ))) \
diff --git a/wasm/CustomTarget_wasm-qt5-mandelbrot_moc.mk b/wasm/CustomTarget_wasm-qt5-mandelbrot_moc.mk
deleted file mode 100644
index 52b7447d22e9..000000000000
--- a/wasm/CustomTarget_wasm-qt5-mandelbrot_moc.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-$(eval $(call gb_CustomTarget_CustomTarget,wasm/qt5-mandelbrot))
-
-$(call gb_CustomTarget_get_target,wasm/qt5-mandelbrot) : \
- $(call gb_CustomTarget_get_workdir,wasm/qt5-mandelbrot)/renderthread.moc \
- $(call gb_CustomTarget_get_workdir,wasm/qt5-mandelbrot)/mandelbrotwidget.moc \
-
-qt5_mandelbrot_MOCDEFS_H := $(call gb_CustomTarget_get_workdir,wasm/qt5-mandelbrot)/moc_predefs.h
-qt5_mandelbrot_MOCDEFS_CXX := $(call gb_CustomTarget_get_workdir,wasm/qt5-mandelbrot)/moc_dummy.cxx
-qt5_mandelbrot_WORKDIR := $(call gb_CustomTarget_get_workdir,wasm/qt5-mandelbrot)/.dir
-
-$(qt5_mandelbrot_MOCDEFS_CXX): | $(qt5_mandelbrot_WORKDIR)
- touch $@
-
-$(qt5_mandelbrot_MOCDEFS_H): $(qt5_mandelbrot_MOCDEFS_CXX) | $(qt5_mandelbrot_WORKDIR)
- $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CXX,1)
- $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),CXX)
- $(CXX) -pipe -O2 -std=gnu++11 -fno-exceptions $(gb_EMSCRIPTEN_CPPFLAGS) -dM -E -o $@ $<
- $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),MOC)
-
-$(call gb_CustomTarget_get_workdir,wasm/qt5-mandelbrot)/%.moc : \
- $(SRCDIR)/wasm/source/qt5-mandelbrot/%.h \
- $(qt5_mandelbrot_MOCDEFS_H) | $(qt5_mandelbrot_WORKDIR)
- $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),MOC,1)
- $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),MOC)
- $(MOC5) --include $(qt5_mandelbrot_MOCDEFS_H) $(gb_EMSCRIPTEN_QTDEFS) $< -o $@
- $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),MOC)
-
-# vim: set noet sw=4:
diff --git a/wasm/Executable_wasm-qt5-mandelbrot.mk b/wasm/Executable_wasm-qt5-mandelbrot.mk
deleted file mode 100644
index 7afaa81c0dc4..000000000000
--- a/wasm/Executable_wasm-qt5-mandelbrot.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-$(eval $(call gb_Executable_Executable,wasm-qt5-mandelbrot))
-
-$(eval $(call gb_Executable_use_custom_headers,wasm-qt5-mandelbrot,wasm/qt5-mandelbrot))
-
-$(eval $(call gb_Executable_use_externals,wasm-qt5-mandelbrot,\
- graphite \
- freetype \
- harfbuzz \
- libpng \
- qt5 \
-))
-
-$(eval $(call gb_Executable_add_exception_objects,wasm-qt5-mandelbrot,\
- wasm/source/qt5-mandelbrot/main \
- wasm/source/qt5-mandelbrot/mandelbrotwidget \
- wasm/source/qt5-mandelbrot/renderthread \
-))
-
-$(eval $(call gb_Executable_add_defs,wasm-qt5-mandelbrot,\
- -DVCL_INTERNALS \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/wasm/Module_wasm.mk b/wasm/Module_wasm.mk
index d6f507a005df..eff9d0d7d1e9 100644
--- a/wasm/Module_wasm.mk
+++ b/wasm/Module_wasm.mk
@@ -11,8 +11,6 @@ $(eval $(call gb_Module_Module,wasm))
ifeq ($(OS),EMSCRIPTEN)
$(eval $(call gb_Module_add_targets,wasm,\
- CustomTarget_wasm-qt5-mandelbrot_moc \
- Executable_wasm-qt5-mandelbrot \
CustomTarget_components \
Library_components \
))
diff --git a/wasm/source/qt5-mandelbrot/main.cxx b/wasm/source/qt5-mandelbrot/main.cxx
deleted file mode 100644
index 037c63153cf2..000000000000
--- a/wasm/source/qt5-mandelbrot/main.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mandelbrotwidget.h"
-
-#include <QtWidgets/QApplication>
-#include <QtCore/QtPlugin>
-
-Q_IMPORT_PLUGIN(QWasmIntegrationPlugin)
-
-int main(int argc, char* argv[])
-{
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
- QApplication app(argc, argv);
- MandelbrotWidget widget;
- widget.show();
- return app.exec();
-}
diff --git a/wasm/source/qt5-mandelbrot/mandelbrotwidget.cxx b/wasm/source/qt5-mandelbrot/mandelbrotwidget.cxx
deleted file mode 100644
index 5886dd2664c0..000000000000
--- a/wasm/source/qt5-mandelbrot/mandelbrotwidget.cxx
+++ /dev/null
@@ -1,228 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mandelbrotwidget.h"
-#include "mandelbrotwidget.moc"
-
-#include <QtGui/QPainter>
-#include <QtGui/QKeyEvent>
-
-#include <math.h>
-
-const double DefaultCenterX = -0.637011;
-const double DefaultCenterY = -0.0395159;
-const double DefaultScale = 0.00403897;
-
-const double ZoomInFactor = 0.8;
-const double ZoomOutFactor = 1 / ZoomInFactor;
-const int ScrollStep = 20;
-
-MandelbrotWidget::MandelbrotWidget(QWidget* parent)
- : QWidget(parent)
- , centerX(DefaultCenterX)
- , centerY(DefaultCenterY)
- , pixmapScale(DefaultScale)
- , curScale(DefaultScale)
-{
- connect(&thread, &RenderThread::renderedImage, this, &MandelbrotWidget::updatePixmap);
-
- setWindowTitle(tr("Mandelbrot"));
-#if QT_CONFIG(cursor)
- setCursor(Qt::CrossCursor);
-#endif
- resize(550, 400);
-}
-
-void MandelbrotWidget::paintEvent(QPaintEvent* /* event */)
-{
- QPainter painter(this);
- painter.fillRect(rect(), Qt::black);
-
- if (pixmap.isNull())
- {
- painter.setPen(Qt::white);
- painter.drawText(rect(), Qt::AlignCenter, tr("Rendering initial image, please wait..."));
- return;
- }
-
- if (qFuzzyCompare(curScale, pixmapScale))
- {
- painter.drawPixmap(pixmapOffset, pixmap);
- }
- else
- {
- auto previewPixmap = qFuzzyCompare(pixmap.devicePixelRatioF(), qreal(1))
- ? pixmap
- : pixmap.scaled(pixmap.size() / pixmap.devicePixelRatioF(),
- Qt::KeepAspectRatio, Qt::SmoothTransformation);
- double scaleFactor = pixmapScale / curScale;
- int newWidth = int(previewPixmap.width() * scaleFactor);
- int newHeight = int(previewPixmap.height() * scaleFactor);
- int newX = pixmapOffset.x() + (previewPixmap.width() - newWidth) / 2;
- int newY = pixmapOffset.y() + (previewPixmap.height() - newHeight) / 2;
-
- painter.save();
- painter.translate(newX, newY);
- painter.scale(scaleFactor, scaleFactor);
-
- QRectF exposed = painter.transform().inverted().mapRect(rect()).adjusted(-1, -1, 1, 1);
- painter.drawPixmap(exposed, previewPixmap, exposed);
- painter.restore();
- }
-
- QString text = tr("Use mouse wheel or the '+' and '-' keys to zoom. "
- "Press and hold left mouse button to scroll.");
- QFontMetrics metrics = painter.fontMetrics();
- int textWidth = metrics.horizontalAdvance(text);
-
- painter.setPen(Qt::NoPen);
- painter.setBrush(QColor(0, 0, 0, 127));
- painter.drawRect((width() - textWidth) / 2 - 5, 0, textWidth + 10, metrics.lineSpacing() + 5);
- painter.setPen(Qt::white);
- painter.drawText((width() - textWidth) / 2, metrics.leading() + metrics.ascent(), text);
-}
-
-void MandelbrotWidget::resizeEvent(QResizeEvent* /* event */)
-{
- thread.render(centerX, centerY, curScale, size(), devicePixelRatioF());
-}
-
-void MandelbrotWidget::keyPressEvent(QKeyEvent* event)
-{
- switch (event->key())
- {
- case Qt::Key_Plus:
- zoom(ZoomInFactor);
- break;
- case Qt::Key_Minus:
- zoom(ZoomOutFactor);
- break;
- case Qt::Key_Left:
- scroll(-ScrollStep, 0);
- break;
- case Qt::Key_Right:
- scroll(+ScrollStep, 0);
- break;
- case Qt::Key_Down:
- scroll(0, -ScrollStep);
- break;
- case Qt::Key_Up:
- scroll(0, +ScrollStep);
- break;
- default:
- QWidget::keyPressEvent(event);
- }
-}
-
-#if QT_CONFIG(wheelevent)
-void MandelbrotWidget::wheelEvent(QWheelEvent* event)
-{
- const int numDegrees = event->angleDelta().y() / 8;
- const double numSteps = numDegrees / double(15);
- zoom(pow(ZoomInFactor, numSteps));
-}
-#endif
-
-void MandelbrotWidget::mousePressEvent(QMouseEvent* event)
-{
- if (event->button() == Qt::LeftButton)
- lastDragPos = event->pos();
-}
-
-void MandelbrotWidget::mouseMoveEvent(QMouseEvent* event)
-{
- if (event->buttons() & Qt::LeftButton)
- {
- pixmapOffset += event->pos() - lastDragPos;
- lastDragPos = event->pos();
- update();
- }
-}
-
-void MandelbrotWidget::mouseReleaseEvent(QMouseEvent* event)
-{
- if (event->button() == Qt::LeftButton)
- {
- pixmapOffset += event->pos() - lastDragPos;
- lastDragPos = QPoint();
-
- const auto pixmapSize = pixmap.size() / pixmap.devicePixelRatioF();
- int deltaX = (width() - pixmapSize.width()) / 2 - pixmapOffset.x();
- int deltaY = (height() - pixmapSize.height()) / 2 - pixmapOffset.y();
- scroll(deltaX, deltaY);
- }
-}
-
-void MandelbrotWidget::updatePixmap(const QImage& image, double scaleFactor)
-{
- if (!lastDragPos.isNull())
- return;
-
- pixmap = QPixmap::fromImage(image);
- pixmapOffset = QPoint();
- lastDragPos = QPoint();
- pixmapScale = scaleFactor;
- update();
-}
-
-void MandelbrotWidget::zoom(double zoomFactor)
-{
- curScale *= zoomFactor;
- update();
- thread.render(centerX, centerY, curScale, size(), devicePixelRatioF());
-}
-
-void MandelbrotWidget::scroll(int deltaX, int deltaY)
-{
- centerX += deltaX * curScale;
- centerY += deltaY * curScale;
- update();
- thread.render(centerX, centerY, curScale, size(), devicePixelRatioF());
-}
diff --git a/wasm/source/qt5-mandelbrot/mandelbrotwidget.h b/wasm/source/qt5-mandelbrot/mandelbrotwidget.h
deleted file mode 100644
index 72e95568b522..000000000000
--- a/wasm/source/qt5-mandelbrot/mandelbrotwidget.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#pragma once
-
-#include <QtGui/QPixmap>
-#include <QtWidgets/QWidget>
-
-#include "renderthread.h"
-
-class MandelbrotWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- MandelbrotWidget(QWidget* parent = nullptr);
-
-protected:
- void paintEvent(QPaintEvent* event) override;
- void resizeEvent(QResizeEvent* event) override;
- void keyPressEvent(QKeyEvent* event) override;
-#if QT_CONFIG(wheelevent)
- void wheelEvent(QWheelEvent* event) override;
-#endif
- void mousePressEvent(QMouseEvent* event) override;
- void mouseMoveEvent(QMouseEvent* event) override;
- void mouseReleaseEvent(QMouseEvent* event) override;
-
-private slots:
- void updatePixmap(const QImage& image, double scaleFactor);
- void zoom(double zoomFactor);
-
-private:
- void scroll(int deltaX, int deltaY);
-
- RenderThread thread;
- QPixmap pixmap;
- QPoint pixmapOffset;
- QPoint lastDragPos;
- double centerX;
- double centerY;
- double pixmapScale;
- double curScale;
-};
diff --git a/wasm/source/qt5-mandelbrot/renderthread.cxx b/wasm/source/qt5-mandelbrot/renderthread.cxx
deleted file mode 100644
index 398e43ded15d..000000000000
--- a/wasm/source/qt5-mandelbrot/renderthread.cxx
+++ /dev/null
@@ -1,232 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "renderthread.h"
-#include "renderthread.moc"
-
-#include <QtGui/QImage>
-#include <cmath>
-
-RenderThread::RenderThread(QObject* parent)
- : QThread(parent)
-{
- for (int i = 0; i < ColormapSize; ++i)
- m_colormap[i] = rgbFromWaveLength(380.0 + (i * 400.0 / ColormapSize));
-}
-
-RenderThread::~RenderThread()
-{
- m_mutex.lock();
- m_abort = true;
- m_condition.wakeOne();
- m_mutex.unlock();
-
- wait();
-}
-
-void RenderThread::render(double centerX, double centerY, double scaleFactor, QSize resultSize,
- double devicePixelRatio)
-{
- QMutexLocker locker(&m_mutex);
-
- m_centerX = centerX;
- m_centerY = centerY;
- m_scaleFactor = scaleFactor;
- m_devicePixelRatio = devicePixelRatio;
- m_resultSize = resultSize;
-
- if (!isRunning())
- {
- start(LowPriority);
- }
- else
- {
- m_restart = true;
- m_condition.wakeOne();
- }
-}
-
-void RenderThread::run()
-{
- forever
- {
- m_mutex.lock();
- const double devicePixelRatio = m_devicePixelRatio;
- const QSize resultSize = m_resultSize * devicePixelRatio;
- const double requestedScaleFactor = m_scaleFactor;
- const double scaleFactor = requestedScaleFactor / devicePixelRatio;
- const double centerX = m_centerX;
- const double centerY = m_centerY;
- m_mutex.unlock();
-
- int halfWidth = resultSize.width() / 2;
- int halfHeight = resultSize.height() / 2;
- QImage image(resultSize, QImage::Format_RGB32);
- image.setDevicePixelRatio(devicePixelRatio);
-
- const int NumPasses = 8;
- int pass = 0;
- while (pass < NumPasses)
- {
- const int MaxIterations = (1 << (2 * pass + 6)) + 32;
- const int Limit = 4;
- bool allBlack = true;
-
- for (int y = -halfHeight; y < halfHeight; ++y)
- {
- if (m_restart)
- break;
- if (m_abort)
- return;
-
- auto scanLine = reinterpret_cast<uint*>(image.scanLine(y + halfHeight));
- const double ay = centerY + (y * scaleFactor);
-
- for (int x = -halfWidth; x < halfWidth; ++x)
- {
- const double ax = centerX + (x * scaleFactor);
- double a1 = ax;
- double b1 = ay;
- int numIterations = 0;
-
- do
- {
- ++numIterations;
- const double a2 = (a1 * a1) - (b1 * b1) + ax;
- const double b2 = (2 * a1 * b1) + ay;
- if ((a2 * a2) + (b2 * b2) > Limit)
- break;
-
- ++numIterations;
- a1 = (a2 * a2) - (b2 * b2) + ax;
- b1 = (2 * a2 * b2) + ay;
- if ((a1 * a1) + (b1 * b1) > Limit)
- break;
- } while (numIterations < MaxIterations);
-
- if (numIterations < MaxIterations)
- {
- *scanLine++ = m_colormap[numIterations % ColormapSize];
- allBlack = false;
- }
- else
- {
- *scanLine++ = qRgb(0, 0, 0);
- }
- }
- }
-
- if (allBlack && pass == 0)
- {
- pass = 4;
- }
- else
- {
- if (!m_restart)
- emit renderedImage(image, requestedScaleFactor);
- ++pass;
- }
- }
-
- m_mutex.lock();
- if (!m_restart)
- m_condition.wait(&m_mutex);
- m_restart = false;
- m_mutex.unlock();
- }
-}
-
-uint RenderThread::rgbFromWaveLength(double wave)
-{
- double r = 0;
- double g = 0;
- double b = 0;
-
- if (wave >= 380.0 && wave <= 440.0)
- {
- r = -1.0 * (wave - 440.0) / (440.0 - 380.0);
- b = 1.0;
- }
- else if (wave >= 440.0 && wave <= 490.0)
- {
- g = (wave - 440.0) / (490.0 - 440.0);
- b = 1.0;
- }
- else if (wave >= 490.0 && wave <= 510.0)
- {
- g = 1.0;
- b = -1.0 * (wave - 510.0) / (510.0 - 490.0);
- }
- else if (wave >= 510.0 && wave <= 580.0)
- {
- r = (wave - 510.0) / (580.0 - 510.0);
- g = 1.0;
- }
- else if (wave >= 580.0 && wave <= 645.0)
- {
- r = 1.0;
- g = -1.0 * (wave - 645.0) / (645.0 - 580.0);
- }
- else if (wave >= 645.0 && wave <= 780.0)
- {
- r = 1.0;
- }
-
- double s = 1.0;
- if (wave > 700.0)
- s = 0.3 + 0.7 * (780.0 - wave) / (780.0 - 700.0);
- else if (wave < 420.0)
- s = 0.3 + 0.7 * (wave - 380.0) / (420.0 - 380.0);
-
- r = std::pow(r * s, 0.8);
- g = std::pow(g * s, 0.8);
- b = std::pow(b * s, 0.8);
- return qRgb(int(r * 255), int(g * 255), int(b * 255));
-}
diff --git a/wasm/source/qt5-mandelbrot/renderthread.h b/wasm/source/qt5-mandelbrot/renderthread.h
deleted file mode 100644
index 16c0d86fd46c..000000000000
--- a/wasm/source/qt5-mandelbrot/renderthread.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#pragma once
-
-#include <QtCore/QMutex>
-#include <QtCore/QSize>
-#include <QtCore/QThread>
-#include <QtCore/QWaitCondition>
-
-QT_BEGIN_NAMESPACE
-class QImage;
-QT_END_NAMESPACE
-
-class RenderThread : public QThread
-{
- Q_OBJECT
-
-public:
- RenderThread(QObject* parent = nullptr);
- ~RenderThread();
-
- void render(double centerX, double centerY, double scaleFactor, QSize resultSize,
- double devicePixelRatio);
-
-signals:
- void renderedImage(const QImage& image, double scaleFactor);
-
-protected:
- void run() override;
-
-private:
- static uint rgbFromWaveLength(double wave);
-
- QMutex m_mutex;
- QWaitCondition m_condition;
- double m_centerX;
- double m_centerY;
- double m_scaleFactor;
- double m_devicePixelRatio;
- QSize m_resultSize;
- bool m_restart = false;
- bool m_abort = false;
-
- enum
- {
- ColormapSize = 512
- };
- uint m_colormap[ColormapSize];
-};