Changeset 66782 in webkit


Ignore:
Timestamp:
Sep 3, 2010 5:58:43 PM (14 years ago)
Author:
jamesr@google.com
Message:

2010-09-03 James Robinson <jamesr@chromium.org>

Reviewed by Kenneth Russell.

Force 2d canvases to be rendered in software when the composite operation isn't source-over
https://bugs.webkit.org/show_bug.cgi?id=45216

The current accelerated 2d canvas implementation is very slow for composite operations other
than the default. This patch forces a canvas to be rendered in software if any other operation
is set until we accelerate the rest.

Tested by any of the fast/canvas tests that use a non-default globalCompositeOperation.

  • html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::setGlobalCompositeOperation):
  • platform/graphics/skia/PlatformContextSkia.cpp: (WebCore::PlatformContextSkia::setSharedGraphicsContext3D):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r66781 r66782  
     12010-09-03  James Robinson  <jamesr@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Force 2d canvases to be rendered in software when the composite operation isn't source-over
     6        https://bugs.webkit.org/show_bug.cgi?id=45216
     7
     8        The current accelerated 2d canvas implementation is very slow for composite operations other
     9        than the default.  This patch forces a canvas to be rendered in software if any other operation
     10        is set until we accelerate the rest.
     11
     12        Tested by any of the fast/canvas tests that use a non-default globalCompositeOperation.
     13
     14        * html/canvas/CanvasRenderingContext2D.cpp:
     15        (WebCore::CanvasRenderingContext2D::setGlobalCompositeOperation):
     16        * platform/graphics/skia/PlatformContextSkia.cpp:
     17        (WebCore::PlatformContextSkia::setSharedGraphicsContext3D):
     18
    1192010-09-03  Paul Sawaya  <psawaya@apple.com>
    220
  • trunk/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r66746 r66782  
    442442        return;
    443443    c->setCompositeOperation(op);
     444#if ENABLE(ACCELERATED_2D_CANVAS)
     445    if (isAccelerated() && op != CompositeSourceOver) {
     446        c->setSharedGraphicsContext3D(0, 0, IntSize());
     447        m_drawingBuffer.clear();
     448        m_context3D.clear();
     449        // Mark as needing a style recalc so our compositing layer can be removed.
     450        canvas()->setNeedsStyleRecalc(SyntheticStyleChange);
     451    }
     452#endif
    444453}
    445454
  • trunk/WebCore/platform/graphics/skia/PlatformContextSkia.cpp

    r66746 r66782  
    699699void PlatformContextSkia::setSharedGraphicsContext3D(SharedGraphicsContext3D* context, DrawingBuffer* drawingBuffer, const WebCore::IntSize& size)
    700700{
    701     m_useGPU = true;
    702     m_gpuCanvas = new GLES2Canvas(context, drawingBuffer, size);
    703     m_uploadTexture.clear();
    704     drawingBuffer->setWillPublishCallback(WillPublishCallbackImpl::create(this));
     701    if (context && drawingBuffer) {
     702        m_useGPU = true;
     703        m_gpuCanvas = new GLES2Canvas(context, drawingBuffer, size);
     704        m_uploadTexture.clear();
     705        drawingBuffer->setWillPublishCallback(WillPublishCallbackImpl::create(this));
     706    } else {
     707        syncSoftwareCanvas();
     708        m_uploadTexture.clear();
     709        m_gpuCanvas.clear();
     710        m_useGPU = false;
     711    }
    705712}
    706713
Note: See TracChangeset for help on using the changeset viewer.