title: CGLayers not drawing to screen
body: <p>What's wrong with my drawRect: code? </p>
  
  <p>Create CGContextRef for drawing</p>
  
  <pre><code>   CGContextRef myContext = [[NSGraphicsContext currentContext] graphicsPort];
  </code></pre>
  
  <p>Create CGLayerRef with current context</p>
  
  <pre><code>   CGLayerRef theLayer = CGLayerCreateWithContext(myContext, CGSizeMake(5, 5) NULL);
  </code></pre>
  
  <p>Create a CGContextRef for the layer itself</p>
  
  <pre><code>   CGContextRef theCurrentLayer = CGLayerGetContext(theLayer);
  </code></pre>
  
  <p>Get location of mouse, to be used as origin</p>
  
  <pre><code>   NSPoint point = [self.window mouseLocationOutsideOfEventStream];
  </code></pre>
  
  <p>Set color to black</p>
  
  <pre><code>   CGContextSetRGBFillColor(theCurrentLayer, 0, 0, 0, 1);
  </code></pre>
  
  <p>Draw a rectangle to the layer</p>
  
  <pre><code>   CGContextFillRect (theCurrentLayer, CGRectMake (point.x, point.y, 5, 5));
  </code></pre>
  
  <p>Draw the layer to the current context at the mouse location</p>
  
  <pre><code>   CGContextDrawLayerAtPoint(myContext, CGPointMake(point.x, point.y), theLayer);
  </code></pre>
  
  <p>And nothing happens… Memory usage increases steadily indicating that the layers are being created, but nothing appears in the window.</p>