[W.I.P.] Added a FasterRenderOption

Still completly buggy. and it crashes imediatly after input
This commit is contained in:
Jan Schuffenhauer
2020-01-08 19:01:05 +01:00
parent dd55a7158d
commit c04d8d6815
12 changed files with 131 additions and 22 deletions

View File

@@ -4,9 +4,10 @@
#include <QRect>
#include <QDebug>
IntelliShapedImage::IntelliShapedImage(int weight, int height)
: IntelliRasterImage(weight, height){
IntelliShapedImage::IntelliShapedImage(int width, int height, bool fastRendererOn)
: IntelliRasterImage(width, height, fastRendererOn){
TypeOfImage = IntelliImage::ImageType::Shaped_Image;
this->fastRenderer = fastRendererOn;
}
IntelliShapedImage::~IntelliShapedImage(){
@@ -18,7 +19,7 @@ QImage IntelliShapedImage::getDisplayable(int alpha){
}
IntelliImage* IntelliShapedImage::getDeepCopy(){
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height());
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), false);
shaped->setPolygon(this->polygonData);
shaped->imageData.fill(Qt::transparent);
shaped->TypeOfImage = IntelliImage::ImageType::Shaped_Image;
@@ -26,7 +27,11 @@ IntelliImage* IntelliShapedImage::getDeepCopy(){
}
void IntelliShapedImage::calculateVisiblity(){
if(polygonData.size()<=2) {
if(fastRenderer){
this->imageData = imageData.convertToFormat(QImage::Format_ARGB32);
}
if(polygonData.size()<=2) {
QColor clr;
for(int y=0; y<imageData.height(); y++) {
for(int x=0; x<imageData.width(); x++) {
@@ -35,6 +40,9 @@ void IntelliShapedImage::calculateVisiblity(){
imageData.setPixelColor(x,y,clr);
}
}
if(fastRenderer){
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
}
return;
}
QColor clr;
@@ -51,10 +59,16 @@ void IntelliShapedImage::calculateVisiblity(){
imageData.setPixelColor(x,y,clr);
}
}
if(fastRenderer){
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
}
}
QImage IntelliShapedImage::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);
@@ -62,6 +76,9 @@ QImage IntelliShapedImage::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);
}