2010-08-02 Paul Sawaya <psawaya@apple.com>
[WebKit-https.git] / ANGLE / src / libEGL / Surface.h
1 //
2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6
7 // Surface.h: Defines the egl::Surface class, representing a drawing surface
8 // such as the client area of a window, including any back buffers.
9 // Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
10
11 #ifndef INCLUDE_SURFACE_H_
12 #define INCLUDE_SURFACE_H_
13
14 #define EGLAPI
15 #include <EGL/egl.h>
16 #include <d3d9.h>
17
18 #include "common/angleutils.h"
19
20 namespace egl
21 {
22 class Display;
23 class Config;
24
25 class Surface
26 {
27   public:
28     Surface(Display *display, IDirect3DSwapChain9 *swapChain, IDirect3DSurface9* depthStencil, const egl::Config *config);
29
30     ~Surface();
31
32     HWND getWindowHandle();
33     bool swap();
34
35     virtual EGLint getWidth() const;
36     virtual EGLint getHeight() const;
37
38     virtual IDirect3DSurface9 *getRenderTarget();
39     virtual IDirect3DSurface9 *getDepthStencil();
40
41   private:
42     DISALLOW_COPY_AND_ASSIGN(Surface);
43
44     Display *const mDisplay;
45     IDirect3DSwapChain9 *const mSwapChain;
46     IDirect3DSurface9 *mBackBuffer;
47     IDirect3DSurface9 *mRenderTarget;
48     IDirect3DSurface9 *mDepthStencil;
49     IDirect3DTexture9 *mFlipTexture;
50
51     void applyFlipState(IDirect3DDevice9 *device, IDirect3DTexture9 *source);
52     void restoreState(IDirect3DDevice9 *device);
53     void writeRecordableFlipState(IDirect3DDevice9 *device, IDirect3DTexture9 *source);
54     IDirect3DStateBlock9 *mFlipState;
55     IDirect3DStateBlock9 *mPreFlipState;
56     IDirect3DSurface9 *mPreFlipBackBuffer;
57     IDirect3DSurface9 *mPreFlipDepthStencil;
58
59     const egl::Config *mConfig;    // EGL config surface was created with
60     EGLint mHeight;                // Height of surface
61     EGLint mWidth;                 // Width of surface
62 //  EGLint horizontalResolution;   // Horizontal dot pitch
63 //  EGLint verticalResolution;     // Vertical dot pitch
64 //  EGLBoolean largestPBuffer;     // If true, create largest pbuffer possible
65 //  EGLBoolean mipmapTexture;      // True if texture has mipmaps
66 //  EGLint mipmapLevel;            // Mipmap level to render to
67 //  EGLenum multisampleResolve;    // Multisample resolve behavior
68     EGLint mPixelAspectRatio;      // Display aspect ratio
69     EGLenum mRenderBuffer;         // Render buffer
70     EGLenum mSwapBehavior;         // Buffer swap behavior
71 //  EGLenum textureFormat;         // Format of texture: RGB, RGBA, or no texture
72 //  EGLenum textureTarget;         // Type of texture: 2D or no texture
73 //  EGLenum vgAlphaFormat;         // Alpha format for OpenVG
74 //  EGLenum vgColorSpace;          // Color space for OpenVG
75 };
76 }
77
78 #endif   // INCLUDE_SURFACE_H_