Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

complex BLPath can cause execution timeout error #162

Open
Wiladams opened this issue Apr 11, 2023 · 2 comments
Open

complex BLPath can cause execution timeout error #162

Wiladams opened this issue Apr 11, 2023 · 2 comments
Labels

Comments

@Wiladams
Copy link

//The following will cause an execution timeout error.  In a running app, it appears as a hang
// 'render()' is an entry-point, 'cci' would initialize the rendering context.
BLImage render(const BLContextCreateInfo& cci) {
  // Create a destination image and rendering context.
  BLImage img(500, 140, BL_FORMAT_PRGB32);
  BLContext ctx(img, cci);

  // The image data is not guaranteed to be empty, so clear it explicitly.
  ctx.clearAll();
  ctx.setFillStyle(BLRgba32(0xffffffff));
  ctx.setStrokeStyle(BLRgba32((0xffff0000)));
  // The following will cause execution to timeout
  ctx.setStrokeWidth(0.1);


  BLPath apath{};

// Command: M
apath.moveTo(111.600000, 80.400000);
// Command: L
apath.lineTo(111.900000, 80.100000);
// Command: C
apath.cubicTo(111.700000,80.000000,111.300000,79.700000,111.100000,79.700000);
// Command: C
apath.cubicTo(110.700000,79.700000,111.300000,79.600000,111.100000,79.400000);
// Command: C
apath.cubicTo(110.800000,79.200000,111.100000,79.300000,111.200000,79.200000);
// Command: C
apath.cubicTo(111.300000,79.000000,111.000000,79.000000,111.100000,79.000000);
// Command: C
apath.cubicTo(111.200000,78.900000,111.300000,78.700000,111.100000,78.600000);
// Command: C
apath.cubicTo(110.900000,78.500000,111.100000,78.800000,111.100000,78.500000);
// Command: C
apath.cubicTo(111.100000,78.400000,111.100000,78.300000,110.900000,78.300000);
// Command: C
apath.cubicTo(110.300000,78.300000,111.200000,78.200000,110.800000,78.000000);
// Command: C
apath.cubicTo(110.600000,77.800000,110.400000,78.100000,110.600000,77.800000);
// Command: C
apath.cubicTo(110.700000,77.600000,110.400000,77.500000,110.400000,77.700000);
// Command: C
apath.cubicTo(110.300000,77.800000,110.300000,77.600000,110.200000,77.500000);
// Command: C
apath.cubicTo(110.000000,77.300000,109.700000,77.800000,110.000000,77.400000);
// Command: C
apath.cubicTo(110.200000,77.100000,109.800000,77.000000,109.800000,77.200000);
// Command: C
apath.cubicTo(109.700000,77.200000,110.000000,77.000000,109.900000,76.900000);
// Command: C
apath.cubicTo(109.500000,76.600000,109.600000,77.100000,109.600000,76.800000);
// Command: C
apath.cubicTo(109.700000,76.500000,109.300000,76.100000,109.100000,76.400000);
// Command: C
apath.cubicTo(109.100000,76.300000,109.100000,75.900000,109.000000,75.900000);
// Command: C
apath.cubicTo(108.500000,75.800000,108.900000,76.100000,108.600000,75.700000);
// Command: C
apath.cubicTo(108.500000,75.700000,108.400000,75.800000,108.300000,75.800000);
// Command: C
apath.cubicTo(108.200000,75.900000,108.100000,75.500000,107.800000,75.600000);
// Command: C
apath.cubicTo(107.500000,75.800000,107.900000,75.700000,107.600000,75.700000);
// Command: C
apath.cubicTo(107.500000,75.700000,107.400000,75.700000,107.500000,75.900000);
// Command: C
apath.cubicTo(107.500000,75.900000,107.600000,75.900000,107.600000,75.900000);
// Command: C
apath.cubicTo(107.700000,75.900000,107.400000,75.800000,107.200000,75.800000);
// Command: C
apath.cubicTo(106.600000,75.800000,107.200000,76.200000,107.000000,76.100000);
// Command: C
apath.cubicTo(106.900000,76.000000,106.700000,76.000000,106.600000,76.100000);
// Command: C
apath.cubicTo(106.400000,76.200000,106.800000,76.400000,106.500000,76.000000);
// Command: C
apath.cubicTo(106.400000,75.700000,106.300000,76.300000,106.200000,76.100000);
// Command: C
apath.cubicTo(106.200000,76.000000,106.300000,75.700000,106.100000,75.800000);
// Command: C
apath.cubicTo(105.900000,75.800000,106.100000,76.200000,106.000000,76.000000);
// Command: C
apath.cubicTo(105.900000,75.800000,105.300000,75.900000,105.200000,75.900000);
// Command: C
apath.cubicTo(105.100000,75.900000,105.200000,76.100000,105.300000,76.200000);
// Command: C
apath.cubicTo(105.400000,76.300000,104.900000,76.300000,105.300000,76.500000);
// Command: C
apath.cubicTo(105.500000,76.600000,104.400000,76.600000,105.100000,76.900000);
// Command: C
apath.cubicTo(105.200000,76.900000,104.900000,76.900000,104.700000,77.100000);
// Command: C
apath.cubicTo(104.600000,77.300000,105.000000,77.400000,105.100000,77.300000);
// Command: C
apath.cubicTo(105.100000,77.400000,104.800000,77.800000,105.200000,77.700000);
// Command: C
apath.cubicTo(105.600000,77.600000,105.000000,77.600000,105.100000,77.900000);
// Command: C
apath.cubicTo(105.200000,78.000000,105.400000,78.000000,105.500000,77.900000);
// Command: C
apath.cubicTo(105.600000,77.800000,105.200000,78.500000,105.700000,78.200000);
// Command: C
apath.cubicTo(105.800000,78.200000,105.800000,78.000000,105.800000,78.200000);
// Command: C
apath.cubicTo(105.600000,78.600000,106.200000,78.200000,106.200000,78.300000);
// Command: C
apath.cubicTo(106.200000,78.500000,106.100000,78.700000,106.500000,78.700000);
// Command: C
apath.cubicTo(106.700000,78.700000,106.600000,78.400000,106.700000,78.500000);
// Command: C
apath.cubicTo(106.700000,78.700000,106.600000,78.700000,106.900000,78.700000);
// Command: C
apath.cubicTo(107.200000,78.700000,106.800000,78.500000,106.900000,78.800000);
// Command: C
apath.cubicTo(106.900000,78.900000,107.100000,78.900000,107.200000,78.800000);
// Command: C
apath.cubicTo(107.200000,78.700000,107.100000,78.800000,107.200000,78.900000);
// Command: C
apath.cubicTo(107.500000,79.400000,107.700000,78.900000,107.800000,78.900000);
// Command: C
apath.cubicTo(107.800000,79.000000,107.700000,79.200000,107.900000,79.200000);
// Command: C
apath.cubicTo(108.000000,79.200000,108.000000,79.000000,108.000000,79.000000);
// Command: C
apath.cubicTo(108.000000,79.500000,108.300000,79.300000,108.300000,78.900000);
// Command: C
apath.cubicTo(108.300000,79.000000,108.400000,79.200000,108.500000,79.100000);
// Command: C
apath.cubicTo(108.700000,78.800000,108.600000,79.600000,108.900000,79.200000);
// Command: C
apath.cubicTo(109.100000,78.800000,108.900000,79.500000,109.200000,79.200000);
// Command: C
apath.cubicTo(109.300000,79.100000,109.000000,79.300000,109.200000,79.500000);
// Command: C
apath.cubicTo(109.500000,80.000000,109.700000,79.100000,109.700000,79.500000);
// Command: C
apath.cubicTo(109.700000,80.000000,109.900000,79.100000,109.900000,79.600000);
// Command: C
apath.cubicTo(109.900000,79.800000,110.200000,79.800000,110.300000,79.700000);
// Command: C
apath.cubicTo(110.300000,79.700000,110.100000,79.900000,110.300000,80.000000);
// Command: C
apath.cubicTo(110.500000,80.100000,110.700000,79.900000,111.000000,80.000000);
// Command: C
apath.cubicTo(111.100000,80.100000,111.600000,80.300000,111.600000,80.400000);
// Command: L
apath.lineTo(111.600000, 80.400000);
// Command: z
apath.close();


  ctx.fillPath(apath);
  ctx.strokePath(apath);

  return img;
}
@Wiladams
Copy link
Author

Very specifically, if the strokeWidth is set to 0.1, this will hang. If it uses the default of '1', it will not hang, and will draw normally.

@kobalicek
Copy link
Member

I'm marking as a duplicate of this one: #117

I hope to get this fixed soon, sorry for delay in this case!

@kobalicek kobalicek added the bug label Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants