Changeset 65921 in webkit


Ignore:
Timestamp:
Aug 24, 2010 12:17:19 PM (14 years ago)
Author:
senorblanco@chromium.org
Message:

2010-08-24 Stephen White <senorblanco@chromium.org>

Reviewed by Kenneth Russell.

Fix accelerated 2d canvas with accelerated compositing off.
https://bugs.webkit.org/show_bug.cgi?id=44525

Tested by running with --enable-accelerated-2d-canvas with
--enable-accelerated-compositing off.
ImageBuffer::copyImage changes covered by
LayoutTests/fast/canvas/canvas-pattern-*.html.

  • html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::paint): Extend the accelerated compositing check and the readback for non-accelerated compositing to accelerated 2D canvas also.
  • html/canvas/CanvasRenderingContext.cpp:
  • html/canvas/CanvasRenderingContext.h: (WebCore::CanvasRenderingContext::paintsIntoCanvasBuffer): Move this logic from WebGL to common canvas context code.
  • html/canvas/WebGLRenderingContext.h: Remove implementation of paintsIntoCanvasBuffer.
  • platform/graphics/skia/ImageBufferSkia.cpp: (WebCore::ImageBuffer::copyImage): When copying the image for patterns, sync the software canvas.
  • platform/graphics/skia/PlatformContextSkia.cpp: (WebCore::PlatformContextSkia::prepareForSoftwareDraw): Use SkDevice::eraseColor() to clear the canvas for mixed mode rendering.
Location:
trunk/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r65919 r65921  
     12010-08-24  Stephen White  <senorblanco@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Fix accelerated 2d canvas with accelerated compositing off.
     6        https://bugs.webkit.org/show_bug.cgi?id=44525
     7
     8        Tested by running with --enable-accelerated-2d-canvas with
     9        --enable-accelerated-compositing off.
     10        ImageBuffer::copyImage changes covered by
     11        LayoutTests/fast/canvas/canvas-pattern-*.html.
     12
     13        * html/HTMLCanvasElement.cpp:
     14        (WebCore::HTMLCanvasElement::paint):
     15        Extend the accelerated compositing check and the readback for
     16        non-accelerated compositing to accelerated 2D canvas also.
     17        * html/canvas/CanvasRenderingContext.cpp:
     18        * html/canvas/CanvasRenderingContext.h:
     19        (WebCore::CanvasRenderingContext::paintsIntoCanvasBuffer):
     20        Move this logic from WebGL to common canvas context code.
     21        * html/canvas/WebGLRenderingContext.h:
     22        Remove implementation of paintsIntoCanvasBuffer.
     23        * platform/graphics/skia/ImageBufferSkia.cpp:
     24        (WebCore::ImageBuffer::copyImage):
     25        When copying the image for patterns, sync the software canvas.
     26        * platform/graphics/skia/PlatformContextSkia.cpp:
     27        (WebCore::PlatformContextSkia::prepareForSoftwareDraw):
     28        Use SkDevice::eraseColor() to clear the canvas for mixed mode rendering.
     29
    1302010-08-24  Adam Barth  <abarth@webkit.org>
    231
  • trunk/WebCore/html/HTMLCanvasElement.cpp

    r65916 r65921  
    273273        return;
    274274   
    275 #if ENABLE(3D_CANVAS)
    276     WebGLRenderingContext* context3D = 0;
    277     if (m_context && m_context->is3d()) {
    278         context3D = static_cast<WebGLRenderingContext*>(m_context.get());
    279         if (!context3D->paintsIntoCanvasBuffer())
     275    if (m_context) {
     276        if (!m_context->paintsIntoCanvasBuffer())
    280277            return;
    281         context3D->paintRenderingResultsToCanvas();
    282     }
    283 #endif
     278        m_context->paintRenderingResultsToCanvas();
     279    }
    284280
    285281    if (hasCreatedImageBuffer()) {
  • trunk/WebCore/html/canvas/CanvasRenderingContext.cpp

    r47645 r65921  
    2626#include "config.h"
    2727#include "CanvasRenderingContext.h"
    28 
     28#if ENABLE(ACCELERATED_2D_CANVAS) || ENABLE(3D_CANVAS)
     29#include "GraphicsContext3D.h"
     30#endif
    2931#include "HTMLCanvasElement.h"
    3032
     
    4648}
    4749
     50bool CanvasRenderingContext::paintsIntoCanvasBuffer() const
     51{
     52#if ENABLE(ACCELERATED_2D_CANVAS) || ENABLE(3D_CANVAS)
     53    if (GraphicsContext3D* context3D = graphicsContext3D())
     54        return context3D->paintsIntoCanvasBuffer();
     55#endif
     56    return true;
     57}
     58
    4859} // namespace WebCore
  • trunk/WebCore/html/canvas/CanvasRenderingContext.h

    r64881 r65921  
    5555
    5656        virtual void paintRenderingResultsToCanvas() {}
     57        bool paintsIntoCanvasBuffer() const;
    5758
    5859    private:
  • trunk/WebCore/html/canvas/WebGLRenderingContext.h

    r65759 r65921  
    286286    void removeObject(WebGLObject*);
    287287
    288     bool paintsIntoCanvasBuffer() const { return m_context->paintsIntoCanvasBuffer(); }
    289 
    290288  private:
    291289    friend class WebGLObject;
  • trunk/WebCore/platform/graphics/skia/ImageBufferSkia.cpp

    r65617 r65921  
    9595PassRefPtr<Image> ImageBuffer::copyImage() const
    9696{
     97    m_context->platformContext()->syncSoftwareCanvas();
    9798    return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), true);
    9899}
  • trunk/WebCore/platform/graphics/skia/PlatformContextSkia.cpp

    r65700 r65921  
    734734        if (m_state->m_xferMode == SkXfermode::kSrcOver_Mode) {
    735735            // Last drawn on hardware; clear out the canvas.
    736             m_canvas->save();
    737             SkRect bounds = {0, 0, m_canvas->getDevice()->width(), m_canvas->getDevice()->height()};
    738             m_canvas->clipRect(bounds, SkRegion::kReplace_Op);
    739             m_canvas->drawARGB(0, 0, 0, 0, SkXfermode::kClear_Mode);
    740             m_canvas->restore();
     736            m_canvas->getDevice()->eraseColor(0);
    741737            // Start compositing into the empty canvas.
    742738            m_backingStoreState = Mixed;
Note: See TracChangeset for help on using the changeset viewer.