diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2010-03-11 02:04:23 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2010-03-11 02:04:23 +0000 |
| commit | 2cee3802018c22a45f68c083e0c30281a373ce82 (patch) | |
| tree | 9bca1e40357c95e62b8da555d23aab276750504e /src | |
| parent | webslicer extension is distributable and translatable now (diff) | |
| download | inkscape-2cee3802018c22a45f68c083e0c30281a373ce82.tar.gz inkscape-2cee3802018c22a45f68c083e0c30281a373ce82.zip | |
Fix flicker during palette update.
(bzr r9174)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/swatches.cpp | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index caa2fb610..a142e619d 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -123,26 +123,32 @@ private: ColorItem::ColorItem(ege::PaintDef::ColorType type) : def(type), ptr(0), + tips(), + _previews(), _isFill(false), _isStroke(false), _isLive(false), _linkIsTone(false), _linkPercent(0), _linkGray(0), - _linkSrc(0) + _linkSrc(0), + _listeners() { } ColorItem::ColorItem( unsigned int r, unsigned int g, unsigned int b, Glib::ustring& name ) : def( r, g, b, name ), ptr(0), + tips(), + _previews(), _isFill(false), _isStroke(false), _isLive(false), _linkIsTone(false), _linkPercent(0), _linkGray(0), - _linkSrc(0) + _linkSrc(0), + _listeners() { } @@ -1504,7 +1510,35 @@ void SwatchesPanel::handleGradientsChange() void SwatchesPanel::handleDefsModified() { - handleGradientsChange(); +#if USE_DOCUMENT_PALETTE + if ( _ptr ) { + std::vector<ColorItem*> tmpColors; + std::map<ColorItem*, guchar*> tmpPrevs; + std::map<ColorItem*, SPGradient*> tmpGrads; + + recalSwatchContents(_currentDocument, tmpColors, tmpPrevs, tmpGrads, this); + + JustForNow *docPalette = reinterpret_cast<JustForNow *>(_ptr); + if (docPalette) { + int cap = std::min(docPalette->_colors.size(), tmpColors.size()); + for (int i = 0; i < cap; i++) { + ColorItem* newColor = tmpColors[i]; + ColorItem* oldColor = docPalette->_colors[i]; + if ( (newColor->def.getType() != oldColor->def.getType()) || + (newColor->def.getR() != oldColor->def.getR()) || + (newColor->def.getG() != oldColor->def.getG()) || + (newColor->def.getB() != oldColor->def.getB()) ) { + oldColor->def.setRGB(newColor->def.getR(), newColor->def.getG(), newColor->def.getB()); + } + } + } + + for (std::map<ColorItem*, guchar*>::iterator it = tmpPrevs.begin(); it != tmpPrevs.end(); ++it) + { + g_free(it->second); + } + } +#endif // USE_DOCUMENT_PALETTE } void SwatchesPanel::_updateFromSelection() |
