Changeset 84374 in webkit


Ignore:
Timestamp:
Apr 20, 2011 7:54:25 AM (13 years ago)
Author:
senorblanco@chromium.org
Message:

2011-04-19 Stephen White <senorblanco@chromium.org>

Reviewed by Kenneth Russell.

Move and rename GLES2Canvas.
https://bugs.webkit.org/show_bug.cgi?id=58927

Move GLES2Canvas to platform/graphcs/gpu, where all the other
gpu-related files live, and rename it to GraphicsContextGPU to better
reflect its purpose.

Covered by existing tests.

  • WebCore.gypi:
  • platform/graphics/chromium/GLES2Canvas.cpp:
  • platform/graphics/chromium/GLES2Canvas.h:
  • platform/graphics/skia/GraphicsContextSkia.cpp: (WebCore::GraphicsContext::fillPath): (WebCore::GraphicsContext::setPlatformShadow):
  • platform/graphics/skia/ImageBufferSkia.cpp:
  • platform/graphics/skia/ImageSkia.cpp: (WebCore::drawBitmapGLES2):
  • platform/graphics/skia/PlatformContextSkia.cpp: (WebCore::PlatformContextSkia::setSharedGraphicsContext3D):
  • platform/graphics/skia/PlatformContextSkia.h: (WebCore::PlatformContextSkia::gpuCanvas):
Location:
trunk/Source/WebCore
Files:
7 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r84373 r84374  
     12011-04-19  Stephen White  <senorblanco@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Move and rename GLES2Canvas.
     6        https://bugs.webkit.org/show_bug.cgi?id=58927
     7
     8        Move GLES2Canvas to platform/graphcs/gpu, where all the other
     9        gpu-related files live, and rename it to GraphicsContextGPU to better
     10        reflect its purpose.
     11
     12        Covered by existing tests.
     13
     14        * WebCore.gypi:
     15        * platform/graphics/chromium/GLES2Canvas.cpp:
     16        * platform/graphics/chromium/GLES2Canvas.h:
     17        * platform/graphics/skia/GraphicsContextSkia.cpp:
     18        (WebCore::GraphicsContext::fillPath):
     19        (WebCore::GraphicsContext::setPlatformShadow):
     20        * platform/graphics/skia/ImageBufferSkia.cpp:
     21        * platform/graphics/skia/ImageSkia.cpp:
     22        (WebCore::drawBitmapGLES2):
     23        * platform/graphics/skia/PlatformContextSkia.cpp:
     24        (WebCore::PlatformContextSkia::setSharedGraphicsContext3D):
     25        * platform/graphics/skia/PlatformContextSkia.h:
     26        (WebCore::PlatformContextSkia::gpuCanvas):
     27
    1282011-04-20  Benjamin Poulain  <benjamin.poulain@nokia.com>
    229
  • trunk/Source/WebCore/WebCore.gypi

    r84228 r84374  
    40124012            'platform/graphics/chromium/FontUtilsChromiumWin.cpp',
    40134013            'platform/graphics/chromium/FontUtilsChromiumWin.h',
    4014             'platform/graphics/chromium/GLES2Canvas.cpp',
    4015             'platform/graphics/chromium/GLES2Canvas.h',
    40164014            'platform/graphics/chromium/GeometryBinding.cpp',
    40174015            'platform/graphics/chromium/GeometryBinding.h',
     
    41514149            'platform/graphics/gpu/DrawingBuffer.cpp',
    41524150            'platform/graphics/gpu/DrawingBuffer.h',
     4151            'platform/graphics/gpu/GraphicsContextGPU.cpp',
     4152            'platform/graphics/gpu/GraphicsContextGPU.h',
    41534153            'platform/graphics/gpu/LoopBlinnClassifier.cpp',
    41544154            'platform/graphics/gpu/LoopBlinnClassifier.h',
  • trunk/Source/WebCore/platform/graphics/gpu/GraphicsContextGPU.cpp

    r84291 r84374  
    3131#include "config.h"
    3232
    33 #include "GLES2Canvas.h"
     33#include "GraphicsContextGPU.h"
    3434
    3535#include "DrawingBuffer.h"
     
    7474};
    7575
    76 struct GLES2Canvas::State {
     76struct GraphicsContextGPU::State {
    7777    State()
    7878        : m_fillColor(0, 0, 0, 255)
     
    195195};
    196196
    197 GLES2Canvas::GLES2Canvas(SharedGraphicsContext3D* context, DrawingBuffer* drawingBuffer, const IntSize& size)
     197GraphicsContextGPU::GraphicsContextGPU(SharedGraphicsContext3D* context, DrawingBuffer* drawingBuffer, const IntSize& size)
    198198    : m_size(size)
    199199    , m_context(context)
     
    210210}
    211211
    212 GLES2Canvas::~GLES2Canvas()
     212GraphicsContextGPU::~GraphicsContextGPU()
    213213{
    214214    if (m_pathIndexBuffer)
     
    218218}
    219219
    220 void GLES2Canvas::bindFramebuffer()
     220void GraphicsContextGPU::bindFramebuffer()
    221221{
    222222    m_drawingBuffer->bind();
    223223}
    224224
    225 void GLES2Canvas::clearRect(const FloatRect& rect)
     225void GraphicsContextGPU::clearRect(const FloatRect& rect)
    226226{
    227227    bindFramebuffer();
     
    236236}
    237237
    238 void GLES2Canvas::applyState()
     238void GraphicsContextGPU::applyState()
    239239{
    240240    bindFramebuffer();
     
    243243}
    244244
    245 void GLES2Canvas::scissorClear(float x, float y, float width, float height)
     245void GraphicsContextGPU::scissorClear(float x, float y, float width, float height)
    246246{
    247247    int intX = static_cast<int>(x + 0.5f);
     
    256256}
    257257
    258 void GLES2Canvas::fillPath(const Path& path)
     258void GraphicsContextGPU::fillPath(const Path& path)
    259259{
    260260    if (m_state->shadowActive()) {
     
    268268}
    269269
    270 void GLES2Canvas::fillRect(const FloatRect& rect, const Color& color, ColorSpace colorSpace)
     270void GraphicsContextGPU::fillRect(const FloatRect& rect, const Color& color, ColorSpace colorSpace)
    271271{
    272272    if (m_state->shadowActive()) {
     
    280280}
    281281
    282 void GLES2Canvas::fillRect(const FloatRect& rect)
     282void GraphicsContextGPU::fillRect(const FloatRect& rect)
    283283{
    284284    fillRect(rect, m_state->applyAlpha(m_state->m_fillColor), ColorSpaceDeviceRGB);
    285285}
    286286
    287 void GLES2Canvas::fillRectInternal(const FloatRect& rect, const Color& color)
     287void GraphicsContextGPU::fillRectInternal(const FloatRect& rect, const Color& color)
    288288{
    289289    AffineTransform matrix(m_flipMatrix);
     
    297297}
    298298
    299 void GLES2Canvas::setFillColor(const Color& color, ColorSpace colorSpace)
     299void GraphicsContextGPU::setFillColor(const Color& color, ColorSpace colorSpace)
    300300{
    301301    m_state->m_fillColor = color;
    302302}
    303303
    304 void GLES2Canvas::setAlpha(float alpha)
     304void GraphicsContextGPU::setAlpha(float alpha)
    305305{
    306306    m_state->m_alpha = alpha;
    307307}
    308308
    309 void GLES2Canvas::setShadowColor(const Color& color, ColorSpace)
     309void GraphicsContextGPU::setShadowColor(const Color& color, ColorSpace)
    310310{
    311311    m_state->m_shadowColor = color;
    312312}
    313313
    314 void GLES2Canvas::setShadowOffset(const FloatSize& offset)
     314void GraphicsContextGPU::setShadowOffset(const FloatSize& offset)
    315315{
    316316    m_state->m_shadowOffset = offset;
    317317}
    318318
    319 void GLES2Canvas::setShadowBlur(float shadowBlur)
     319void GraphicsContextGPU::setShadowBlur(float shadowBlur)
    320320{
    321321    m_state->m_shadowBlur = shadowBlur;
    322322}
    323323
    324 void GLES2Canvas::setShadowsIgnoreTransforms(bool shadowsIgnoreTransforms)
     324void GraphicsContextGPU::setShadowsIgnoreTransforms(bool shadowsIgnoreTransforms)
    325325{
    326326    m_state->m_shadowsIgnoreTransforms = shadowsIgnoreTransforms;
    327327}
    328328
    329 void GLES2Canvas::translate(float x, float y)
     329void GraphicsContextGPU::translate(float x, float y)
    330330{
    331331    m_state->m_ctm.translate(x, y);
    332332}
    333333
    334 void GLES2Canvas::rotate(float angleInRadians)
     334void GraphicsContextGPU::rotate(float angleInRadians)
    335335{
    336336    m_state->m_ctm.rotate(angleInRadians * (180.0f / M_PI));
    337337}
    338338
    339 void GLES2Canvas::scale(const FloatSize& size)
     339void GraphicsContextGPU::scale(const FloatSize& size)
    340340{
    341341    m_state->m_ctm.scale(size.width(), size.height());
    342342}
    343343
    344 void GLES2Canvas::concatCTM(const AffineTransform& affine)
     344void GraphicsContextGPU::concatCTM(const AffineTransform& affine)
    345345{
    346346    m_state->m_ctm *= affine;
    347347}
    348348
    349 void GLES2Canvas::setCTM(const AffineTransform& affine)
     349void GraphicsContextGPU::setCTM(const AffineTransform& affine)
    350350{
    351351    m_state->m_ctm = affine;
    352352}
    353353
    354 void GLES2Canvas::clipPath(const Path& path)
     354void GraphicsContextGPU::clipPath(const Path& path)
    355355{
    356356    bindFramebuffer();
     
    364364}
    365365
    366 void GLES2Canvas::clipOut(const Path& path)
    367 {
    368     ASSERT(!"clipOut is unsupported in GLES2Canvas.\n");
    369 }
    370 
    371 void GLES2Canvas::save()
     366void GraphicsContextGPU::clipOut(const Path& path)
     367{
     368    ASSERT(!"clipOut is unsupported in GraphicsContextGPU.\n");
     369}
     370
     371void GraphicsContextGPU::save()
    372372{
    373373    m_stateStack.append(State(m_stateStack.last()));
     
    375375}
    376376
    377 void GLES2Canvas::restore()
     377void GraphicsContextGPU::restore()
    378378{
    379379    ASSERT(!m_stateStack.isEmpty());
     
    393393}
    394394
    395 void GLES2Canvas::drawTexturedRect(unsigned texture, const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace colorSpace, CompositeOperator compositeOp)
     395void GraphicsContextGPU::drawTexturedRect(unsigned texture, const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace colorSpace, CompositeOperator compositeOp)
    396396{
    397397    bindFramebuffer();
     
    406406}
    407407
    408 void GLES2Canvas::drawTexturedRect(Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace colorSpace, CompositeOperator compositeOp)
     408void GraphicsContextGPU::drawTexturedRect(Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace colorSpace, CompositeOperator compositeOp)
    409409{
    410410    drawTexturedRect(texture, srcRect, dstRect, m_state->m_ctm, m_state->m_alpha, colorSpace, compositeOp, m_state->clippingEnabled());
     
    412412
    413413
    414 void GLES2Canvas::drawTexturedRect(Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha, ColorSpace colorSpace, CompositeOperator compositeOp, bool clip)
     414void GraphicsContextGPU::drawTexturedRect(Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha, ColorSpace colorSpace, CompositeOperator compositeOp, bool clip)
    415415{
    416416    bindFramebuffer();
     
    428428}
    429429
    430 void GLES2Canvas::drawTexturedRectTile(Texture* texture, int tile, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha)
     430void GraphicsContextGPU::drawTexturedRectTile(Texture* texture, int tile, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha)
    431431{
    432432    if (dstRect.isEmpty())
     
    446446}
    447447
    448 void GLES2Canvas::convolveRect(unsigned texture, const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, float imageIncrement[2], const float* kernel, int kernelWidth)
     448void GraphicsContextGPU::convolveRect(unsigned texture, const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, float imageIncrement[2], const float* kernel, int kernelWidth)
    449449{
    450450    m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, texture);
     
    488488}
    489489
    490 void GLES2Canvas::drawTexturedQuad(const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha)
     490void GraphicsContextGPU::drawTexturedQuad(const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha)
    491491{
    492492    AffineTransform matrix(m_flipMatrix);
     
    506506}
    507507
    508 void GLES2Canvas::drawTexturedQuadMitchell(const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha)
     508void GraphicsContextGPU::drawTexturedQuadMitchell(const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha)
    509509{
    510510    static const float mitchellCoefficients[16] = {
     
    536536}
    537537
    538 void GLES2Canvas::setCompositeOperation(CompositeOperator op)
     538void GraphicsContextGPU::setCompositeOperation(CompositeOperator op)
    539539{
    540540    m_state->m_compositeOp = op;
    541541}
    542542
    543 Texture* GLES2Canvas::createTexture(NativeImagePtr ptr, Texture::Format format, int width, int height)
     543Texture* GraphicsContextGPU::createTexture(NativeImagePtr ptr, Texture::Format format, int width, int height)
    544544{
    545545    return m_context->createTexture(ptr, format, width, height);
    546546}
    547547
    548 Texture* GLES2Canvas::getTexture(NativeImagePtr ptr)
     548Texture* GraphicsContextGPU::getTexture(NativeImagePtr ptr)
    549549{
    550550    return m_context->getTexture(ptr);
     
    610610typedef void (*TESSCB)();
    611611
    612 void GLES2Canvas::tesselateAndFillPath(const Path& path, const Color& color)
     612void GraphicsContextGPU::tesselateAndFillPath(const Path& path, const Color& color)
    613613{
    614614    if (!m_pathVertexBuffer)
     
    707707}
    708708
    709 void GLES2Canvas::fillPathInternal(const Path& path, const Color& color)
     709void GraphicsContextGPU::fillPathInternal(const Path& path, const Color& color)
    710710{
    711711    if (SharedGraphicsContext3D::useLoopBlinnForPathRendering()) {
     
    741741}
    742742
    743 FloatRect GLES2Canvas::flipRect(const FloatRect& rect)
     743FloatRect GraphicsContextGPU::flipRect(const FloatRect& rect)
    744744{
    745745    FloatRect flippedRect(rect);
     
    749749}
    750750
    751 void GLES2Canvas::clearBorders(const FloatRect& rect, int width)
     751void GraphicsContextGPU::clearBorders(const FloatRect& rect, int width)
    752752{
    753753    scissorClear(rect.x(), rect.y() - width, rect.width() + width, width);
     
    757757}
    758758
    759 void GLES2Canvas::beginShadowDraw()
     759void GraphicsContextGPU::beginShadowDraw()
    760760{
    761761    float offsetX = m_state->m_shadowOffset.width();
     
    783783}
    784784
    785 void GLES2Canvas::endShadowDraw(const FloatRect& boundingBox)
     785void GraphicsContextGPU::endShadowDraw(const FloatRect& boundingBox)
    786786{
    787787    if (m_state->m_shadowBlur > 0) {
     
    868868}
    869869
    870 void GLES2Canvas::beginStencilDraw(unsigned op)
     870void GraphicsContextGPU::beginStencilDraw(unsigned op)
    871871{
    872872    // Turn on stencil test.
     
    883883}
    884884
    885 void GLES2Canvas::applyClipping(bool enable)
     885void GraphicsContextGPU::applyClipping(bool enable)
    886886{
    887887    m_context->enableStencil(enable);
     
    898898}
    899899
    900 void GLES2Canvas::checkGLError(const char* header)
     900void GraphicsContextGPU::checkGLError(const char* header)
    901901{
    902902#ifndef NDEBUG
  • trunk/Source/WebCore/platform/graphics/gpu/GraphicsContextGPU.h

    r84291 r84374  
    2929 */
    3030
    31 #ifndef GLES2Canvas_h
    32 #define GLES2Canvas_h
     31#ifndef GraphicsContextGPU_h
     32#define GraphicsContextGPU_h
    3333
    3434#include "AffineTransform.h"
     
    5353class SharedGraphicsContext3D;
    5454
    55 class GLES2Canvas {
    56     WTF_MAKE_NONCOPYABLE(GLES2Canvas);
     55class GraphicsContextGPU {
     56    WTF_MAKE_NONCOPYABLE(GraphicsContextGPU);
    5757public:
    58     GLES2Canvas(SharedGraphicsContext3D*, DrawingBuffer*, const IntSize&);
    59     ~GLES2Canvas();
     58    GraphicsContextGPU(SharedGraphicsContext3D*, DrawingBuffer*, const IntSize&);
     59    ~GraphicsContextGPU();
    6060
    6161    void fillPath(const Path&);
     
    138138}
    139139
    140 #endif // GLES2Canvas_h
     140#endif // GraphicsContextGPU_h
  • trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

    r83936 r84374  
    3535#include "Color.h"
    3636#include "FloatRect.h"
    37 #include "GLES2Canvas.h"
    3837#include "Gradient.h"
     38#include "GraphicsContextGPU.h"
    3939#include "GraphicsContextPlatformPrivate.h"
    4040#include "ImageBuffer.h"
     
    734734        return;
    735735
    736     // FIXME: add support to GLES2Canvas for more than just solid fills.
     736    // FIXME: add support to GraphicsContextGPU for more than just solid fills.
    737737    if (platformContext()->useGPU() && platformContext()->canAccelerate()) {
    738738        platformContext()->prepareForHardwareDraw();
     
    10301030
    10311031    if (platformContext()->useGPU()) {
    1032         GLES2Canvas* canvas = platformContext()->gpuCanvas();
     1032        GraphicsContextGPU* canvas = platformContext()->gpuCanvas();
    10331033        canvas->setShadowOffset(size);
    10341034        canvas->setShadowBlur(blurFloat);
  • trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp

    r83960 r84374  
    3838#include "BitmapImageSingleFrameSkia.h"
    3939#include "DrawingBuffer.h"
    40 #include "GLES2Canvas.h"
    4140#include "GraphicsContext.h"
     41#include "GraphicsContextGPU.h"
    4242#include "ImageData.h"
    4343#include "JPEGImageEncoder.h"
  • trunk/Source/WebCore/platform/graphics/skia/ImageSkia.cpp

    r84000 r84374  
    3636#include "FloatConversion.h"
    3737#include "FloatRect.h"
    38 #include "GLES2Canvas.h"
    3938#include "GraphicsContext.h"
     39#include "GraphicsContextGPU.h"
    4040#include "Logging.h"
    4141#include "NativeImageSkia.h"
     
    435435{
    436436    ctxt->platformContext()->prepareForHardwareDraw();
    437     GLES2Canvas* gpuCanvas = ctxt->platformContext()->gpuCanvas();
     437    GraphicsContextGPU* gpuCanvas = ctxt->platformContext()->gpuCanvas();
    438438    Texture* texture = gpuCanvas->getTexture(bitmap);
    439439    if (!texture) {
  • trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp

    r84257 r84374  
    6363
    6464#if ENABLE(ACCELERATED_2D_CANVAS)
    65 #include "GLES2Canvas.h"
     65#include "GraphicsContextGPU.h"
    6666#include "SharedGraphicsContext3D.h"
    6767#endif
     
    730730    if (context && drawingBuffer) {
    731731        m_useGPU = true;
    732         m_gpuCanvas = new GLES2Canvas(context, drawingBuffer, size);
     732        m_gpuCanvas = new GraphicsContextGPU(context, drawingBuffer, size);
    733733        m_uploadTexture.clear();
    734734        drawingBuffer->setWillPublishCallback(WillPublishCallbackImpl::create(this));
  • trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h

    r83941 r84374  
    4747enum CompositeOperator;
    4848class DrawingBuffer;
    49 class GLES2Canvas;
    5049class GraphicsContext3D;
     50class GraphicsContextGPU;
    5151class Texture;
    5252
     
    182182    void setSharedGraphicsContext3D(SharedGraphicsContext3D*, DrawingBuffer*, const IntSize&);
    183183#if ENABLE(ACCELERATED_2D_CANVAS)
    184     GLES2Canvas* gpuCanvas() const { return m_gpuCanvas.get(); }
     184    GraphicsContextGPU* gpuCanvas() const { return m_gpuCanvas.get(); }
    185185#else
    186     GLES2Canvas* gpuCanvas() const { return 0; }
     186    GraphicsContextGPU* gpuCanvas() const { return 0; }
    187187#endif
    188188    // Call these before making a call that manipulates the underlying
    189     // SkCanvas or WebCore::GLES2Canvas
     189    // SkCanvas or WebCore::GraphicsContextGPU
    190190    void prepareForSoftwareDraw() const;
    191191    void prepareForHardwareDraw() const;
     
    224224    bool m_useGPU;
    225225#if ENABLE(ACCELERATED_2D_CANVAS)
    226     OwnPtr<GLES2Canvas> m_gpuCanvas;
     226    OwnPtr<GraphicsContextGPU> m_gpuCanvas;
    227227    mutable RefPtr<Texture> m_uploadTexture;
    228228#endif
Note: See TracChangeset for help on using the changeset viewer.