|
Krita Source Code Documentation
|
#include <kis_prescaled_projection.h>
Inheritance diagram for KisPrescaledProjection:Classes | |
| struct | Private |
Public Slots | |
| void | notifyCanvasSizeChanged (const QSize &widgetSize) |
| void | notifyCanvasStateChanged (const KisCanvasState &state) |
| void | preScale () |
| void | recalculateCache (KisUpdateInfoSP info) |
| void | setChannelFlags (const QBitArray &channelFlags) |
| void | setDisplayConfig (const KisDisplayConfig &config) |
| void | setDisplayFilter (QSharedPointer< KisDisplayFilter > displayFilter) |
| void | slotImageSizeChanged (qint32 w, qint32 h) |
| KisUpdateInfoSP | updateCache (const QRect &dirtyImageRect) |
| void | updateSettings () |
Public Member Functions | |
| KisPrescaledProjection () | |
| QImage | prescaledQImage () const |
| void | setCoordinatesConverter (KisCoordinatesConverter *coordinatesConverter) |
| void | setImage (KisImageWSP image) |
| ~KisPrescaledProjection () override | |
Public Member Functions inherited from KisShared | |
| bool | deref () |
| bool | ref () |
| int | refCount () |
| QAtomicInt * | sharedWeakReference () |
Private Member Functions | |
| void | drawUsingBackend (QPainter &gc, KisPPUpdateInfoSP info) |
| void | fillInUpdateInformation (const QRect &viewportRect, KisPPUpdateInfoSP info) |
| KisPPUpdateInfoSP | getInitialUpdateInformation (const QRect &dirtyImageRect) |
| KisPrescaledProjection (const KisPrescaledProjection &) | |
| KisPrescaledProjection | operator= (const KisPrescaledProjection &) |
| void | updateScaledImage (KisPPUpdateInfoSP info) |
| void | updateViewportSize () |
| void | viewportMoved (const QPointF &offset) |
Private Attributes | |
| Private *const | m_d |
Friends | |
| class | KisPrescaledProjectionTest |
Additional Inherited Members | |
Protected Member Functions inherited from KisShared | |
| KisShared () | |
| ~KisShared () | |
KisPrescaledProjection is responsible for keeping around a prescaled QImage representation that is always suitable for painting onto the canvas.
Note: the export macro is only for the unittest.
Definition at line 37 of file kis_prescaled_projection.h.
| KisPrescaledProjection::KisPrescaledProjection | ( | ) |
Definition at line 117 of file kis_prescaled_projection.cpp.
References connect(), KisConfigNotifier::instance(), m_d, KisPrescaledProjection::Private::projectionBackend, and updateSettings().
|
override |
Definition at line 130 of file kis_prescaled_projection.cpp.
References m_d, and KisPrescaledProjection::Private::projectionBackend.
|
private |
|
private |
Actual drawing is done here
| info | prepared information |
| gc | The painter we draw on |
Definition at line 426 of file kis_prescaled_projection.cpp.
References KisPPUpdateInfo::DIRECT, KisProjectionBackend::drawFromOriginalImage(), KisImagePatch::drawMe(), KisProjectionBackend::getNearestPatch(), m_d, KisImagePatch::preScale(), and KisPrescaledProjection::Private::projectionBackend.
|
private |
Prepare all the information about rects needed during projection updating.
| viewportRect | the part of the viewport that has to be updated |
| info | the structure to be filled in. It's member dirtyImageRect is supposed to have already been set up in the previous step of the update in getInitialUpdateInformation(). Though it is allowed to be null rect. |
To avoid artifacts while scaling we use mechanism like changeRect/needRect for layers. Here we grow the rect to update pixels which depend on the dirty rect (like changeRect), and later we request a bit more pixels for the patch to make the scaling safe (like needRect).
Definition at line 365 of file kis_prescaled_projection.cpp.
References KisProjectionBackend::alignSourceRect(), BORDER_SIZE, KisImage::bounds(), KisPrescaledProjection::Private::coordinatesConverter, dbgRender, KisPPUpdateInfo::DIRECT, KisPrescaledProjection::Private::image, KisCoordinatesConverter::imageScale(), KisCoordinatesConverter::imageToViewport(), m_d, KisPPUpdateInfo::PATCH, ppVar, KisPrescaledProjection::Private::projectionBackend, SCALE_LESS_THAN, SCALE_MORE_OR_EQUAL_TO, KisPrescaledProjection::Private::viewportSize, and KisCoordinatesConverter::viewportToImage().
|
private |
This creates an empty update information and fills it with the only parameter: dirtyImageRect This function is supposed to be run in the context of the image threads, so it does no accesses to zoom or any UI specific values. All the needed information for zooming will be fetched in the context of the UI thread in fillInUpdateInformation().
This update information has nothing more than an information about dirty image rect. All the other information used for scaling will be fetched in fillUpdateInformation() later, when we are working in the context of the UI thread
Definition at line 350 of file kis_prescaled_projection.cpp.
|
slot |
Checks whether it is needed to resize the prescaled image and updates it. The size is given in canvas widget pixels.
Definition at line 343 of file kis_prescaled_projection.cpp.
References KisPrescaledProjection::Private::canvasSize, m_d, preScale(), and updateViewportSize().
|
slot |
Definition at line 162 of file kis_prescaled_projection.cpp.
References KisPrescaledProjection::Private::currentRelevantCanvasState, m_d, preScale(), updateViewportSize(), and viewportMoved().
|
private |
|
slot |
Called whenever the zoom level changes or another chunk of the image becomes visible. The currently visible area of the image is complete scaled again.
Definition at line 286 of file kis_prescaled_projection.cpp.
References KisPrescaledProjection::Private::coordinatesConverter, drawUsingBackend(), fillInUpdateInformation(), getInitialUpdateInformation(), KisPrescaledProjection::Private::image, KisCoordinatesConverter::imageToViewport(), m_d, KisPrescaledProjection::Private::prescaledQImage, KritaUtils::splitRectIntoPatches(), KisPrescaledProjection::Private::updatePatchSize, KisPrescaledProjection::Private::viewportSize, and KisCoordinatesConverter::viewportToImage().
| QImage KisPrescaledProjection::prescaledQImage | ( | ) | const |
Return the prescaled QImage. The prescaled image is exactly as big as the canvas widget in pixels.
Definition at line 144 of file kis_prescaled_projection.cpp.
References m_d, and KisPrescaledProjection::Private::prescaledQImage.
|
slot |
Updates the prescaled cache at current zoom level
| info | update structure returned by updateCache |
Definition at line 269 of file kis_prescaled_projection.cpp.
References KisPrescaledProjection::Private::coordinatesConverter, KisSharedPtr< T >::data(), fillInUpdateInformation(), m_d, KisPrescaledProjection::Private::projectionBackend, KisProjectionBackend::recalculateCache(), and updateScaledImage().
|
slot |
Definition at line 315 of file kis_prescaled_projection.cpp.
References m_d, KisPrescaledProjection::Private::projectionBackend, and KisProjectionBackend::setChannelFlags().
| void KisPrescaledProjection::setCoordinatesConverter | ( | KisCoordinatesConverter * | coordinatesConverter | ) |
Definition at line 149 of file kis_prescaled_projection.cpp.
References KisPrescaledProjection::Private::coordinatesConverter, KisPrescaledProjection::Private::currentRelevantCanvasState, KisCanvasState::fromConverter(), and m_d.
|
slot |
Set the current monitor profile
Definition at line 310 of file kis_prescaled_projection.cpp.
References KisDisplayConfig::conversionFlags, KisDisplayConfig::intent, m_d, KisDisplayConfig::profile, KisPrescaledProjection::Private::projectionBackend, and KisProjectionBackend::setMonitorProfile().
|
slot |
Definition at line 320 of file kis_prescaled_projection.cpp.
References m_d, KisPrescaledProjection::Private::projectionBackend, and KisProjectionBackend::setDisplayFilter().
| void KisPrescaledProjection::setImage | ( | KisImageWSP | image | ) |
Definition at line 137 of file kis_prescaled_projection.cpp.
References KisPrescaledProjection::Private::image, m_d, KisPrescaledProjection::Private::projectionBackend, and KisProjectionBackend::setImage().
|
slot |
Called whenever the size of the KisImage changes. It is a part of a complex update ritual, when the size of the image changes. This method just resizes the storage for the image cache, it doesn't update any cached data.
Definition at line 240 of file kis_prescaled_projection.cpp.
References m_d, KisPrescaledProjection::Private::projectionBackend, KisProjectionBackend::setImageSize(), and updateViewportSize().
|
slot |
Retrieves image's data from KisImage object and updates internal cache
| dirtyImageRect | the rect changed on the image |
We needn't this stuff outside KisImage's area. We're not displaying anything painted outside the image anyway.
Definition at line 248 of file kis_prescaled_projection.cpp.
References KisImage::bounds(), dbgRender, getInitialUpdateInformation(), KisPrescaledProjection::Private::image, kisBacktrace(), m_d, KisPrescaledProjection::Private::projectionBackend, and KisProjectionBackend::updateCache().
|
private |
Initiates the process of prescaled image update
| info | prepared information |
Definition at line 419 of file kis_prescaled_projection.cpp.
References drawUsingBackend(), m_d, and KisPrescaledProjection::Private::prescaledQImage.
|
slot |
Called whenever the configuration settings change.
Definition at line 155 of file kis_prescaled_projection.cpp.
References m_d, KisImageConfig::updatePatchHeight(), KisPrescaledProjection::Private::updatePatchSize, and KisImageConfig::updatePatchWidth().
|
private |
Definition at line 326 of file kis_prescaled_projection.cpp.
References KisPrescaledProjection::Private::canvasSize, KisPrescaledProjection::Private::coordinatesConverter, KisCoordinatesConverter::imageRectInWidgetPixels(), m_d, KisPrescaledProjection::Private::prescaledQImage, KisPrescaledProjection::Private::viewportSize, and KisCoordinatesConverter::widgetToViewport().
|
private |
Called whenever the view widget needs to show a different part of the document
We can't optimize anything when offset is float :( Just prescale entire image.
TODO: viewport rects should be cropped by the borders of the image, because it may be requested to read/write outside QImage and copyQImage will not catch it
Definition at line 181 of file kis_prescaled_projection.cpp.
References KisPrescaledProjection::Private::coordinatesConverter, copyQImage(), dbgRender, drawUsingBackend(), fillInUpdateInformation(), getInitialUpdateInformation(), KisCoordinatesConverter::imageToViewport(), m_d, preScale(), KisPrescaledProjection::Private::prescaledQImage, KritaUtils::splitRectIntoPatches(), KisPrescaledProjection::Private::updatePatchSize, KisPrescaledProjection::Private::viewportSize, and KisCoordinatesConverter::viewportToImage().
|
friend |
Definition at line 111 of file kis_prescaled_projection.h.
|
private |
Definition at line 166 of file kis_prescaled_projection.h.