Quantcast

URGENT! RenderOffScreen replacement in Gecko 1.9

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

URGENT! RenderOffScreen replacement in Gecko 1.9

yakobom
Hi guys,
I desperately need you help.
I need the option to get an image into my own texture. Before GECKO
1.9, we did it using RenderOffScreen in the ViewManager.
Can someone please send me some instructions or a link to somewhere
that explains it ...
We have tried several things, including RenderDocument on PresShell,
but bumped into a lot of link errors.
We need quick assistance, and not only code lines.
Please - any assistance will be very appreciated.

Thanks,
yakobom
_______________________________________________
dev-embedding mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-embedding
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: URGENT! RenderOffScreen replacement in Gecko 1.9

Babele Dunnit
On Sep 2, 8:26 pm, yakobom <[hidden email]> wrote:

> Hi guys,
> I desperately need you help.
> I need the option to get an image into my own texture. Before GECKO
> 1.9, we did it using RenderOffScreen in the ViewManager.
> Can someone please send me some instructions or a link to somewhere
> that explains it ...
> We have tried several things, including RenderDocument on PresShell,
> but bumped into a lot of link errors.
> We need quick assistance, and not only code lines.
> Please - any assistance will be very appreciated.
>
> Thanks,
> yakobom

Hi Yako, still me... lets join forces, maybe someone hear us (nobody
answered my similar question 3 weeks ago).

Right now, after reading THIS thread:

http://groups.google.com/group/mozilla.dev.embedding/browse_thread/thread/57e07c2f2109a36f

I understood that THIS is important:

http://developer.mozilla.org/en/Migrating_from_Internal_Linkage_to_Frozen_Linkage

this should fix the HELL of a problems I have with strings and
linkage... but I hope that everything I used (apart from string) was
not moved into internals because I digged quite deep in FF code to do
what we are doing.

Also, THIS seems to be interesting (also cited in the thread above) :

http://developer.mozilla.org/en/XPCOM_Glue

For everything else, I mean the REAL RenderOffscreen problem, I hope
someone will send some snippet... they also moved to Cairo, so no more
"internal" rendering context... I believe the code must be changed
quite a lot.

You know? I will check Google Chrome code VERY SOON... :)



_______________________________________________
dev-embedding mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-embedding
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: URGENT! RenderOffScreen replacement in Gecko 1.9

steve lu
Hi,

Follow the yellow brick road along <nsIDOMCanvasRenderingContext2D>, and
you shall find what you looking for.

-steve


Babele Dunnit wrote:

> On Sep 2, 8:26 pm, yakobom <[hidden email]> wrote:
>  
>> Hi guys,
>> I desperately need you help.
>> I need the option to get an image into my own texture. Before GECKO
>> 1.9, we did it using RenderOffScreen in the ViewManager.
>> Can someone please send me some instructions or a link to somewhere
>> that explains it ...
>> We have tried several things, including RenderDocument on PresShell,
>> but bumped into a lot of link errors.
>> We need quick assistance, and not only code lines.
>> Please - any assistance will be very appreciated.
>>
>> Thanks,
>> yakobom
>>    
>
> Hi Yako, still me... lets join forces, maybe someone hear us (nobody
> answered my similar question 3 weeks ago).
>
> Right now, after reading THIS thread:
>
> http://groups.google.com/group/mozilla.dev.embedding/browse_thread/thread/57e07c2f2109a36f
>
> I understood that THIS is important:
>
> http://developer.mozilla.org/en/Migrating_from_Internal_Linkage_to_Frozen_Linkage
>
> this should fix the HELL of a problems I have with strings and
> linkage... but I hope that everything I used (apart from string) was
> not moved into internals because I digged quite deep in FF code to do
> what we are doing.
>
> Also, THIS seems to be interesting (also cited in the thread above) :
>
> http://developer.mozilla.org/en/XPCOM_Glue
>
> For everything else, I mean the REAL RenderOffscreen problem, I hope
> someone will send some snippet... they also moved to Cairo, so no more
> "internal" rendering context... I believe the code must be changed
> quite a lot.
>
> You know? I will check Google Chrome code VERY SOON... :)
>
>
>
> _______________________________________________
> dev-embedding mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-embedding
>
>  

_______________________________________________
dev-embedding mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-embedding
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: URGENT! RenderOffScreen replacement in Gecko 1.9

Babele Dunnit
In reply to this post by Babele Dunnit
Hello everybody,

I managed to get to the pixels. Here cometh the snippet. DISCLAIMER:
this works for me, and it's probably still buggy. I still have to
understand if and where I have to use smart pointers, and I know never
free memory, and a lot of other stuff that must be fixed. All I know
is that "textureBuffer"  points to a memory zone that I can
subsequently render in a OpenGL texture, so I can tell it works.

Ciao,
Aaron/Babele

void EmbeddedBrowser::GrabWindow()
{

    nsCOMPtr<nsIDOMWindow> domWindow;
    nsresult rv = mWebBrowser-
>GetContentDOMWindow(getter_AddRefs(domWindow));
    assert(NS_SUCCEEDED(rv) && domWindow);

    nsCOMPtr<nsICanvasRenderingContextInternal> context;
    context = do_CreateInstance("@mozilla.org/content/canvas-rendering-
context;1?id=2d", &rv);

    assert(NS_SUCCEEDED(rv) && context);

    context->SetDimensions(512, 512);
    context->SetCanvasElement(nsnull);

    nsCOMPtr<nsIDOMCanvasRenderingContext2D> domCanvas;
    domCanvas = do_QueryInterface(context, &rv);
    assert(NS_SUCCEEDED(rv) && domCanvas);

    rv = domCanvas->DrawWindow(domWindow, 0, 0, 512, 512,
NS_LITERAL_STRING("rgb(0,0,0)"));
    assert (NS_SUCCEEDED(rv));

    gfxASurface* DOMRenderedSurface = NULL;
    rv = context->GetThebesSurface(&DOMRenderedSurface);
    assert (NS_SUCCEEDED(rv) && DOMRenderedSurface);

    assert(DOMRenderedSurface->GetType() ==
gfxASurface::SurfaceTypeWin32);
    assert(DOMRenderedSurface->GetContentType() ==
gfxASurface::CONTENT_COLOR_ALPHA);

    nsRefPtr<gfxImageSurface> imgSurface = new
gfxImageSurface(gfxIntSize(512,
512),gfxImageSurface::ImageFormatARGB32);
    assert(imgSurface);

    gfxContext* dcontext = new gfxContext(imgSurface);
    assert(dcontext);

    dcontext->SetOperator(gfxContext::OPERATOR_SOURCE);
    dcontext->SetSource(DOMRenderedSurface);
    dcontext->Paint();

    PRUint32* imageData = (PRUint32*)imgSurface->Data();
    textureBuffer = (char*) imageData;

}

_______________________________________________
dev-embedding mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-embedding
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: URGENT! RenderOffScreen replacement in Gecko 1.9

André Pedralho
Hi Aaron and Babele,

I used to set the widgetDamageRectInPixels coordinates in nsViewManager
before use it in CopyOffScreenBits, how can I do it on the new architecture?
It used to be something like:

widgetDamageRectInPixels.x = valueX;
widgetDamageRectInPixels.y = valueY;
localcx->CopyOffScreenBits(ds, 0, 0, widgetDamageRectInPixels,
NS_COPYBITS_USE_SOURCE_CLIP_REGION);

Can you help me?

Thanks in advance,

Andre Pedralho

On Mon, Oct 6, 2008 at 6:11 AM, Babele Dunnit <[hidden email]>wrote:

> Hello everybody,
>
> I managed to get to the pixels. Here cometh the snippet. DISCLAIMER:
> this works for me, and it's probably still buggy. I still have to
> understand if and where I have to use smart pointers, and I know never
> free memory, and a lot of other stuff that must be fixed. All I know
> is that "textureBuffer"  points to a memory zone that I can
> subsequently render in a OpenGL texture, so I can tell it works.
>
> Ciao,
> Aaron/Babele
>
> void EmbeddedBrowser::GrabWindow()
> {
>
>    nsCOMPtr<nsIDOMWindow> domWindow;
>    nsresult rv = mWebBrowser-
> >GetContentDOMWindow(getter_AddRefs(domWindow));
>    assert(NS_SUCCEEDED(rv) && domWindow);
>
>    nsCOMPtr<nsICanvasRenderingContextInternal> context;
>    context = do_CreateInstance("@mozilla.org/content/canvas-rendering-
> context;1?id=2d", &rv);
>
>    assert(NS_SUCCEEDED(rv) && context);
>
>    context->SetDimensions(512, 512);
>    context->SetCanvasElement(nsnull);
>
>    nsCOMPtr<nsIDOMCanvasRenderingContext2D> domCanvas;
>    domCanvas = do_QueryInterface(context, &rv);
>    assert(NS_SUCCEEDED(rv) && domCanvas);
>
>    rv = domCanvas->DrawWindow(domWindow, 0, 0, 512, 512,
> NS_LITERAL_STRING("rgb(0,0,0)"));
>    assert (NS_SUCCEEDED(rv));
>
>    gfxASurface* DOMRenderedSurface = NULL;
>    rv = context->GetThebesSurface(&DOMRenderedSurface);
>    assert (NS_SUCCEEDED(rv) && DOMRenderedSurface);
>
>    assert(DOMRenderedSurface->GetType() ==
> gfxASurface::SurfaceTypeWin32);
>    assert(DOMRenderedSurface->GetContentType() ==
> gfxASurface::CONTENT_COLOR_ALPHA);
>
>    nsRefPtr<gfxImageSurface> imgSurface = new
> gfxImageSurface(gfxIntSize(512,
> 512),gfxImageSurface::ImageFormatARGB32);
>    assert(imgSurface);
>
>    gfxContext* dcontext = new gfxContext(imgSurface);
>    assert(dcontext);
>
>    dcontext->SetOperator(gfxContext::OPERATOR_SOURCE);
>    dcontext->SetSource(DOMRenderedSurface);
>    dcontext->Paint();
>
>    PRUint32* imageData = (PRUint32*)imgSurface->Data();
>    textureBuffer = (char*) imageData;
>
> }
>
> _______________________________________________
> dev-embedding mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-embedding
>



--
André Pedralho
_______________________________________________
dev-embedding mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-embedding
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: URGENT! RenderOffScreen replacement in Gecko 1.9

Christian Sell
In reply to this post by Babele Dunnit
doesn't seem to work (or even compile) with recent (>=24) XULRunner versions
_______________________________________________
dev-embedding mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-embedding
Loading...