Skip to content
  • commit-queue@webkit.org's avatar
    WebGL: Add a class to abstract the status of the Image in texImage2D() and texSubImage2D() · 9a7a8d2f
    commit-queue@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=103606
    
    Patch by Jun Jiang <jun.a.jiang@intel.com> on 2012-11-30
    Reviewed by Kenneth Russell.
    
    In texImage2D() and texSubImage2D() for WebGL, the status of the Image is extracted and kept in the function GraphicsContext3D::getImageData() but provides no interface or guaranteed way to use the status of the Image outside GraphicsContext3D::getImageData() safely. For example, you can not get the address of the raw Image data and operate it outside the scope of the GraphicsContext3D::getImageData() and there is at least one memory copy existed from the Image to the intermediate vector.
           This patch refactors the code by adding a ImageExtractor class to abstract and keep the status of the Image. The lifetime and validity of Image status are determined by the lifetime of the object instead of the scope of getImageData(). It provides flexibility on future optimizations.
    
    No new tests. It is a code refactoring patch.
    
    * html/canvas/WebGLRenderingContext.cpp:
    (WebCore):
    (WebCore::WebGLRenderingContext::texImage2DImpl):
    (WebCore::WebGLRenderingContext::texSubImage2DImpl):
    * platform/graphics/GraphicsContext3D.cpp:
    (WebCore::GraphicsContext3D::ImageExtractor::ImageExtractor):
    (WebCore):
    (WebCore::GraphicsContext3D::packImageData):
    * platform/graphics/GraphicsContext3D.h:
    (WebCore):
    (GraphicsContext3D):
    (ImageExtractor):
    (WebCore::GraphicsContext3D::ImageExtractor::extractSucceeded):
    (WebCore::GraphicsContext3D::ImageExtractor::imagePixelData):
    (WebCore::GraphicsContext3D::ImageExtractor::imageWidth):
    (WebCore::GraphicsContext3D::ImageExtractor::imageHeight):
    (WebCore::GraphicsContext3D::ImageExtractor::imageSourceFormat):
    (WebCore::GraphicsContext3D::ImageExtractor::imageAlphaOp):
    (WebCore::GraphicsContext3D::ImageExtractor::imageSourceUnpackAlignment):
    * platform/graphics/NativeImagePtr.h:
    * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
    (WebCore::GraphicsContext3D::ImageExtractor::~ImageExtractor):
    (WebCore):
    (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
    * platform/graphics/cg/GraphicsContext3DCG.cpp:
    (WebCore::GraphicsContext3D::ImageExtractor::~ImageExtractor):
    (WebCore):
    (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
    * platform/graphics/clutter/GraphicsContext3DClutter.cpp:
    (WebCore::GraphicsContext3D::ImageExtractor::~ImageExtractor):
    (WebCore):
    (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
    * platform/graphics/efl/GraphicsContext3DEfl.cpp:
    (WebCore::GraphicsContext3D::ImageExtractor::~ImageExtractor):
    (WebCore):
    (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
    * platform/graphics/qt/GraphicsContext3DQt.cpp:
    (WebCore::GraphicsContext3D::ImageExtractor::~ImageExtractor):
    (WebCore):
    (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
    * platform/graphics/skia/GraphicsContext3DSkia.cpp:
    (WebCore::GraphicsContext3D::ImageExtractor::~ImageExtractor):
    (WebCore):
    (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@136282 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    9a7a8d2f