CGContextFillRect occurred unexpected color
<p>When I use <code>CGContextSetFillColorWithColor</code> and <code>CGContextFillRect</code> to fill a rect in a CGBitmapContext, the final color depends on the rect size.</p>

<p>Here is my code.  My problem is that if I change <code>size_w</code> to 2 or other size, it will cause unexpected rgba data.</p>

<pre><code>int size_w=51;
GLubyte *const data=malloc(size_w*size_w*sizeof(GLubyte)*4);

CGContextRef context= CGBitmapContextCreate(data, size_w, size_w, 8, size_w*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaPremultipliedLast|kCGBitmapByteOrder32Big);

CGContextSaveGState(context);

CGContextSetFillColorWithColor(context, [UIColor colorWithRed:1.0f green:0.0f blue:0.0f alpha:0.2f].CGColor);

CGContextFillRect(context, CGRectMake(0, 0, size_w, size_w));

CGContextRestoreGState(context);

CGImageRef cimage= CGBitmapContextCreateImage(context);
//print the rgba data
struct RGBA* tmp=(struct RGBA*)data;

    for (int i=0; i&lt;size_w*size_w; i++) {

       struct RGBA pixel=tmp[i];
       NSLog(@"r:%i,g:%i,b:%i,a:%i\n",pixel.R,pixel.G,pixel.B,pixel.A);

    }
});
</code></pre>

<p>Struct <code>RGBA</code> is defined as follows:</p>

<pre><code>struct RGBA {
    uint8_t R;
    uint8_t G;
    uint8_t B;
    uint8_t A;
};
</code></pre>