gfx/angle/src/libEGL/Surface.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/angle/src/libEGL/Surface.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,108 @@
     1.4 +//
     1.5 +// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
     1.6 +// Use of this source code is governed by a BSD-style license that can be
     1.7 +// found in the LICENSE file.
     1.8 +//
     1.9 +
    1.10 +// Surface.h: Defines the egl::Surface class, representing a drawing surface
    1.11 +// such as the client area of a window, including any back buffers.
    1.12 +// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
    1.13 +
    1.14 +#ifndef LIBEGL_SURFACE_H_
    1.15 +#define LIBEGL_SURFACE_H_
    1.16 +
    1.17 +#define EGLAPI
    1.18 +#include <EGL/egl.h>
    1.19 +
    1.20 +#include "common/angleutils.h"
    1.21 +
    1.22 +namespace gl
    1.23 +{
    1.24 +class Texture2D;
    1.25 +}
    1.26 +namespace rx
    1.27 +{
    1.28 +class Renderer;
    1.29 +class SwapChain;
    1.30 +}
    1.31 +
    1.32 +namespace egl
    1.33 +{
    1.34 +class Display;
    1.35 +class Config;
    1.36 +
    1.37 +class Surface
    1.38 +{
    1.39 +  public:
    1.40 +    Surface(Display *display, const egl::Config *config, HWND window, EGLint postSubBufferSupported);
    1.41 +    Surface(Display *display, const egl::Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureTarget);
    1.42 +
    1.43 +    ~Surface();
    1.44 +
    1.45 +    bool initialize();
    1.46 +    void release();
    1.47 +    bool resetSwapChain();
    1.48 +
    1.49 +    HWND getWindowHandle();
    1.50 +    bool swap();
    1.51 +    bool postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height);
    1.52 +
    1.53 +    virtual EGLint getWidth() const;
    1.54 +    virtual EGLint getHeight() const;
    1.55 +
    1.56 +    virtual EGLint isPostSubBufferSupported() const;
    1.57 +
    1.58 +    virtual rx::SwapChain *getSwapChain() const;
    1.59 +
    1.60 +    void setSwapInterval(EGLint interval);
    1.61 +    bool checkForOutOfDateSwapChain();   // Returns true if swapchain changed due to resize or interval update
    1.62 +
    1.63 +    virtual EGLenum getTextureFormat() const;
    1.64 +    virtual EGLenum getTextureTarget() const;
    1.65 +    virtual EGLenum getFormat() const;
    1.66 +
    1.67 +    virtual void setBoundTexture(gl::Texture2D *texture);
    1.68 +    virtual gl::Texture2D *getBoundTexture() const;
    1.69 +
    1.70 +private:
    1.71 +    DISALLOW_COPY_AND_ASSIGN(Surface);
    1.72 +
    1.73 +    Display *const mDisplay;
    1.74 +    rx::Renderer *mRenderer;
    1.75 +
    1.76 +    HANDLE mShareHandle;
    1.77 +    rx::SwapChain *mSwapChain;
    1.78 +
    1.79 +    void subclassWindow();
    1.80 +    void unsubclassWindow();
    1.81 +    bool resizeSwapChain(int backbufferWidth, int backbufferHeight);
    1.82 +    bool resetSwapChain(int backbufferWidth, int backbufferHeight);
    1.83 +    bool swapRect(EGLint x, EGLint y, EGLint width, EGLint height);
    1.84 +
    1.85 +    const HWND mWindow;            // Window that the surface is created for.
    1.86 +    bool mWindowSubclassed;        // Indicates whether we successfully subclassed mWindow for WM_RESIZE hooking
    1.87 +    const egl::Config *mConfig;    // EGL config surface was created with
    1.88 +    EGLint mHeight;                // Height of surface
    1.89 +    EGLint mWidth;                 // Width of surface
    1.90 +//  EGLint horizontalResolution;   // Horizontal dot pitch
    1.91 +//  EGLint verticalResolution;     // Vertical dot pitch
    1.92 +//  EGLBoolean largestPBuffer;     // If true, create largest pbuffer possible
    1.93 +//  EGLBoolean mipmapTexture;      // True if texture has mipmaps
    1.94 +//  EGLint mipmapLevel;            // Mipmap level to render to
    1.95 +//  EGLenum multisampleResolve;    // Multisample resolve behavior
    1.96 +    EGLint mPixelAspectRatio;      // Display aspect ratio
    1.97 +    EGLenum mRenderBuffer;         // Render buffer
    1.98 +    EGLenum mSwapBehavior;         // Buffer swap behavior
    1.99 +    EGLenum mTextureFormat;        // Format of texture: RGB, RGBA, or no texture
   1.100 +    EGLenum mTextureTarget;        // Type of texture: 2D or no texture
   1.101 +//  EGLenum vgAlphaFormat;         // Alpha format for OpenVG
   1.102 +//  EGLenum vgColorSpace;          // Color space for OpenVG
   1.103 +    EGLint mSwapInterval;
   1.104 +    EGLint mPostSubBufferSupported;
   1.105 +    
   1.106 +    bool mSwapIntervalDirty;
   1.107 +    gl::Texture2D *mTexture;
   1.108 +};
   1.109 +}
   1.110 +
   1.111 +#endif   // LIBEGL_SURFACE_H_

mercurial