title: Correct drawing when tiling a CGPattern
body: <p>I'm trying to fill a rect with a CGPattern, painting the typical bar with stripes. I obtain this.</p>
  
  <p><img src="https://i.stack.imgur.com/UTTDm.png" alt="enter image description here"></p>
  
  <p>The code of the pattern (not the entire bar) is this</p>
  
  <pre><code>CGContextSaveGState (context);
  
  CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(NULL);
  CGContextSetFillColorSpace(context, patternSpace);
  CGColorSpaceRelease(patternSpace);
  CGFloat alpha = 0.25f;
  static const CGPatternCallbacks callbacks = {0, &amp;DrawStripesPattern, NULL};
  NSNumber *cellSide = [NSNumber numberWithFloat:kTAGBarHeight];
  CGFloat cellSideFloat = [cellSide floatValue];
  
  CGPatternRef pattern = CGPatternCreate((__bridge void *)(cellSide),
                                         CGRectMake(0.0f, 0.0f, cellSideFloat, cellSideFloat),
                                         CGAffineTransformIdentity,
                                         cellSideFloat,
                                         cellSideFloat,
                                         kCGPatternTilingConstantSpacing,
                                         true,
                                         &amp;callbacks);
  CGContextAddPath(context, [path CGPath]);
  CGContextClip(context);
  CGContextSetFillPattern(context, pattern, &amp;alpha);
  CGContextFillRect(context, barRect);
  CGPatternRelease(pattern);
  
  CGContextRestoreGState (context);
  </code></pre>
  
  <p>The pattern cell has the same side of the height of the bar (look at <code>kTAGBarHeight</code>) and the drawing callback is drawing 5 reegular oblique lines inside the cell rect. It looks good but if you zoom a little...</p>
  
  <p><img src="https://i.stack.imgur.com/90laj.png" alt="enter image description here"></p>
  
  <p>The lines are being clipped to the cell rect so it looks like that. I have two questions:</p>
  
  <ol>
  <li>Why the pattern is not being drawn at origin (0,0) in the rect of
  the bar as I specify in <code>CGPatternCreate</code>? Could it be the absence
  of transform in the third parameter? </li>
  <li>How I can avoid that annoying effect?</li>
  </ol>