[Digikam-devel] Fwd: KDE/kdeedu/marble/src/lib
Gilles Caulier
caulier.gilles at gmail.com
Wed Nov 26 12:04:18 GMT 2008
To all,
For informations, this commit from Patrick into marble from trunk must
speed-up digiKam startup to use shared components for all marble
instances...
Gilles Caulier
---------- Forwarded message ----------
From: Patrick Spendrin <ps_ml at gmx.de>
Date: 2008/11/26
Subject: KDE/kdeedu/marble/src/lib
To: kde-commits at kde.org
Cc: caulier.gilles at gmail.com
SVN commit 889199 by sengels:
reuse some stuff and make marblewidget faster
CCMAIL:caulier.gilles at gmail.com <CCMAIL%3Acaulier.gilles at gmail.com>
M +21 -8 MarbleModel.cpp
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.cpp #889198:889199
@@ -8,12 +8,14 @@
// Copyright 2006-2007 Torsten Rahn <tackat at kde.org>"
// Copyright 2007 Inge Wallin <ingwa at kde.org>"
// Copyright 2008 Jens-Michael Hoffmann <jensmh at gmx.de>
+// Copyright 2008 Patrick Spendrin <ps_ml at gmx.de>
//
#include "MarbleModel.h"
#include <cmath>
+#include <QtCore/QAtomicInt>
#include <QtCore/QDebug>
#include <QtCore/QTime>
#include <QtCore/QTimer>
@@ -79,20 +81,21 @@
void notifyModelChanged();
void geoDataDocumentLoaded( GeoDataDocument& document );
+ static QAtomicInt refCounter;
MarbleModel *m_parent;
MarbleDataFacade *m_dataFacade;
// View and paint stuff
GeoSceneDocument *m_mapTheme;
LayerManager *m_layerManager;
- TextureColorizer *m_texcolorizer;
+ static TextureColorizer *m_texcolorizer;
HttpDownloadManager *m_downloadManager;
TileLoader *m_tileLoader;
AbstractScanlineTextureMapper *m_texmapper;
- VectorComposer *m_veccomposer; // FIXME: Make not a pointer.
+ static VectorComposer *m_veccomposer; // FIXME: Make not a pointer.
GridMap *m_gridmap;
// Places on the map
@@ -118,10 +121,15 @@
FileViewModel *m_fileviewmodel;
};
+VectorComposer *MarbleModelPrivate::m_veccomposer = 0;
+TextureColorizer *MarbleModelPrivate::m_texcolorizer = 0;
+QAtomicInt MarbleModelPrivate::refCounter(0);
+
MarbleModel::MarbleModel( QObject *parent )
: QObject( parent ),
d( new MarbleModelPrivate( this ) )
{
+ MarbleModelPrivate::refCounter.ref();
d->m_dataFacade = new MarbleDataFacade( this );
d->m_layerManager = new LayerManager( d->m_dataFacade, this );
@@ -143,11 +151,13 @@
// this, SLOT( paintTile(TextureTile*, int, int,
int, GeoSceneTexture*, bool) ) );
d->m_texmapper = 0;
- d->m_veccomposer = new VectorComposer();
-
d->m_gridmap = new GridMap( this );
- d->m_texcolorizer = new TextureColorizer( MarbleDirs::path(
"seacolors.leg" ),
- MarbleDirs::path(
"landcolors.leg" ) );
+
+ if( MarbleModelPrivate::refCounter == 1 ) {
+ d->m_veccomposer = new VectorComposer();
+ d->m_texcolorizer = new TextureColorizer( MarbleDirs::path(
"seacolors.leg" ),
+ MarbleDirs::path(
"landcolors.leg" ) );
+ }
d->m_placemarkmanager = new PlaceMarkManager();
@@ -206,8 +216,11 @@
delete d->m_tileLoader; // disconnects from downloadManager in dtor
delete d->m_downloadManager;
- delete d->m_veccomposer;
- delete d->m_texcolorizer;
+ if( MarbleModelPrivate::refCounter == 1 ) {
+ delete d->m_veccomposer;
+ delete d->m_texcolorizer;
+ MarbleModelPrivate::refCounter.deref();
+ }
delete d->m_gridmap;
delete d->m_geometrymodel;
delete d->m_placemarkmodel;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/digikam-devel/attachments/20081126/d9f08ad2/attachment.html>
More information about the Digikam-devel
mailing list