Changeset 55919 in webkit


Ignore:
Timestamp:
Mar 12, 2010 11:11:28 AM (14 years ago)
Author:
jpetsovits@rim.com
Message:

2010-03-12 Jakob Petsovits <jpetsovits@rim.com>

Reviewed by Dirk Schulze.

[OpenVG] Add a SurfaceOpenVG constructor for EGL client buffer surfaces
https://bugs.webkit.org/show_bug.cgi?id=35538

SurfaceOpenVG can now not only encapsulate pbuffer
and window surfaces but also VGImage-based ones.

  • platform/graphics/openvg/EGLDisplayOpenVG.cpp: (WebCore::EGLDisplayOpenVG::createPbufferFromClientBuffer):
  • platform/graphics/openvg/EGLDisplayOpenVG.h:
  • platform/graphics/openvg/SurfaceOpenVG.cpp: (WebCore::SurfaceOpenVG::SurfaceOpenVG):
  • platform/graphics/openvg/SurfaceOpenVG.h:
Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r55917 r55919  
     12010-03-12  Jakob Petsovits  <jpetsovits@rim.com>
     2
     3        Reviewed by Dirk Schulze.
     4
     5        [OpenVG] Add a SurfaceOpenVG constructor for EGL client buffer surfaces
     6        https://bugs.webkit.org/show_bug.cgi?id=35538
     7
     8        SurfaceOpenVG can now not only encapsulate pbuffer
     9        and window surfaces but also VGImage-based ones.
     10
     11        * platform/graphics/openvg/EGLDisplayOpenVG.cpp:
     12        (WebCore::EGLDisplayOpenVG::createPbufferFromClientBuffer):
     13        * platform/graphics/openvg/EGLDisplayOpenVG.h:
     14        * platform/graphics/openvg/SurfaceOpenVG.cpp:
     15        (WebCore::SurfaceOpenVG::SurfaceOpenVG):
     16        * platform/graphics/openvg/SurfaceOpenVG.h:
     17
    1182010-03-12  Alpha Lam  <hclam@chromium.org>
    219
  • trunk/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.cpp

    r53639 r55919  
    264264}
    265265
     266EGLSurface EGLDisplayOpenVG::createPbufferFromClientBuffer(
     267    EGLClientBuffer clientBuffer, EGLenum bufferType, const EGLConfig& config, EGLint* errorCode)
     268{
     269    EGLSurface surface = eglCreatePbufferFromClientBuffer(m_display,
     270        bufferType, clientBuffer, config, 0 /* attribList */);
     271
     272    if (errorCode)
     273        *errorCode = eglGetError();
     274    else
     275        ASSERT_EGL_NO_ERROR();
     276
     277    if (surface == EGL_NO_SURFACE)
     278        return EGL_NO_SURFACE;
     279
     280    EGLint surfaceConfigId;
     281    EGLBoolean success = eglGetConfigAttrib(m_display, config, EGL_CONFIG_ID, &surfaceConfigId);
     282    ASSERT(success == EGL_TRUE);
     283    ASSERT(surfaceConfigId != EGL_BAD_ATTRIBUTE);
     284
     285    ASSERT(!m_surfaceConfigIds.contains(surface));
     286    m_surfaceConfigIds.set(surface, surfaceConfigId);
     287    return surface;
     288}
     289
    266290EGLSurface EGLDisplayOpenVG::surfaceForWindow(EGLNativeWindowType wId, const EGLConfig& config)
    267291{
  • trunk/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.h

    r53639 r55919  
    5252     * will trigger an assertion by itself. */
    5353    EGLSurface createPbufferSurface(const IntSize&, const EGLConfig&, EGLint* errorCode = 0);
     54    EGLSurface createPbufferFromClientBuffer(EGLClientBuffer, EGLenum bufferType, const EGLConfig&, EGLint* errorCode = 0);
    5455
    5556    EGLSurface surfaceForWindow(EGLNativeWindowType, const EGLConfig&);
  • trunk/WebCore/platform/graphics/openvg/SurfaceOpenVG.cpp

    r54063 r55919  
    6565}
    6666
     67SurfaceOpenVG::SurfaceOpenVG(EGLClientBuffer buffer, EGLenum bufferType, const EGLDisplay& display, EGLConfig* confPtr, EGLint* errorCode)
     68    : m_activePainter(0)
     69    , m_eglDisplay(display)
     70    , m_eglSurface(EGL_NO_SURFACE)
     71    , m_eglContext(EGL_NO_CONTEXT)
     72{
     73    ASSERT(m_eglDisplay != EGL_NO_DISPLAY);
     74
     75    EGLDisplayOpenVG* displayManager = EGLDisplayOpenVG::forDisplay(m_eglDisplay);
     76    EGLConfig config = confPtr ? (*confPtr) : displayManager->defaultPbufferConfig();
     77    m_eglSurface = displayManager->createPbufferFromClientBuffer(buffer, bufferType, config, errorCode);
     78
     79    if (m_eglSurface == EGL_NO_SURFACE)
     80        return;
     81
     82    m_eglContext = displayManager->contextForSurface(m_eglSurface);
     83    EGLDisplayOpenVG::registerPlatformSurface(this);
     84}
     85
    6786SurfaceOpenVG::SurfaceOpenVG(EGLNativeWindowType window, const EGLDisplay& display, EGLConfig* confPtr)
    6887    : m_activePainter(0)
  • trunk/WebCore/platform/graphics/openvg/SurfaceOpenVG.h

    r55633 r55919  
    6868
    6969    /**
     70     * Create a new EGL pbuffer surface that will be bound to the given
     71     * client buffer (read: VGImage), with the specified config on the
     72     * given display. If config is not specified, the display's default
     73     * pbuffer config is used.
     74     *
     75     * After the surface is created, you will only be able to access the
     76     * client buffer image if the surface is not current. The recommended way
     77     * to ensure this is to call surface->sharedSurface()->makeCurrent() if you
     78     * simply want to access the image's pixel contents, or if you intend to
     79     * draw the image directly, making the draw target surface current.
     80     *
     81     * This constructor will trigger an assertion if creation of the surface
     82     * fails, unless you pledge to manually process the error code by passing
     83     * a non-zero pointer as errorCode parameter. The error code returned by
     84     * eglGetError() will be written to that variable.
     85     */
     86    SurfaceOpenVG(EGLClientBuffer buffer, EGLenum bufferType,
     87        const EGLDisplay& display, EGLConfig* config = 0, EGLint* errorCode = 0);
     88
     89    /**
    7090     * Create a new EGL window surface with the specified native window handle
    7191     * and config on the given display. If config is not specified, the
Note: See TracChangeset for help on using the changeset viewer.