mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
test
This commit is contained in:
parent
50a0df805f
commit
6bae8124a0
3 changed files with 61 additions and 7 deletions
|
@ -90,5 +90,5 @@ struct UserExample : tvgexam::Example
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
return tvgexam::main(new UserExample, argc, argv, false, 1024, 1024);
|
return tvgexam::main(new UserExample, argc, argv, false, 500, 300);
|
||||||
}
|
}
|
File diff suppressed because one or more lines are too long
|
@ -20,6 +20,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
struct Vertex
|
struct Vertex
|
||||||
{
|
{
|
||||||
Point pt;
|
Point pt;
|
||||||
|
@ -115,7 +117,11 @@ static void _rasterBlendingPolygonImageSegment(SwSurface* surface, const SwImage
|
||||||
|
|
||||||
while (y < yEnd) {
|
while (y < yEnd) {
|
||||||
x1 = (int32_t)_xa;
|
x1 = (int32_t)_xa;
|
||||||
|
std::cout << "_xa = " << _xa << std::endl;
|
||||||
|
std::cout << "x1 = " << x1 << std::endl;
|
||||||
x2 = (int32_t)_xb;
|
x2 = (int32_t)_xb;
|
||||||
|
std::cout << "_xb = " << _xb << std::endl;
|
||||||
|
std::cout << "x2 = " << x2 << std::endl;
|
||||||
|
|
||||||
if (!region) {
|
if (!region) {
|
||||||
minx = INT32_MAX;
|
minx = INT32_MAX;
|
||||||
|
@ -153,7 +159,14 @@ static void _rasterBlendingPolygonImageSegment(SwSurface* surface, const SwImage
|
||||||
while (x++ < x2) {
|
while (x++ < x2) {
|
||||||
uu = (int) u;
|
uu = (int) u;
|
||||||
if (uu >= sw) continue;
|
if (uu >= sw) continue;
|
||||||
vv = (int) v;
|
|
||||||
|
vv = (int)v;
|
||||||
|
if (vv < 0) {
|
||||||
|
// std::cout << "Before conversion v = " << v << std::endl;
|
||||||
|
// std::cout << "After conversion vv = " << vv << std::endl;
|
||||||
|
// vv = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (vv >= sh) continue;
|
if (vv >= sh) continue;
|
||||||
|
|
||||||
ar = (int)(255 * (1 - modff(u, &iptr)));
|
ar = (int)(255 * (1 - modff(u, &iptr)));
|
||||||
|
@ -197,6 +210,11 @@ static void _rasterBlendingPolygonImageSegment(SwSurface* surface, const SwImage
|
||||||
uu = (int) u;
|
uu = (int) u;
|
||||||
if (uu >= sw) continue;
|
if (uu >= sw) continue;
|
||||||
vv = (int) v;
|
vv = (int) v;
|
||||||
|
if (vv < 0) {
|
||||||
|
// std::cout << "Before conversion v = " << v << std::endl;
|
||||||
|
// std::cout << "After conversion vv = " << vv << std::endl;
|
||||||
|
// vv = -1;
|
||||||
|
}
|
||||||
if (vv >= sh) continue;
|
if (vv >= sh) continue;
|
||||||
|
|
||||||
ar = (int)(255 * (1 - modff(u, &iptr)));
|
ar = (int)(255 * (1 - modff(u, &iptr)));
|
||||||
|
@ -299,6 +317,12 @@ static void _rasterPolygonImageSegment(SwSurface* surface, const SwImage* image,
|
||||||
x1 = (int32_t)_xa;
|
x1 = (int32_t)_xa;
|
||||||
x2 = (int32_t)_xb;
|
x2 = (int32_t)_xb;
|
||||||
|
|
||||||
|
// x1 = static_cast<int32_t>(std::round(_xa));
|
||||||
|
// x2 = static_cast<int32_t>(std::round(_xb));
|
||||||
|
|
||||||
|
// std::cout << "_xa: " << _xa << " _xb: " << _xb << std::endl;
|
||||||
|
// std::cout << "x1: " << x1 << " x2: " << x2 << std::endl;
|
||||||
|
|
||||||
if (!region) {
|
if (!region) {
|
||||||
minx = INT32_MAX;
|
minx = INT32_MAX;
|
||||||
maxx = 0;
|
maxx = 0;
|
||||||
|
@ -335,18 +359,42 @@ static void _rasterPolygonImageSegment(SwSurface* surface, const SwImage* image,
|
||||||
if (opacity == 255) {
|
if (opacity == 255) {
|
||||||
//Draw horizontal line
|
//Draw horizontal line
|
||||||
while (x++ < x2) {
|
while (x++ < x2) {
|
||||||
|
// cout << "image: " << image->w << " " << image->h << endl;
|
||||||
uu = (int) u;
|
uu = (int) u;
|
||||||
if (uu < 0 || uu >= sw) continue;
|
// cout << "uu: " << uu << " sw: " << sw << endl;
|
||||||
vv = (int) v;
|
if (uu >= sw) continue;
|
||||||
if (vv < 0 || vv >= sh) continue;
|
|
||||||
|
vv = (int)v;
|
||||||
|
if (vv < 0) {
|
||||||
|
// std::cout << "Before conversion v = " << v << std::endl;
|
||||||
|
// std::cout << "After conversion vv = " << vv << std::endl;
|
||||||
|
// vv = -1;
|
||||||
|
}
|
||||||
|
// cout << "vv: " << vv << " sh: " << sh << endl;
|
||||||
|
if (vv >= sh) continue; // -1
|
||||||
|
|
||||||
ar = (int)(255.0f * (1.0f - modff(u, &iptr)));
|
ar = (int)(255.0f * (1.0f - modff(u, &iptr)));
|
||||||
ab = (int)(255.0f * (1.0f - modff(v, &iptr)));
|
ab = (int)(255.0f * (1.0f - modff(v, &iptr)));
|
||||||
iru = uu + 1;
|
iru = uu + 1;
|
||||||
irv = vv + 1;
|
irv = vv + 1;
|
||||||
|
|
||||||
|
bool flag = false;
|
||||||
|
if ((vv * sw) + uu < 0) {
|
||||||
|
// problem from here
|
||||||
|
// Intel processor doesn't raise segmentation fault
|
||||||
|
// Arm processor raises segmentation fault
|
||||||
|
flag = true;
|
||||||
|
std::cout << "vv * sw + uu = " << (vv * sw) + uu << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For example, (vv * sw) + uu = -843
|
||||||
px = *(sbuf + (vv * sw) + uu);
|
px = *(sbuf + (vv * sw) + uu);
|
||||||
|
|
||||||
|
if (flag) {
|
||||||
|
std::cout << "check: px = " << px << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* horizontal interpolate */
|
/* horizontal interpolate */
|
||||||
if (iru < sw) {
|
if (iru < sw) {
|
||||||
/* right pixel */
|
/* right pixel */
|
||||||
|
@ -386,7 +434,13 @@ static void _rasterPolygonImageSegment(SwSurface* surface, const SwImage* image,
|
||||||
//Draw horizontal line
|
//Draw horizontal line
|
||||||
while (x++ < x2) {
|
while (x++ < x2) {
|
||||||
uu = (int) u;
|
uu = (int) u;
|
||||||
vv = (int) v;
|
|
||||||
|
vv = (int)v;
|
||||||
|
if (vv < 0) {
|
||||||
|
// std::cout << "Before conversion v = " << v << std::endl;
|
||||||
|
// std::cout << "After conversion vv = " << vv << std::endl;
|
||||||
|
// vv = -1;
|
||||||
|
}
|
||||||
|
|
||||||
ar = (int)(255.0f * (1.0f - modff(u, &iptr)));
|
ar = (int)(255.0f * (1.0f - modff(u, &iptr)));
|
||||||
ab = (int)(255.0f * (1.0f - modff(v, &iptr)));
|
ab = (int)(255.0f * (1.0f - modff(v, &iptr)));
|
||||||
|
|
Loading…
Add table
Reference in a new issue