mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Fix build on windows
This commit is contained in:
@ -1,13 +1,22 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <math.h>
|
||||||
#include "../../../graphics/AggPlusEnums.h"
|
#include "../../../graphics/AggPlusEnums.h"
|
||||||
#ifndef M_1_PI
|
#ifndef M_1_PI
|
||||||
#define M_1_PI 0.318309886183790671538
|
#define M_1_PI 0.318309886183790671538
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NAN_FLOAT
|
#ifndef NAN_FLOAT
|
||||||
|
#ifdef NAN
|
||||||
|
#define NAN_FLOAT NAN
|
||||||
|
#else
|
||||||
#define NAN_FLOAT 0.0f/0.0f
|
#define NAN_FLOAT 0.0f/0.0f
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define isnanf _isnanf
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef SHADING_PDF
|
#ifndef SHADING_PDF
|
||||||
#define SHADING_PDF
|
#define SHADING_PDF
|
||||||
|
|||||||
@ -67,7 +67,7 @@ namespace NSStructures
|
|||||||
{
|
{
|
||||||
for (int j = 0; j < RESOLUTION; j++)
|
for (int j = 0; j < RESOLUTION; j++)
|
||||||
{
|
{
|
||||||
uint value = 255 * sin(i * j * M_PI / RESOLUTION);
|
unsigned int value = 255 * sin(i * j * M_PI / RESOLUTION);
|
||||||
values[j][i] = ColorT(value, value, 0);
|
values[j][i] = ColorT(value, value, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ namespace NSStructures
|
|||||||
return values[yi][xi];
|
return values[yi][xi];
|
||||||
}
|
}
|
||||||
|
|
||||||
int set_color(float x, int r, int g, int b, int a)
|
void set_color(float x, int r, int g, int b, int a)
|
||||||
{
|
{
|
||||||
int index = get_x_index(x); // pls dont set color out of bounds, it wont crush, but will work not as you max expected
|
int index = get_x_index(x); // pls dont set color out of bounds, it wont crush, but will work not as you max expected
|
||||||
values[0][index].r = r;
|
values[0][index].r = r;
|
||||||
@ -112,7 +112,7 @@ namespace NSStructures
|
|||||||
values[0][index].b = b;
|
values[0][index].b = b;
|
||||||
values[0][index].a = a;
|
values[0][index].a = a;
|
||||||
}
|
}
|
||||||
int set_color(float x, float y, int r, int g, int b, int a)
|
void set_color(float x, float y, int r, int g, int b, int a)
|
||||||
{
|
{
|
||||||
int xindex = get_x_index(x);
|
int xindex = get_x_index(x);
|
||||||
int yindex = get_y_index(y);
|
int yindex = get_y_index(y);
|
||||||
@ -121,14 +121,14 @@ namespace NSStructures
|
|||||||
values[yindex][xindex].b = b;
|
values[yindex][xindex].b = b;
|
||||||
values[yindex][xindex].a = a;
|
values[yindex][xindex].a = a;
|
||||||
}
|
}
|
||||||
int set_color(size_t xindex, int r, int g, int b, int a)
|
void set_color(size_t xindex, int r, int g, int b, int a)
|
||||||
{
|
{
|
||||||
values[0][xindex].r = r;
|
values[0][xindex].r = r;
|
||||||
values[0][xindex].g = g;
|
values[0][xindex].g = g;
|
||||||
values[0][xindex].b = b;
|
values[0][xindex].b = b;
|
||||||
values[0][xindex].a = a;
|
values[0][xindex].a = a;
|
||||||
}
|
}
|
||||||
int set_color(size_t xindex, size_t yindex, int r, int g, int b, int a)
|
void set_color(size_t xindex, size_t yindex, int r, int g, int b, int a)
|
||||||
{
|
{
|
||||||
values[yindex][xindex].r = r;
|
values[yindex][xindex].r = r;
|
||||||
values[yindex][xindex].g = g;
|
values[yindex][xindex].g = g;
|
||||||
@ -204,7 +204,7 @@ namespace NSStructures
|
|||||||
size_t len = second - first;
|
size_t len = second - first;
|
||||||
ColorT f = values[line][first];
|
ColorT f = values[line][first];
|
||||||
ColorT s = values[line][second];
|
ColorT s = values[line][second];
|
||||||
for(int i = first + 1; i < second; i++) {
|
for(size_t i = first + 1; i < second; i++) {
|
||||||
values[line][i].r = f.r * (1 - (float)(i - first) / len ) + s.r * ((float)(i - first) / len );
|
values[line][i].r = f.r * (1 - (float)(i - first) / len ) + s.r * ((float)(i - first) / len );
|
||||||
values[line][i].g = f.g * (1 - (float)(i - first) / len ) + s.g * ((float)(i - first) / len ); ;
|
values[line][i].g = f.g * (1 - (float)(i - first) / len ) + s.g * ((float)(i - first) / len ); ;
|
||||||
values[line][i].b = f.b * (1 - (float)(i - first) / len ) + s.b * ((float)(i - first) / len ); ;
|
values[line][i].b = f.b * (1 - (float)(i - first) / len ) + s.b * ((float)(i - first) / len ); ;
|
||||||
@ -236,7 +236,9 @@ namespace NSStructures
|
|||||||
struct Point
|
struct Point
|
||||||
{
|
{
|
||||||
Point():x(0),y(0){}
|
Point():x(0),y(0){}
|
||||||
Point(float _x, float _y):x(_x),y(_y){}
|
Point(const float& _x, const float& _y):x(_x),y(_y){}
|
||||||
|
Point(const int& _x, const int& _y):x((int)_x),y((int)_y){}
|
||||||
|
Point(const double& _x, const double& _y):x((float)_x),y((float)_y){}
|
||||||
float x, y;
|
float x, y;
|
||||||
|
|
||||||
Point& operator+=(const Point &a)
|
Point& operator+=(const Point &a)
|
||||||
|
|||||||
@ -3971,7 +3971,7 @@ namespace PdfReader
|
|||||||
for (int j = 0; j < 2; j++)
|
for (int j = 0; j < 2; j++)
|
||||||
{
|
{
|
||||||
DWORD dcolor = ColorSpace.GetDwordColor(&patch->arrColor[i][j]);
|
DWORD dcolor = ColorSpace.GetDwordColor(&patch->arrColor[i][j]);
|
||||||
colors[j][i] = {dcolor % 0x100, (dcolor >> 8) % 0x100, (dcolor >> 16) % 0x100, alpha};
|
colors[j][i] = {(unsigned)(dcolor & 0xFF), (unsigned)((dcolor >> 8) & 0xFF), (unsigned)((dcolor >> 16) & 0xFF), (unsigned)alpha};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto info = NSStructures::GInfoConstructor::get_tensor_curve(points,
|
auto info = NSStructures::GInfoConstructor::get_tensor_curve(points,
|
||||||
@ -4102,7 +4102,7 @@ namespace PdfReader
|
|||||||
{
|
{
|
||||||
GrColor c = *colors[i];
|
GrColor c = *colors[i];
|
||||||
DWORD dword_color = ColorSpace.GetDwordColor(&c);
|
DWORD dword_color = ColorSpace.GetDwordColor(&c);
|
||||||
rgba8_colors.push_back({dword_color % 0x100, (dword_color >> 8) % 0x100, (dword_color >> 16) % 0x100, alpha});
|
rgba8_colors.push_back({dword_color % 0x100, (dword_color >> 8) % 0x100, (dword_color >> 16) % 0x100, (unsigned)alpha});
|
||||||
double x = point[i].x;
|
double x = point[i].x;
|
||||||
double y = point[i].y;
|
double y = point[i].y;
|
||||||
TransformToPixels(pGState, x, y);
|
TransformToPixels(pGState, x, y);
|
||||||
@ -4121,4 +4121,4 @@ namespace PdfReader
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,7 +169,7 @@ void MainWindow::on_GradientType_itemClicked(QListWidgetItem *item)
|
|||||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||||
info.triangle,
|
info.triangle,
|
||||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||||
{0, 0.4, 1}, true
|
{0.f, 0.4f, 1.f}, true
|
||||||
);
|
);
|
||||||
points = {};
|
points = {};
|
||||||
for (auto p : info.triangle)
|
for (auto p : info.triangle)
|
||||||
@ -422,7 +422,7 @@ void MainWindow::on_TrianglePoint1X_sliderMoved(int position)
|
|||||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||||
info.triangle,
|
info.triangle,
|
||||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||||
{0, 0.4, 1}, true
|
{0.f, 0.4f, 1.f}, true
|
||||||
);
|
);
|
||||||
points = {};
|
points = {};
|
||||||
for (auto p : info.triangle)
|
for (auto p : info.triangle)
|
||||||
@ -458,7 +458,7 @@ void MainWindow::on_TrianglePoint1Y_sliderMoved(int position)
|
|||||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||||
info.triangle,
|
info.triangle,
|
||||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||||
{0, 0.4, 1}, true
|
{0.f, 0.4f, 1.f}, true
|
||||||
);
|
);
|
||||||
points = {};
|
points = {};
|
||||||
for (auto p : info.triangle)
|
for (auto p : info.triangle)
|
||||||
@ -494,7 +494,7 @@ void MainWindow::on_TrianglePoint2X_sliderMoved(int position)
|
|||||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||||
info.triangle,
|
info.triangle,
|
||||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||||
{0, 0.4, 1}, true
|
{0.f, 0.4f, 1.f}, true
|
||||||
);
|
);
|
||||||
points = {};
|
points = {};
|
||||||
for (auto p : info.triangle)
|
for (auto p : info.triangle)
|
||||||
@ -530,7 +530,7 @@ void MainWindow::on_TrianglePoint2Y_sliderMoved(int position)
|
|||||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||||
info.triangle,
|
info.triangle,
|
||||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||||
{0, 0.4, 1}, true
|
{0.f, 0.4f, 1.f}, true
|
||||||
);
|
);
|
||||||
points = {};
|
points = {};
|
||||||
for (auto p : info.triangle)
|
for (auto p : info.triangle)
|
||||||
@ -566,7 +566,7 @@ void MainWindow::on_TrianglePoint3X_sliderMoved(int position)
|
|||||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||||
info.triangle,
|
info.triangle,
|
||||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||||
{0, 0.4, 1}, true
|
{0.f, 0.4f, 1.f}, true
|
||||||
);
|
);
|
||||||
points = {};
|
points = {};
|
||||||
for (auto p : info.triangle)
|
for (auto p : info.triangle)
|
||||||
@ -602,7 +602,7 @@ void MainWindow::on_TrianglePoint3Y_sliderMoved(int position)
|
|||||||
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
info.ginfo = NSStructures::GInfoConstructor::get_triangle(
|
||||||
info.triangle,
|
info.triangle,
|
||||||
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
{{255, 0, 0}, {0, 255, 0}, {0, 0, 255}},
|
||||||
{0, 0.4, 1}, true
|
{0.f, 0.4f, 1.f}, true
|
||||||
);
|
);
|
||||||
points = {};
|
points = {};
|
||||||
for (auto p : info.triangle)
|
for (auto p : info.triangle)
|
||||||
|
|||||||
Reference in New Issue
Block a user