Hi,

I'm trying to make an incremental update using Cairo for rendering.

How do I do this?  I was hoping to write some code like this:

    make_current();
    cairo_set_source_rgba(cc, 0, 0, 1, 1);
    cairo_set_line_width(cc, 7);

    cairo_move_to(cc, 200, 200);
    cairo_line_to(cc, 10, 10);

    cairo_stroke(cc);

However cc was null and crashed the program.  I updated run.cxx: 
Widget::make_current() look like this:

void Widget::make_current() const {
  int x = 0;
  int y = 0;
  const Widget* widget = this;
  while (!widget->is_window()) {
    x += widget->x();
    y += widget->y();
    widget = widget->parent();
  }
  const Window* window = (const Window*)widget;
  Window::drawing_window_ = window;
  fl_clip_w = window->w();
  fl_clip_h = window->h();
  dc = CreatedWindow::find( window )->dc;
#if USE_CAIRO
  //cairo_invalidate_context();
    cairo_surface_t * surface =cairo_win32_surface_create(dc);
    cairo_invalidate_context();
    cc = cairo_create(surface);
    cairo_surface_destroy(surface);
#endif
  fl_select_palette(dc);
  load_identity();
  translate(x,y);
}

Now I have a valid pointer for cc but when I resize the window, It is not 
updated correctly.

btw - I'm using mingw on win32.

Any ideas about how I should proceed?

- Greg



_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to