Skip to content

Commit

Permalink
turned off scissor rect since it can cause strange artifacts if the p…
Browse files Browse the repository at this point in the history
…oint is barely outside the scissorRect. the points are clipped based on their center, not their center + pointSize. #1
  • Loading branch information
adamwulf committed Sep 8, 2016
1 parent 4f9eb56 commit f6aff9b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion JotUI/JotUI/JotView.m
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,19 @@ - (void)renderAllStrokesToContext:(JotGLContext*)renderContext inFramebuffer:(Ab
@autoreleasepool {
CheckMainThread;

// disable scissorRect. scissors is clipping based on the point center
// not on the point center + size, which means that if the point
// is barely outside the scissor rect, it won't be rendered even if
// its pointSize would overlap the scissorRect.
//
// to get around this problem, I think I'd have to render with quads.
// This means that during undo/redo, or during a rotation change
// for the highlighter, the points on the edges of the scissor rect
// are not getting rendered, leading to some strange artifacts.
//
// filed at https://github.com/adamwulf/JotUI/issues/1
scissorRect = CGRectZero;

if (!state)
return;

Expand Down Expand Up @@ -1458,7 +1471,7 @@ - (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event {
if (([[currentStroke segments] count] <= 2) || (len < 20 && distanceBetween2(start, end) < 5)) {
// if the rotation is off by at least 10 degrees, then updated the rotation on the stroke
// otherwise let the previous rotation stand
if(ABS([(AbstractBezierPathElement*)[[currentStroke segments] firstObject] rotation] - rot) > 0.2){
if(ABS([(AbstractBezierPathElement*)[[currentStroke segments] firstObject] rotation] - rot) > M_PI_4){
needsRenderAgain = YES;
[[currentStroke segments] enumerateObjectsUsingBlock:^(AbstractBezierPathElement* _Nonnull obj, NSUInteger idx, BOOL* _Nonnull stop) {
obj.rotation = rot;
Expand Down

0 comments on commit f6aff9b

Please sign in to comment.