[Webkit-unassigned] [Bug 44127] [chromium] Thumbnails not generated for GPU Rendered Pages

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 1 08:45:38 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=44127





--- Comment #37 from W. James MacLean <wjmaclean at chromium.org>  2010-09-01 08:45:37 PST ---
(In reply to comment #33)
> 
> have you considered replacing all of this code with some code that
> uses GraphicsContext and BitmapImage?  save for the GraphicsContext
> construction, i bet you could write some portable code for this if
> you used those classes.  WebFrameImpl::paint shows how to setup the
> GraphicsContext.

I've looked through the WebCore/platform/graphics code, and I think I've identified a way to make the code more portable. The initial creation of a GraphicsContext requires some #if's, and it is slightly less efficient as it seems it's hard to get access to the input canvas pixels in a platform-agnostic way, necessitating an intermediary buffer (but perhaps I'm missing something ...). Any implementation will include appropriate use of IntSize.

Here's a tentative sketch of how this might work (but I'm looking for advice here, as there may be better ways to achieve this):

1) Create a GraphicsContext as follows:

#if PLATFORM(CG)
    GraphicsContext gc(canvas);
#elif PLATFORM(SKIA)
    PlatformContextSkia context(canvas);

    // PlatformGraphicsContext is actually a pointer to PlatformContextSkia
    GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context));
#else
    notImplemented();
#endif

Not platform independent, but it's small.

2) Create an ImageBuffer object (ARGB) of the same size as the rootTextureLayer (this requires us to always allocate another buffer ... potentially wasteful, but avoids checking for mis-match in canvas size)

ImageBuffer imageBuffer();

3) From the ImageBuffer object, extract pointer to underlying pixels:

imageBuffer.getUnmultipliedImageData(rootLayerRect)->data().get(0).data() 

- returns pointer to unsigned char*
- presumably getUnmultipliedImageData() doesn't mind us modifying the underlying pixels ...

4) Pass pointer to getFrameBufferPixels.

5) Draw ImageBuffer object into gc using drawImageBuffer()

- Not sure about what sort of re-scaling (if any) is available here ...
- I assume this would handle canvas-size-mismatch transparently, but needs verification ...

6) If any of this fails, call gc.clearRect(rootLayerRect);

Questions: 

There seems no obvious way to get the 'size' of a GraphicsContext ... is it assumed to be an infinite (but possibly clipped to some underlying bitmap) drawing plane?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list