Color, Vector3 and CanvasFragment are now PODs
This can speed up CanvasPortion initialization
This commit is contained in:
parent
8d33a11dc5
commit
3c351bbe5c
9 changed files with 5 additions and 18 deletions
|
@ -9,7 +9,7 @@ namespace basics {
|
||||||
class BASICSSHARED_EXPORT Color
|
class BASICSSHARED_EXPORT Color
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Color();
|
Color() = default;
|
||||||
Color(const Color &col);
|
Color(const Color &col);
|
||||||
Color(double r, double g, double b, double a=1.0);
|
Color(double r, double g, double b, double a=1.0);
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,6 @@
|
||||||
# define METHSPEC
|
# define METHSPEC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
METHSPEC Color::Color():
|
|
||||||
r(0.0), g(0.0), b(0.0), a(0.0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
METHSPEC Color::Color(double r, double g, double b, double a):
|
METHSPEC Color::Color(double r, double g, double b, double a):
|
||||||
r(r), g(g), b(b), a(a)
|
r(r), g(g), b(b), a(a)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,7 @@ typedef struct
|
||||||
class BASICSSHARED_EXPORT Vector3
|
class BASICSSHARED_EXPORT Vector3
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Vector3();
|
Vector3() = default;
|
||||||
Vector3(double x, double y, double z);
|
Vector3(double x, double y, double z);
|
||||||
Vector3(const VectorSpherical &v);
|
Vector3(const VectorSpherical &v);
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,6 @@ METHSPEC Vector3::Vector3(double x, double y, double z):
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
METHSPEC Vector3::Vector3()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
METHSPEC Vector3 Vector3::add(double x, double y, double z) const
|
METHSPEC Vector3 Vector3::add(double x, double y, double z) const
|
||||||
{
|
{
|
||||||
return Vector3(this->x + x, this->y + y, this->z + z);
|
return Vector3(this->x + x, this->y + y, this->z + z);
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
#include "CanvasFragment.h"
|
#include "CanvasFragment.h"
|
||||||
|
|
||||||
CanvasFragment::CanvasFragment()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CanvasFragment::CanvasFragment(double z, const Vector3 &location, int client, bool opaque):
|
CanvasFragment::CanvasFragment(double z, const Vector3 &location, int client, bool opaque):
|
||||||
opaque(opaque), z(z), location(location), client(client)
|
opaque(opaque), z(z), location(location), client(client)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace software {
|
||||||
class SOFTWARESHARED_EXPORT CanvasFragment
|
class SOFTWARESHARED_EXPORT CanvasFragment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CanvasFragment();
|
CanvasFragment() = default;
|
||||||
CanvasFragment(double z, const Vector3 &location, int client=0, bool opaque=true);
|
CanvasFragment(double z, const Vector3 &location, int client=0, bool opaque=true);
|
||||||
|
|
||||||
void setColor(const Color &col);
|
void setColor(const Color &col);
|
||||||
|
|
|
@ -23,6 +23,7 @@ const CanvasFragment *CanvasPixel::getFrontFragment() const
|
||||||
void CanvasPixel::reset()
|
void CanvasPixel::reset()
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
|
composite = COLOR_BLACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasPixel::pushFragment(const CanvasFragment &fragment)
|
void CanvasPixel::pushFragment(const CanvasFragment &fragment)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "CanvasFragment.h"
|
#include "CanvasFragment.h"
|
||||||
|
|
||||||
const int MAX_FRAGMENT_COUNT = 7;
|
const int MAX_FRAGMENT_COUNT = 2;
|
||||||
|
|
||||||
namespace paysages {
|
namespace paysages {
|
||||||
namespace software {
|
namespace software {
|
||||||
|
|
|
@ -69,7 +69,6 @@ void CanvasPortion::preparePixels()
|
||||||
delete[] pixels;
|
delete[] pixels;
|
||||||
}
|
}
|
||||||
pixels = new CanvasPixel[width * height];
|
pixels = new CanvasPixel[width * height];
|
||||||
clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasPortion::discardPixels(bool save)
|
void CanvasPortion::discardPixels(bool save)
|
||||||
|
|
Loading…
Reference in a new issue