I'm extending my MozMFC example to handle rendering into a Win32 bitmap. I start with the following ...

    nsCOMPtr<nsICanvasRenderingContextInternal> context;
context = do_CreateInstance("@mozilla.org/content/canvas-rendering-context;1?id=2d", &rv);
    if (!(NS_SUCCEEDED(rv) && context))
    {
        return 0;
    }
    context->SetDimensions(clientRect.Width(),clientRect.Height());


setDimensions() internally calls InitializeWithSurface(NULL, surface, width, height);

Sadly InitializeWithSurface() triggers the following assertion:

NS_ASSERTION(!docShell ^ !mCanvasElement, "Cannot set both docshell and canvas element");

Where am I going wrong here? Should there be some additional prior initialization of the context? both docShell and mCanvasElement are null.

Thx++

Jerry

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to