Skip to content

Instantly share code, notes, and snippets.

@kevinw
Created December 19, 2008 17:57
Show Gist options
  • Save kevinw/38063 to your computer and use it in GitHub Desktop.
Save kevinw/38063 to your computer and use it in GitHub Desktop.
void Layer::renderContent(GraphicsContext* cr)
{
ANIM_ASSERT(isPresentation());
cairo_surface_t* contents = modelLayer()->contents();
if (0 && contents) {
ANIM_ASSERT(cairo_surface_status(contents) == CAIRO_STATUS_SUCCESS);
cairo_set_source_surface(cr, contents, 0, 0);
cairo_rectangle(cr, 0, 0, cairo_image_surface_get_width(contents), cairo_image_surface_get_height(contents));
cairo_fill(cr);
} else {
render_empty_layer_content(cr);
}
}
HBITMAP hbitmap = /* ... */
HDC hdc = CreateCompatibleDC(0);
if (hdc) {
HGDIOBJ oldObj = SelectObject(hdc, hbitmap);
cairo_surface_t* surface = cairo_win32_surface_create(hdc);
int width = cairo_image_surface_get_width(surface);
/* width is 0 :( */
assert(cairo_surface_status(surface) == CAIRO_STATUS_SUCCESS);
/* true! */
SelectObject(hdc, oldObj);
DeleteDC(hdc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment