gfx/angle/src/libGLESv2/renderer/Blit.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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 //
     7 // Blit.cpp: Surface copy utility class.
     9 #ifndef LIBGLESV2_BLIT_H_
    10 #define LIBGLESV2_BLIT_H_
    12 #include "common/angleutils.h"
    14 namespace gl
    15 {
    16 class Framebuffer;
    17 }
    19 namespace rx
    20 {
    21 class Renderer9;
    22 class TextureStorageInterface2D;
    23 class TextureStorageInterfaceCube;
    25 class Blit
    26 {
    27   public:
    28     explicit Blit(Renderer9 *renderer);
    29     ~Blit();
    31     // Copy from source surface to dest surface.
    32     // sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
    33     bool copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level);
    34     bool copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level);
    36     // Copy from source surface to dest surface.
    37     // sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
    38     // source is interpreted as RGBA and destFormat specifies the desired result format. For example, if destFormat = GL_RGB, the alpha channel will be forced to 0.
    39     bool formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest);
    41     // 2x2 box filter sample from source to dest.
    42     // Requires that source is RGB(A) and dest has the same format as source.
    43     bool boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
    45   private:
    46     rx::Renderer9 *mRenderer;
    48     IDirect3DVertexBuffer9 *mQuadVertexBuffer;
    49     IDirect3DVertexDeclaration9 *mQuadVertexDeclaration;
    51     void initGeometry();
    53     bool setFormatConvertShaders(GLenum destFormat);
    55     bool copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest);
    56     IDirect3DTexture9 *copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect);
    57     void setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset);
    58     void setCommonBlitState();
    59     RECT getSurfaceRect(IDirect3DSurface9 *surface) const;
    61     // This enum is used to index mCompiledShaders and mShaderSource.
    62     enum ShaderId
    63     {
    64         SHADER_VS_STANDARD,
    65         SHADER_VS_FLIPY,
    66         SHADER_PS_PASSTHROUGH,
    67         SHADER_PS_LUMINANCE,
    68         SHADER_PS_COMPONENTMASK,
    69         SHADER_COUNT
    70     };
    72     // This actually contains IDirect3DVertexShader9 or IDirect3DPixelShader9 casted to IUnknown.
    73     IUnknown *mCompiledShaders[SHADER_COUNT];
    75     template <class D3DShaderType>
    76     bool setShader(ShaderId source, const char *profile,
    77                    D3DShaderType *(Renderer9::*createShader)(const DWORD *, size_t length),
    78                    HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*));
    80     bool setVertexShader(ShaderId shader);
    81     bool setPixelShader(ShaderId shader);
    82     void render();
    84     void saveState();
    85     void restoreState();
    86     IDirect3DStateBlock9 *mSavedStateBlock;
    87     IDirect3DSurface9 *mSavedRenderTarget;
    88     IDirect3DSurface9 *mSavedDepthStencil;
    90     DISALLOW_COPY_AND_ASSIGN(Blit);
    91 };
    92 }
    94 #endif   // LIBGLESV2_BLIT_H_

mercurial