[chromium] Unify the drawing logic for different layer types that output textures...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Mar 2012 04:15:22 +0000 (04:15 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Mar 2012 04:15:22 +0000 (04:15 +0000)
commit49db3fa357fbbb10d9b8148abaeff924161fbf0a
tree07fa357c10ecbe4af067241e09df7aee669d8a22
parentefe9922cbfcf2dceac7ff2393ac26f11f04bce9c
[chromium] Unify the drawing logic for different layer types that output textures to the compositor
https://bugs.webkit.org/show_bug.cgi?id=81286

Patch by James Robinson <jamesr@chromium.org> on 2012-03-16
Reviewed by Adrienne Walker.

Source/WebCore:

Currently canvas 2d, webgl, and plugin layers all export a texture to the compositor that then needs to be
drawn.  There are a small set of operations that can be applied to the texture at draw time - do a Y flip,
stretch a subrect to the layer bounds, set the blend mode etc but they are fundamentally the same thing. This
collapses the nearly-redundant code into a single impl-side layer type for a texture-backed layer that can
handle the union of the bits needed for each layer type.

Canvas 2d, WebGL and plugin composited rendering are all covered by layout tests.

* WebCore.gypi:
* platform/graphics/chromium/Canvas2DLayerChromium.cpp:
(WebCore::Canvas2DLayerChromium::pushPropertiesTo):
* platform/graphics/chromium/CanvasLayerChromium.cpp:
(WebCore::CanvasLayerChromium::createCCLayerImpl):
* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::drawQuad):
(WebCore::TexStretchTextureProgramBinding::set):
(WebCore::TexTransformTextureProgramBinding::set):
(WebCore::LayerRendererChromium::drawTextureQuad):
(WebCore::LayerRendererChromium::textureLayerProgramFlip):
(WebCore::LayerRendererChromium::textureLayerProgramStretch):
(WebCore::LayerRendererChromium::textureLayerProgramStretchFlip):
(WebCore::LayerRendererChromium::textureLayerTexRectProgram):
(WebCore::LayerRendererChromium::textureLayerTexRectProgramFlip):
(WebCore::LayerRendererChromium::cleanupSharedObjects):
* platform/graphics/chromium/LayerRendererChromium.h:
(WebCore):
(LayerRendererChromium):
* platform/graphics/chromium/PluginLayerChromium.cpp:
(WebCore::PluginLayerChromium::PluginLayerChromium):
(WebCore::PluginLayerChromium::createCCLayerImpl):
(WebCore::PluginLayerChromium::setIOSurfaceProperties):
(WebCore::PluginLayerChromium::pushPropertiesTo):
* platform/graphics/chromium/PluginLayerChromium.h:
(PluginLayerChromium):
* platform/graphics/chromium/WebGLLayerChromium.cpp:
(WebCore::WebGLLayerChromium::pushPropertiesTo):
* platform/graphics/chromium/cc/CCCanvasDrawQuad.cpp: Removed.
* platform/graphics/chromium/cc/CCCanvasDrawQuad.h: Removed.
* platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp: Removed.
* platform/graphics/chromium/cc/CCCanvasLayerImpl.h: Removed.
* platform/graphics/chromium/cc/CCDrawQuad.cpp:
(WebCore::CCDrawQuad::toTextureDrawQuad):
* platform/graphics/chromium/cc/CCDrawQuad.h:
(WebCore):
(CCDrawQuad):
* platform/graphics/chromium/cc/CCTextureDrawQuad.cpp: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.cpp.
(WebCore):
(WebCore::CCTextureDrawQuad::create):
(WebCore::CCTextureDrawQuad::CCTextureDrawQuad):
* platform/graphics/chromium/cc/CCTextureDrawQuad.h: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.h.
(WebCore):
(CCTextureDrawQuad):
(WebCore::CCTextureDrawQuad::textureId):
(WebCore::CCTextureDrawQuad::hasAlpha):
(WebCore::CCTextureDrawQuad::premultipliedAlpha):
(WebCore::CCTextureDrawQuad::uvRect):
(WebCore::CCTextureDrawQuad::flipped):
(WebCore::CCTextureDrawQuad::ioSurfaceSize):
(WebCore::CCTextureDrawQuad::ioSurfaceTextureId):
* platform/graphics/chromium/cc/CCTextureLayerImpl.cpp: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp.
(WebCore):
(WebCore::CCTextureLayerImpl::CCTextureLayerImpl):
(WebCore::CCTextureLayerImpl::~CCTextureLayerImpl):
(WebCore::CCTextureLayerImpl::willDraw):
(WebCore::CCTextureLayerImpl::appendQuads):
(WebCore::CCTextureLayerImpl::dumpLayerProperties):
(WebCore::CCTextureLayerImpl::didLoseContext):
(WebCore::CCTextureLayerImpl::setIOSurfaceProperties):
* platform/graphics/chromium/cc/CCTextureLayerImpl.h: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h.
(WebCore):
(CCTextureLayerImpl):
(WebCore::CCTextureLayerImpl::create):
(WebCore::CCTextureLayerImpl::textureId):
(WebCore::CCTextureLayerImpl::setTextureId):
(WebCore::CCTextureLayerImpl::setHasAlpha):
(WebCore::CCTextureLayerImpl::setPremultipliedAlpha):
(WebCore::CCTextureLayerImpl::setFlipped):
(WebCore::CCTextureLayerImpl::setUVRect):
(WebCore::CCTextureLayerImpl::layerTypeAsString):

Source/WebKit/chromium:

* tests/Canvas2DLayerChromiumTest.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111112 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/CanvasLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h
Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h
Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/cc/CCCanvasDrawQuad.cpp [deleted file]
Source/WebCore/platform/graphics/chromium/cc/CCCanvasDrawQuad.h [deleted file]
Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp [deleted file]
Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.h [deleted file]
Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp
Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h
Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.cpp [moved from Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.cpp with 62% similarity]
Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h [moved from Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.h with 64% similarity]
Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp [moved from Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp with 80% similarity]
Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h [moved from Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h with 68% similarity]
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp