Mipmapping for canvas. Ideas and comments.

Dmitry Kazakov dimula73 at gmail.com
Thu Jul 23 16:47:23 CEST 2009

>> > In such a case, color conversion will be done after mipmapping and for
>> > every zoomlevel seperately?
>> yes when creating the prescaledprojection you would also do the color
>> conversion.
> There are two sides: only color correcting the scaled pixels will be a lot
> cheaper, but I'm not sure whether that will give visible artefacts.

Hmm... I thought just the opposite: in case you delay color
conversion, you'll have to color-convert every time you change
zoom-level, but in case you do it during updating original image,
you'll do it only once.

Maybe you are right with delaying it... Color conversion shouldn't
depend on the scale much - it's almost linear operation...

> In any case, I'm not officially getting confused myself about mipmapping the
> projection... I'm fine with either doing it in krita/image and using KisPaintDevice,
> or doing it in krita/ui/canvas, and using QImage-based tiles (like the opengl
> canvas does already).

I don't think we should move it to krita/image, as opengl canvas seems
not to depend on our internal prescaling. It seems to have it's own
mipmapping, downsampling and more than that it does it with the help
of gpu. ( Lukas, am i right? )

At the moment, i think the best way would be the following:

1) Pyramid replaces current KisProjectionCache.  And
KisPrescaledProjection requests it for all scale operations.
2) Pyramid uses quite modificated "paint device" based on tiled data
manager class.

class "KisSimplifiedPaintDevice" {
     KisDataManager m_dataManager;

     void loadFromUsualPaintDevice(KisPaintDeviceSP sourcePaintDevice,
QRect rect);

     QImage converToQImage(QRect rect);

     // Here is the difference from usual paint device
    KisSimplifiedPaintDeviceSP getDowsampledByFactor2();
    void setMonitorProfile(KoColorProfile*);

What is the difference from regular paint device and why should we
create new class?
i) We leave a path for future experiments: should we color convert
before or after downsampling. We can choose inside the class where to
do it.
ii) Downsampling is moved to lower level.

What do you think?

Dmitry Kazakov

More information about the kimageshop mailing list