[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Re: Back
From:       "Casper Boemann" <cbr () boemann ! dk>
Date:       2004-07-26 13:34:34
Message-ID: 02ed01c47315$61015040$cdc19109 () IBMfk13045
[Download RAW message or body]

> KisPixelRepresentationMyColorStrategy : public  KisPixelRepresentation
> {
>
> KisChannelDouble channel1() { return  KisChannelDouble( (double*)
data ); };
> KisChannelDouble channel2() { return  KisChannelDouble( (double*) ( data +
> sizeof(double) ) ); };
> KisChannelDouble channel3() { return  KisChannelDouble( (double*) ( data +
> 2*sizeof(double) ) ); };
> KisChannelUChar channel4() { return  KisChannelUChar ( data + 3
> *sizeof(double) ); };
>
>
> private:
>  uchar* data;
>
> }

On the other hand - it is more or less exactly like the class I would use as
a helper class INSIDE the colorstrategy.

..If I could not convince you that *data  would require extra copies of
data:

a typical life of a pixelrep:
-------------
-the pixelrep is created. Call of constructor and copy of pointer into
*data;
- the pixelrep is returned from the iterator requireing a copy
constructor(possible optimized away by the compiler but don't count on it)
- the pixelrep is used. a double indirect access to the data:
pixelrep->data->value

With my proposal:
-----------
-the pointer to the pixel is returned from the iterator requireing a copy
- the pixelrep is used. a single indirect access to the data:
pixelrep->value


with my proposal the class would be like:

KisPixelRepresentationMyColorStrategy : public  KisPixelRepresentation
 {
 public:
 KisChannelDouble channel1;
KisChannelDouble channel2;
KisChannelDouble channel3;
KisChannelUChar channel4;
}

no need to make them private as only MyColorStrategy would be allowed to use
this class (could be defined in MyColorStrategy.cpp).

In fact, it is nothing more than a struct.

best regards
Casper

_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic