Changeset 64308 in webkit


Ignore:
Timestamp:
Jul 29, 2010 2:35:23 PM (14 years ago)
Author:
jamesr@google.com
Message:

2010-07-29 James Robinson <jamesr@chromium.org>

Reviewed by Simon Fraser.

Ask a canvas' rendering context if it is accelerated instead tying it directly to webgl
https://bugs.webkit.org/show_bug.cgi?id=43206

This unifies the logic for whether a canvas is accelerated or not into one place
and makes it easier to expand the logic in the future to, for example, cover some
2d canvases.

Just a refactoring, no change in behavior so no new tests.

  • html/canvas/CanvasRenderingContext.h: (WebCore::CanvasRenderingContext::isAccelerated):
  • html/canvas/WebGLRenderingContext.h: (WebCore::WebGLRenderingContext::isAccelerated):
  • rendering/RenderHTMLCanvas.cpp: (WebCore::RenderHTMLCanvas::requiresLayer):
  • rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForCanvas):
Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r64304 r64308  
     12010-07-29  James Robinson  <jamesr@chromium.org>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Ask a canvas' rendering context if it is accelerated instead tying it directly to webgl
     6        https://bugs.webkit.org/show_bug.cgi?id=43206
     7
     8        This unifies the logic for whether a canvas is accelerated or not into one place
     9        and makes it easier to expand the logic in the future to, for example, cover some
     10        2d canvases.
     11
     12        Just a refactoring, no change in behavior so no new tests.
     13
     14        * html/canvas/CanvasRenderingContext.h:
     15        (WebCore::CanvasRenderingContext::isAccelerated):
     16        * html/canvas/WebGLRenderingContext.h:
     17        (WebCore::WebGLRenderingContext::isAccelerated):
     18        * rendering/RenderHTMLCanvas.cpp:
     19        (WebCore::RenderHTMLCanvas::requiresLayer):
     20        * rendering/RenderLayerCompositor.cpp:
     21        (WebCore::RenderLayerCompositor::requiresCompositingForCanvas):
     22
    1232010-07-29  Anders Carlsson  <andersca@apple.com>
    224
  • trunk/WebCore/html/canvas/CanvasRenderingContext.h

    r50181 r64308  
    4747        virtual bool is2d() const { return false; }
    4848        virtual bool is3d() const { return false; }
     49        virtual bool isAccelerated() const { return false; }
    4950
    5051    private:
  • trunk/WebCore/html/canvas/WebGLRenderingContext.h

    r63505 r64308  
    5959
    6060        virtual bool is3d() const { return true; }
     61        virtual bool isAccelerated() const { return true; }
    6162
    6263        // Helper to return the size in bytes of OpenGL data types
  • trunk/WebCore/rendering/RenderHTMLCanvas.cpp

    r47843 r64308  
    2727#include "RenderHTMLCanvas.h"
    2828
     29#include "CanvasRenderingContext.h"
    2930#include "Document.h"
    3031#include "GraphicsContext.h"
     
    4950        return true;
    5051   
    51 #if ENABLE(3D_CANVAS)
    5252    HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(node());
    53     return canvas && canvas->is3D();
    54 #else
    55     return false;
    56 #endif
     53    return canvas && canvas->renderingContext() && canvas->renderingContext()->isAccelerated();
    5754}
    5855
  • trunk/WebCore/rendering/RenderLayerCompositor.cpp

    r64078 r64308  
    3030
    3131#include "AnimationController.h"
     32#include "CanvasRenderingContext.h"
    3233#include "CSSPropertyNames.h"
    3334#include "Chrome.h"
     
    11861187bool RenderLayerCompositor::requiresCompositingForCanvas(RenderObject* renderer) const
    11871188{
    1188 #if ENABLE(3D_CANVAS)   
    11891189    if (renderer->isCanvas()) {
    11901190        HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer->node());
    1191         return canvas->is3D();
    1192     }
    1193 #else
    1194     UNUSED_PARAM(renderer);
    1195 #endif
     1191        return canvas->renderingContext() && canvas->renderingContext()->isAccelerated();
     1192    }
    11961193    return false;
    11971194}
Note: See TracChangeset for help on using the changeset viewer.