bring the fastrenderer back again...

hihihi
This commit is contained in:
Jan Schuffenhauer
2020-01-09 10:35:01 +01:00
parent 72b235689e
commit 67b623a63a
7 changed files with 119 additions and 31 deletions

View File

@@ -3,9 +3,10 @@
#include <QRect>
#include <QDebug>
IntelliRasterImage::IntelliRasterImage(int weight, int height)
: IntelliImage(weight, height){
IntelliRasterImage::IntelliRasterImage(int width, int height, bool fastRendererOn)
: IntelliImage(width, height, fastRendererOn){
TypeOfImage = IntelliImage::ImageType::Raster_Image;
this->fastRenderer = fastRendererOn;
}
IntelliRasterImage::~IntelliRasterImage(){
@@ -13,7 +14,7 @@ IntelliRasterImage::~IntelliRasterImage(){
}
IntelliImage* IntelliRasterImage::getDeepCopy(){
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height());
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), false);
raster->imageData.fill(Qt::transparent);
raster->TypeOfImage = IntelliImage::ImageType::Raster_Image;
return raster;
@@ -29,6 +30,9 @@ QImage IntelliRasterImage::getDisplayable(int alpha){
QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
QImage copy = imageData;
if(fastRenderer){
copy = copy.convertToFormat(QImage::Format_ARGB32);
}
for(int y = 0; y<copy.height(); y++) {
for(int x = 0; x<copy.width(); x++) {
QColor clr = copy.pixelColor(x,y);
@@ -36,6 +40,9 @@ QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
copy.setPixelColor(x,y, clr);
}
}
if(fastRenderer){
copy = copy.convertToFormat(QImage::Format_Indexed8);
}
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
}