mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-01 01:20:25 +00:00
Use fixmath lib in point shapes
This commit is contained in:
parent
3e7f54f289
commit
21e700da4f
@ -22,8 +22,19 @@ if(MSVC)
|
|||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
# Libraries in this directory
|
# Libraries in this directory
|
||||||
set(aseprite_libraries app-lib css-lib doc-lib raster-lib
|
set(aseprite_libraries
|
||||||
scripting-lib undo-lib filters-lib ui-lib she gfx-lib base-lib)
|
app-lib
|
||||||
|
fixmath-lib
|
||||||
|
css-lib
|
||||||
|
doc-lib
|
||||||
|
raster-lib
|
||||||
|
scripting-lib
|
||||||
|
undo-lib
|
||||||
|
filters-lib
|
||||||
|
ui-lib
|
||||||
|
she
|
||||||
|
gfx-lib
|
||||||
|
base-lib)
|
||||||
|
|
||||||
# Directories where .h files can be found
|
# Directories where .h files can be found
|
||||||
include_directories(. .. ../third_party)
|
include_directories(. .. ../third_party)
|
||||||
|
@ -132,24 +132,24 @@ public:
|
|||||||
|
|
||||||
// In Windows, rand() has a RAND_MAX too small
|
// In Windows, rand() has a RAND_MAX too small
|
||||||
#if RAND_MAX <= 0xffff
|
#if RAND_MAX <= 0xffff
|
||||||
fixed angle, radius;
|
fixmath::fixed angle, radius;
|
||||||
|
|
||||||
for (c=0; c<times; c++) {
|
for (c=0; c<times; c++) {
|
||||||
angle = itofix(rand() * 256 / RAND_MAX);
|
angle = fixmath::itofix(rand() * 256 / RAND_MAX);
|
||||||
radius = itofix(rand() * (spray_width*10) / RAND_MAX) / 10;
|
radius = fixmath::itofix(rand() * (spray_width*10) / RAND_MAX) / 10;
|
||||||
u = fixtoi(fixmul(radius, fixcos(angle)));
|
u = fixmath::fixtoi(fixmath::fixmul(radius, fixmath::fixcos(angle)));
|
||||||
v = fixtoi(fixmul(radius, fixsin(angle)));
|
v = fixmath::fixtoi(fixmath::fixmul(radius, fixmath::fixsin(angle)));
|
||||||
|
|
||||||
m_subPointShape.transformPoint(loop, x+u, y+v);
|
m_subPointShape.transformPoint(loop, x+u, y+v);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fixed angle, radius;
|
fixmath::fixed angle, radius;
|
||||||
|
|
||||||
for (c=0; c<times; c++) {
|
for (c=0; c<times; c++) {
|
||||||
angle = rand();
|
angle = rand();
|
||||||
radius = rand() % itofix(spray_width);
|
radius = rand() % fixmath::itofix(spray_width);
|
||||||
u = fixtoi(fixmul(radius, fixcos(angle)));
|
u = fixmath::fixtoi(fixmath::fixmul(radius, fixmath::fixcos(angle)));
|
||||||
v = fixtoi(fixmul(radius, fixsin(angle)));
|
v = fixmath::fixtoi(fixmath::fixmul(radius, fixmath::fixsin(angle)));
|
||||||
m_subPointShape.transformPoint(loop, x+u, y+v);
|
m_subPointShape.transformPoint(loop, x+u, y+v);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,15 +30,13 @@
|
|||||||
#include "app/tools/tool_group.h"
|
#include "app/tools/tool_group.h"
|
||||||
#include "app/tools/tool_loop.h"
|
#include "app/tools/tool_loop.h"
|
||||||
#include "base/exception.h"
|
#include "base/exception.h"
|
||||||
|
#include "fixmath/fixmath.h"
|
||||||
#include "raster/algo.h"
|
#include "raster/algo.h"
|
||||||
#include "raster/brush.h"
|
#include "raster/brush.h"
|
||||||
#include "raster/image.h"
|
#include "raster/image.h"
|
||||||
#include "raster/mask.h"
|
#include "raster/mask.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <allegro/file.h>
|
|
||||||
#include <allegro/fixed.h>
|
|
||||||
#include <allegro/fmaths.h>
|
|
||||||
|
|
||||||
#include "app/tools/controllers.h"
|
#include "app/tools/controllers.h"
|
||||||
#include "app/tools/inks.h"
|
#include "app/tools/inks.h"
|
||||||
|
@ -3,6 +3,10 @@
|
|||||||
* Based on Allegro library by Shawn Hargreaves.
|
* Based on Allegro library by Shawn Hargreaves.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "fixmath/fixmath.h"
|
#include "fixmath/fixmath.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user