We need to decode an image directly into a GraphicsSurface when the image is directly composited image that RenderLayerBacking give CoordinatedGraphicsLayer via setContentsToImage. If we make it, we can save temporary memory and remove a copy overhead.
Created attachment 173925 [details] Partially working patch This shows how it can work, but I'm not sure yet if it's the way to go.
I think you show the direction where we should go. I think it would be better if we can change only ImageDecoder without changing BitmapImage and ImageSource. I think we can do it as following chromium's approach. for instance, define as follow in NativeImagePtr.h #elif PLATFORM(QT) #if USE(GRAPHICS_SURFACE) typedef GraphicsSurface* NativeImagePtr; #else typedef QPixmap* NativeImagePtr; #endif and every image decoders access NativeImagePtr's pixel. btw, I think the most tricky blocker is caching mechanism of MemoryCache. MemoryCache needs to remove decoded data of CachedImage. But if MemoryCache removes directed-composited image, UI Process encounters null pointer exception. we need to make the plan for this.