Merge branch 'dev-warnings' into 'dev'

fixed warnings

See merge request creyd/intelliphoto!24
This commit is contained in:
Mienek
2019-12-20 09:06:23 +00:00
7 changed files with 32 additions and 32 deletions

View File

@@ -19,7 +19,7 @@ std::vector<Triangle> IntelliHelper::calculateTriangles(std::vector<QPoint> poly
QPoint BP(point.x()-post.x(), point.y()-post.y());
float topSclar = AP.x()*BP.x()+AP.y()*BP.y();
float absolute = sqrt(pow(AP.x(),2.)+pow(AP.y(),2.))*sqrt(pow(BP.x(),2.)+pow(BP.y(),2.));
float absolute = static_cast<float>(sqrt(pow(AP.x(),2.)+pow(AP.y(),2.))*sqrt(pow(BP.x(),2.)+pow(BP.y(),2.)));
return acos(topSclar/absolute);
};

View File

@@ -212,11 +212,11 @@ void PaintingArea::createFloodFillTool(){
}
int PaintingArea::getWidthOfActive(){
return this->layerBundle[activeLayer].width;
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].width;
}
int PaintingArea::getHeightOfActive(){
return this->layerBundle[activeLayer].height;
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].height;
}
// If a mouse button is pressed check if it was the
@@ -225,8 +225,8 @@ int PaintingArea::getHeightOfActive(){
void PaintingArea::mousePressEvent(QMouseEvent*event){
if(Tool == nullptr)
return;
int x = event->x()-layerBundle[activeLayer].widthOffset;
int y = event->y()-layerBundle[activeLayer].heightOffset;
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
int y = event->y()-layerBundle[static_cast<unsigned long long>(activeLayer)].heightOffset;
if(event->button() == Qt::LeftButton) {
Tool->onMouseLeftPressed(x, y);
}else if(event->button() == Qt::RightButton) {
@@ -241,8 +241,8 @@ void PaintingArea::mousePressEvent(QMouseEvent*event){
void PaintingArea::mouseMoveEvent(QMouseEvent*event){
if(Tool == nullptr)
return;
int x = event->x()-layerBundle[activeLayer].widthOffset;
int y = event->y()-layerBundle[activeLayer].heightOffset;
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
int y = event->y()-layerBundle[static_cast<unsigned long long>(activeLayer)].heightOffset;
Tool->onMouseMoved(x, y);
update();
}
@@ -251,8 +251,8 @@ void PaintingArea::mouseMoveEvent(QMouseEvent*event){
void PaintingArea::mouseReleaseEvent(QMouseEvent*event){
if(Tool == nullptr)
return;
int x = event->x()-layerBundle[activeLayer].widthOffset;
int y = event->y()-layerBundle[activeLayer].heightOffset;
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
int y = event->y()-layerBundle[static_cast<unsigned long long>(activeLayer)].heightOffset;
if(event->button() == Qt::LeftButton) {
Tool->onMouseLeftReleased(x, y);
}else if(event->button() == Qt::RightButton) {
@@ -293,15 +293,15 @@ void PaintingArea::resizeImage(QImage*image_res, const QSize &newSize){
}
void PaintingArea::activateUpperLayer(){
if(activeLayer!=-1 && activeLayer<layerBundle.size()-1) {
std::swap(layerBundle[activeLayer], layerBundle[activeLayer+1]);
if(activeLayer!=-1 && static_cast<unsigned long long>(activeLayer)<layerBundle.size()-1) {
std::swap(layerBundle[static_cast<unsigned long long>(activeLayer)], layerBundle[static_cast<unsigned long long>(activeLayer+1)]);
activeLayer++;
}
}
void PaintingArea::activateLowerLayer(){
if(activeLayer!=-1 && activeLayer>0) {
std::swap(layerBundle[activeLayer], layerBundle[activeLayer-1]);
std::swap(layerBundle[static_cast<unsigned long long>(activeLayer)], layerBundle[static_cast<unsigned long long>(activeLayer-1)]);
activeLayer--;
}
}
@@ -345,11 +345,11 @@ void PaintingArea::createTempLayerAfter(int idx){
if(idx>=0) {
LayerObject newLayer;
newLayer.alpha = 255;
newLayer.height = layerBundle[idx].height;
newLayer.width = layerBundle[idx].width;
newLayer.heightOffset = layerBundle[idx].heightOffset;
newLayer.widthOffset = layerBundle[idx].widthOffset;
newLayer.image = layerBundle[idx].image->getDeepCopy();
newLayer.height = layerBundle[static_cast<unsigned long long>(idx)].height;
newLayer.width = layerBundle[static_cast<unsigned long long>(idx)].width;
newLayer.heightOffset = layerBundle[static_cast<unsigned long long>(idx)].heightOffset;
newLayer.widthOffset = layerBundle[static_cast<unsigned long long>(idx)].widthOffset;
newLayer.image = layerBundle[static_cast<unsigned long long>(idx)].image->getDeepCopy();
layerBundle.insert(layerBundle.begin()+idx+1,newLayer);
}
}

View File

@@ -49,8 +49,8 @@ void IntelliTool::onWheelScrolled(int value){
void IntelliTool::createToolLayer(){
Area->createTempLayerAfter(Area->activeLayer);
this->Active=&Area->layerBundle[Area->activeLayer];
this->Canvas=&Area->layerBundle[Area->activeLayer+1];
this->Active=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer)];
this->Canvas=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer+1)];
}
void IntelliTool::mergeToolLayer(){

View File

@@ -4,7 +4,7 @@
#include "IntelliHelper/IntelliColorPicker.h"
#include <vector>
class LayerObject;
struct LayerObject;
class PaintingArea;
/*!

View File

@@ -22,18 +22,18 @@ void IntelliToolCircle::drawCyrcle(int radius){
yMax = Middle.y()+radius;
// x = x0+-sqrt(r2-(y-y0)2)
for(int i=yMin; i<=yMax; i++) {
xMin = Middle.x()-sqrt(pow(radius,2)-pow(i-Middle.y(),2));
xMax = Middle.x()+sqrt(pow(radius,2)-pow(i-Middle.y(),2));
xMin = static_cast<int>(Middle.x()-sqrt(pow(radius,2)-pow(i-Middle.y(),2)));
xMax = static_cast<int>(Middle.x()+sqrt(pow(radius,2)-pow(i-Middle.y(),2)));
this->Canvas->image->drawLine(QPoint(xMin,i), QPoint(xMax,i),inner,1);
}
//TODO implement circle drawing algorithm bresenham
radius = radius +(this->edgeWidth/2.)-1.;
radius = static_cast<int>(radius +(this->edgeWidth/2.)-1.);
yMin = (Middle.y()-radius);
yMax = (Middle.y()+radius);
for(int i=yMin; i<=yMax; i++) {
xMin = Middle.x()-sqrt(pow(radius,2)-pow(i-Middle.y(),2));
xMax = Middle.x()+sqrt(pow(radius,2)-pow(i-Middle.y(),2));
xMin = static_cast<int>(Middle.x()-sqrt(pow(radius,2)-pow(i-Middle.y(),2)));
xMax = static_cast<int>(Middle.x()+sqrt(pow(radius,2)-pow(i-Middle.y(),2)));
this->Canvas->image->drawPoint(QPoint(xMin,i), colorPicker->getFirstColor(),edgeWidth);
this->Canvas->image->drawPoint(QPoint(xMax,i), colorPicker->getFirstColor(),edgeWidth);
}
@@ -41,8 +41,8 @@ void IntelliToolCircle::drawCyrcle(int radius){
xMin = (Middle.x()-radius);
xMax = (Middle.x()+radius);
for(int i=xMin; i<=xMax; i++) {
int yMin = Middle.y()-sqrt(pow(radius,2)-pow(i-Middle.x(),2));
int yMax = Middle.y()+sqrt(pow(radius,2)-pow(i-Middle.x(),2));
int yMin = static_cast<int>(Middle.y()-sqrt(pow(radius,2)-pow(i-Middle.x(),2)));
int yMax = static_cast<int>(Middle.y()+sqrt(pow(radius,2)-pow(i-Middle.x(),2)));
this->Canvas->image->drawPoint(QPoint(i, yMin), colorPicker->getFirstColor(),edgeWidth);
this->Canvas->image->drawPoint(QPoint(i, yMax), colorPicker->getFirstColor(),edgeWidth);
}

View File

@@ -52,7 +52,7 @@ void IntelliToolLine::onMouseMoved(int x, int y){
case LineStyle::DOTTED_LINE:
QPoint p1 =start.x() <= next.x() ? start : next;
QPoint p2 =start.x() < next.x() ? next : start;
int m = (float)(p2.y()-p1.y())/(float)(p2.x()-p1.x())+0.5f;
int m = static_cast<int>((p2.y()-p1.y())/(p2.x()-p1.x())+0.5f);
int c = start.y()-start.x()*m;
break;

View File

@@ -7,7 +7,7 @@
IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker)
: IntelliTool(Area, colorPicker){
this->alphaInner = QInputDialog::getInt(nullptr,"Inner Alpha Value", "Value:", 0,0,255,1);
lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);;
lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);
PointIsNearStart = false;
isDrawing = false;
}
@@ -63,9 +63,9 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){
}
}
}
for(int i=0; i<QPointList.size(); i++) {
int next = (i+1)%QPointList.size();
this->Canvas->image->drawLine(QPointList[i], QPointList[next], colorPicker->getFirstColor(), lineWidth);
for(int i=0; i<static_cast<int>(QPointList.size()); i++) {
int next = static_cast<int>((i+static_cast<int>(1))%static_cast<int>(QPointList.size()));
this->Canvas->image->drawLine(QPointList[static_cast<unsigned long long>(i)], QPointList[static_cast<unsigned long long>(next)], colorPicker->getFirstColor(), lineWidth);
}
QPointList.clear();
IntelliTool::onMouseLeftReleased(x,y);