Changeset 117379 in webkit


Ignore:
Timestamp:
May 16, 2012 7:18:41 PM (12 years ago)
Author:
jamesr@google.com
Message:

GraphicsContext3D interface should not be aware of CanvasRenderingContext
https://bugs.webkit.org/show_bug.cgi?id=86550

Reviewed by Darin Adler.

Source/WebCore:

GraphicsContext3D is a WebCore/platform API construct. CanvasRenderingContext is a WebCore/html concept. Thus,
the former shouldn't depend on the latter. In turns out that all everyone ever wants from a
CanvasRenderingContext in GraphicsContext3D is its underlying ImageBuffer, which is a WebCore/platform concept,
so this just updates the APIs and implementations to use that instead.

Refactor only, no new tests.

  • html/canvas/WebGLRenderingContext.cpp:

(WebCore::WebGLRenderingContext::paintRenderingResultsToCanvas):

  • platform/graphics/GraphicsContext3D.h:
  • platform/graphics/cairo/DrawingBufferCairo.cpp:

(WebCore::DrawingBuffer::paintCompositedResultsToCanvas):

  • platform/graphics/chromium/DrawingBufferChromium.cpp:

(WebCore::DrawingBuffer::paintCompositedResultsToCanvas):

  • platform/graphics/clutter/DrawingBufferClutter.cpp:

(WebCore::DrawingBuffer::paintCompositedResultsToCanvas):

  • platform/graphics/efl/GraphicsContext3DEfl.cpp:

(WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
(WebCore::GraphicsContext3D::paintCompositedResultsToCanvas):

  • platform/graphics/gpu/DrawingBuffer.h:
  • platform/graphics/gpu/qt/DrawingBufferQt.cpp:

(WebCore::DrawingBuffer::paintCompositedResultsToCanvas):

  • platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:

(WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
(WebCore::GraphicsContext3D::paintCompositedResultsToCanvas):

Source/WebKit/chromium:

Updates chromium implementation of GraphicsContext3D for API change and removes a bunch of unnecessary
#includes.

  • src/GraphicsContext3DChromium.cpp:

(WebCore::GraphicsContext3DPrivate::paintRenderingResultsToCanvas):
(WebCore::GraphicsContext3DPrivate::paintCompositedResultsToCanvas):
(WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):

  • src/GraphicsContext3DPrivate.h:

(GraphicsContext3DPrivate):

Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117377 r117379  
     12012-05-16  James Robinson  <jamesr@chromium.org>
     2
     3        GraphicsContext3D interface should not be aware of CanvasRenderingContext
     4        https://bugs.webkit.org/show_bug.cgi?id=86550
     5
     6        Reviewed by Darin Adler.
     7
     8        GraphicsContext3D is a WebCore/platform API construct. CanvasRenderingContext is a WebCore/html concept. Thus,
     9        the former shouldn't depend on the latter.  In turns out that all everyone ever wants from a
     10        CanvasRenderingContext in GraphicsContext3D is its underlying ImageBuffer, which is a WebCore/platform concept,
     11        so this just updates the APIs and implementations to use that instead.
     12
     13        Refactor only, no new tests.
     14
     15        * html/canvas/WebGLRenderingContext.cpp:
     16        (WebCore::WebGLRenderingContext::paintRenderingResultsToCanvas):
     17        * platform/graphics/GraphicsContext3D.h:
     18        * platform/graphics/cairo/DrawingBufferCairo.cpp:
     19        (WebCore::DrawingBuffer::paintCompositedResultsToCanvas):
     20        * platform/graphics/chromium/DrawingBufferChromium.cpp:
     21        (WebCore::DrawingBuffer::paintCompositedResultsToCanvas):
     22        * platform/graphics/clutter/DrawingBufferClutter.cpp:
     23        (WebCore::DrawingBuffer::paintCompositedResultsToCanvas):
     24        * platform/graphics/efl/GraphicsContext3DEfl.cpp:
     25        (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
     26        (WebCore::GraphicsContext3D::paintCompositedResultsToCanvas):
     27        * platform/graphics/gpu/DrawingBuffer.h:
     28        * platform/graphics/gpu/qt/DrawingBufferQt.cpp:
     29        (WebCore::DrawingBuffer::paintCompositedResultsToCanvas):
     30        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
     31        (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
     32        (WebCore::GraphicsContext3D::paintCompositedResultsToCanvas):
     33
    1342012-05-16  Joshua Bell  <jsbell@chromium.org>
    235
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp

    r116374 r117379  
    691691    // happened after it was composited should be ignored by the compositor.
    692692    if (m_context->layerComposited() && !m_attributes.preserveDrawingBuffer) {
    693         m_context->paintCompositedResultsToCanvas(this);
     693        m_context->paintCompositedResultsToCanvas(canvas()->buffer());
    694694
    695695#if USE(ACCELERATED_COMPOSITING) && PLATFORM(CHROMIUM)
    696696        if (m_drawingBuffer)
    697             m_drawingBuffer->paintCompositedResultsToCanvas(this);
     697            m_drawingBuffer->paintCompositedResultsToCanvas(canvas()->buffer());
    698698#endif
    699699
     
    711711    if (m_drawingBuffer)
    712712        m_drawingBuffer->commit();
    713     m_context->paintRenderingResultsToCanvas(this, m_drawingBuffer.get());
     713    m_context->paintRenderingResultsToCanvas(canvas()->buffer(), m_drawingBuffer.get());
    714714
    715715    if (m_drawingBuffer) {
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r114268 r117379  
    9393
    9494namespace WebCore {
    95 class CanvasRenderingContext;
    9695class DrawingBuffer;
    9796class Extensions3D;
     
    808807    bool layerComposited() const;
    809808
    810     void paintRenderingResultsToCanvas(CanvasRenderingContext*, DrawingBuffer*);
     809    void paintRenderingResultsToCanvas(ImageBuffer*, DrawingBuffer*);
    811810    PassRefPtr<ImageData> paintRenderingResultsToImageData(DrawingBuffer*);
    812     bool paintCompositedResultsToCanvas(CanvasRenderingContext*);
     811    bool paintCompositedResultsToCanvas(ImageBuffer*);
    813812
    814813    // Support for buffer creation and deletion
  • trunk/Source/WebCore/platform/graphics/cairo/DrawingBufferCairo.cpp

    r114961 r117379  
    9999}
    100100
    101 void DrawingBuffer::paintCompositedResultsToCanvas(CanvasRenderingContext* context)
     101void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer*)
    102102{
    103103}
  • trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp

    r114983 r117379  
    207207
    208208#if USE(ACCELERATED_COMPOSITING)
    209 void DrawingBuffer::paintCompositedResultsToCanvas(CanvasRenderingContext* context)
     209void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer* imageBuffer)
    210210{
    211211    if (!m_context->makeContextCurrent() || m_context->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR)
     
    225225
    226226    Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(m_context->getExtensions());
    227     extensions->paintFramebufferToCanvas(framebuffer, framebufferSize.width(), framebufferSize.height(), !m_context->getContextAttributes().premultipliedAlpha, context->canvas()->buffer());
     227    extensions->paintFramebufferToCanvas(framebuffer, framebufferSize.width(), framebufferSize.height(), !m_context->getContextAttributes().premultipliedAlpha, imageBuffer);
    228228    m_context->deleteFramebuffer(framebuffer);
    229229
  • trunk/Source/WebCore/platform/graphics/clutter/DrawingBufferClutter.cpp

    r113493 r117379  
    7272}
    7373
    74 void DrawingBuffer::paintCompositedResultsToCanvas(CanvasRenderingContext* context)
     74void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer*)
    7575{
    7676}
  • trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp

    r109838 r117379  
    726726}
    727727
    728 void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context, DrawingBuffer* drawingBuffer)
     728void GraphicsContext3D::paintRenderingResultsToCanvas(ImageBuffer*, DrawingBuffer* drawingBuffer)
    729729{
    730730    notImplemented();
     
    737737}
    738738
    739 bool GraphicsContext3D::paintCompositedResultsToCanvas(CanvasRenderingContext*)
     739bool GraphicsContext3D::paintCompositedResultsToCanvas(ImageBuffer*)
    740740{
    741741    return false;
  • trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h

    r114983 r117379  
    4545
    4646namespace WebCore {
    47 class CanvasRenderingContext;
    4847class GraphicsContext3D;
    4948class ImageData;
     
    128127    bool requiresCopyFromBackToFrontBuffer() const;
    129128    unsigned frontColorBuffer() const;
    130     void paintCompositedResultsToCanvas(CanvasRenderingContext*);
     129    void paintCompositedResultsToCanvas(ImageBuffer*);
    131130#endif
    132131
  • trunk/Source/WebCore/platform/graphics/gpu/qt/DrawingBufferQt.cpp

    r114961 r117379  
    102102}
    103103
    104 void DrawingBuffer::paintCompositedResultsToCanvas(CanvasRenderingContext* context)
     104void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer*)
    105105{
    106106}
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp

    r114992 r117379  
    3131#include "GraphicsContext3D.h"
    3232
    33 #include "CanvasRenderingContext.h"
    3433#include "Extensions3DOpenGL.h"
    3534#include "GraphicsContext.h"
    36 #include "HTMLCanvasElement.h"
    3735#include "ImageBuffer.h"
    3836#include "ImageData.h"
     
    110108}
    111109
    112 void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context, DrawingBuffer*)
    113 {
    114     HTMLCanvasElement* canvas = context->canvas();
    115     ImageBuffer* imageBuffer = canvas->buffer();
    116 
     110void GraphicsContext3D::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer, DrawingBuffer*)
     111{
    117112    int rowBytes = m_currentWidth * 4;
    118113    int totalBytes = rowBytes * m_currentHeight;
     
    134129
    135130    paintToCanvas(pixels.get(), m_currentWidth, m_currentHeight,
    136                   canvas->width(), canvas->height(), imageBuffer->context()->platformContext());
    137 }
    138 
    139 bool GraphicsContext3D::paintCompositedResultsToCanvas(CanvasRenderingContext*)
     131                  imageBuffer->internalSize().width(), imageBuffer->internalSize().height(), imageBuffer->context()->platformContext());
     132}
     133
     134bool GraphicsContext3D::paintCompositedResultsToCanvas(ImageBuffer*)
    140135{
    141136    // Not needed at the moment, so return that nothing was done.
  • trunk/Source/WebKit/chromium/ChangeLog

    r117341 r117379  
     12012-05-16  James Robinson  <jamesr@chromium.org>
     2
     3        GraphicsContext3D interface should not be aware of CanvasRenderingContext
     4        https://bugs.webkit.org/show_bug.cgi?id=86550
     5
     6        Reviewed by Darin Adler.
     7
     8        Updates chromium implementation of GraphicsContext3D for API change and removes a bunch of unnecessary
     9        #includes.
     10
     11        * src/GraphicsContext3DChromium.cpp:
     12        (WebCore::GraphicsContext3DPrivate::paintRenderingResultsToCanvas):
     13        (WebCore::GraphicsContext3DPrivate::paintCompositedResultsToCanvas):
     14        (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
     15        * src/GraphicsContext3DPrivate.h:
     16        (GraphicsContext3DPrivate):
     17
    1182012-05-16  Joshua Bell  <jsbell@chromium.org>
    219
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp

    r117190 r117379  
    3535#include "GraphicsContext3D.h"
    3636
    37 #include "CachedImage.h"
    38 #include "CanvasRenderingContext.h"
    39 #include "Chrome.h"
    40 #include "ChromeClientImpl.h"
    4137#include "DrawingBuffer.h"
    4238#include "Extensions3DChromium.h"
     
    4440#include "GrGLInterface.h"
    4541#include "GraphicsContext3DPrivate.h"
    46 #include "HTMLCanvasElement.h"
    47 #include "HTMLImageElement.h"
    4842#include "ImageBuffer.h"
    4943#include "ImageData.h"
     
    5448#include <wtf/FastMalloc.h>
    5549#include <wtf/text/CString.h>
     50#include <wtf/text/StringHash.h>
    5651
    5752
     
    257252}
    258253
    259 void GraphicsContext3DPrivate::paintRenderingResultsToCanvas(CanvasRenderingContext* context, DrawingBuffer* drawingBuffer)
    260 {
    261     ImageBuffer* imageBuffer = context->canvas()->buffer();
     254void GraphicsContext3DPrivate::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer, DrawingBuffer* drawingBuffer)
     255{
    262256    Platform3DObject framebufferId;
    263257    int width, height;
     
    266260}
    267261
    268 bool GraphicsContext3DPrivate::paintCompositedResultsToCanvas(CanvasRenderingContext* context)
     262bool GraphicsContext3DPrivate::paintCompositedResultsToCanvas(ImageBuffer*)
    269263{
    270264    return false;
     
    12051199}
    12061200
    1207 void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context, DrawingBuffer* drawingBuffer)
    1208 {
    1209     return m_private->paintRenderingResultsToCanvas(context, drawingBuffer);
     1201void GraphicsContext3D::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer, DrawingBuffer* drawingBuffer)
     1202{
     1203    return m_private->paintRenderingResultsToCanvas(imageBuffer, drawingBuffer);
    12101204}
    12111205
     
    12151209}
    12161210
    1217 DELEGATE_TO_INTERNAL_1R(paintCompositedResultsToCanvas, CanvasRenderingContext*, bool)
     1211DELEGATE_TO_INTERNAL_1R(paintCompositedResultsToCanvas, ImageBuffer*, bool)
    12181212
    12191213DELEGATE_TO_INTERNAL_R(createBuffer, Platform3DObject)
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h

    r117190 r117379  
    7777    void markLayerComposited();
    7878
    79     void paintRenderingResultsToCanvas(CanvasRenderingContext*, DrawingBuffer*);
     79    void paintRenderingResultsToCanvas(ImageBuffer*, DrawingBuffer*);
    8080    void paintFramebufferToCanvas(int framebuffer, int width, int height, bool premultiplyAlpha, ImageBuffer*);
    8181    PassRefPtr<ImageData> paintRenderingResultsToImageData(DrawingBuffer*);
    82     bool paintCompositedResultsToCanvas(CanvasRenderingContext*);
     82    bool paintCompositedResultsToCanvas(ImageBuffer*);
    8383
    8484    void prepareTexture();
Note: See TracChangeset for help on using the changeset viewer.