summaryrefslogtreecommitdiffstats
path: root/chalk/plugins/viewplugins/histogram_docker/kis_accumulating_producer.cc
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2021-05-23 20:48:35 +0900
committerMichele Calgaro <[email protected]>2021-05-29 15:16:28 +0900
commit8b78a8791bc539bcffe7159f9d9714d577cb3d7d (patch)
tree1328291f966f19a22d7b13657d3f01a588eb1083 /chalk/plugins/viewplugins/histogram_docker/kis_accumulating_producer.cc
parent95834e2bdc5e01ae1bd21ac0dfa4fa1d2417fae9 (diff)
downloadkoffice-8b78a8791bc539bcffe7159f9d9714d577cb3d7d.tar.gz
koffice-8b78a8791bc539bcffe7159f9d9714d577cb3d7d.zip
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'chalk/plugins/viewplugins/histogram_docker/kis_accumulating_producer.cc')
-rw-r--r--chalk/plugins/viewplugins/histogram_docker/kis_accumulating_producer.cc102
1 files changed, 0 insertions, 102 deletions
diff --git a/chalk/plugins/viewplugins/histogram_docker/kis_accumulating_producer.cc b/chalk/plugins/viewplugins/histogram_docker/kis_accumulating_producer.cc
deleted file mode 100644
index 217a36d9..00000000
--- a/chalk/plugins/viewplugins/histogram_docker/kis_accumulating_producer.cc
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * This file is part of Chalk
- *
- * Copyright (c) 2005 Bart Coppens <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <tqthread.h>
-#include <tqapplication.h>
-#include <tqevent.h>
-
-#include "kis_accumulating_producer.h"
-
-static const int EmitCompletedType = TQEvent::User + 1;
-
-/**
- * The threaded producer definition in c++ file because this is really an internal affair.
- * Note that since we _know_ that we'll only have a single instance of it running, at most,
- * we don't care too much about locking and synchronization
- **/
-class KisAccumulatingHistogramProducer::ThreadedProducer : public TQThread {
- KisAccumulatingHistogramProducer* m_source;
- bool m_stop;
-protected:
- virtual void run();
-public:
- ThreadedProducer(KisAccumulatingHistogramProducer* source)
- : m_source(source), m_stop(false) {}
- void cancel() { m_stop = true; }
-};
-
-KisAccumulatingHistogramProducer::KisAccumulatingHistogramProducer(KisCachedHistogramObserver::Producers* source)
- : KisBasicHistogramProducer(
- KisID("ACCHISTO", ""),
- source->at(0)->channels().count(),
- source->at(0)->numberOfBins(),
- 0),
- m_source(source)
-{
- m_thread = new ThreadedProducer(this);
-}
-
-KisAccumulatingHistogramProducer::~KisAccumulatingHistogramProducer() {
- m_thread->cancel();
- m_thread->wait();
- delete m_thread;
-}
-
-void KisAccumulatingHistogramProducer::addRegionsToBinAsync() {
- m_thread->cancel();
- m_thread->wait();
- clear();
- m_thread->start();
-}
-
-void KisAccumulatingHistogramProducer::ThreadedProducer::run() {
- m_stop = false;
-
- uint count = m_source->m_source->count(); // Talk about bad naming schemes...
- KisCachedHistogramObserver::Producers* source = m_source->m_source;
- TQValueVector<vBins>& bins = m_source->m_bins;
- int channels = m_source->m_channels;
- int nrOfBins = m_source->m_nrOfBins;
-
- for (uint i = 0; i < count && !m_stop; i++) {
- KisHistogramProducer* p = source->at(i);
- m_source->m_count += p->count();
-
- for (int j = 0; j < channels && !m_stop; j++) {
- for (int k = 0; k < nrOfBins; k++) {
- bins.at(j).at(k) += p->getBinAt(j, k);
- }
- }
- }
-
- if (!m_stop) {
- // This function is thread-safe; and it takes ownership of the event
- TQApplication::postEvent(m_source, new TQCustomEvent(EmitCompletedType));
- }
-}
-
-void KisAccumulatingHistogramProducer::customEvent(TQCustomEvent* e) {
- if (e->type() == EmitCompletedType) {
- emit completed();
- }
-}
-
-#include "kis_accumulating_producer.moc"
-