[cairo] cairo surface blit

张玲春 zlc53 at 163.com
Fri Oct 23 10:15:26 PDT 2009


void PaintDeviceCairo::BlitToMemory(MemoryImage& image, const ClipRect& rect)
{
    int width = cairo_image_surface_get_stride(m_surface);
    char* target = (char*)image.buffer + image.pitch * rect._y + rect._x * sizeof(UINT);
    char* pixels = (char*)cairo_image_surface_get_data(m_surface) + 
        width * rect._y + rect._x * sizeof(UINT);
    
    for(int _y = 0; _y < rect._h; _y ++)
    {
        memcpy(target, pixels, sizeof(UINT) * rect._w);
        pixels += width;
        target += image.pitch;
    }
}

I'd like a cairo surface part of the draw into the memory, but I found that always show all black. Why? 
Note: This memory is D3D SURFACE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20091024/94c31b58/attachment.html 


More information about the cairo mailing list