Sat, 03 Jan 2015 20:18:00 +0100
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.
michael@0 | 1 | // |
michael@0 | 2 | // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. |
michael@0 | 3 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | // found in the LICENSE file. |
michael@0 | 5 | // |
michael@0 | 6 | |
michael@0 | 7 | // Blit.cpp: Surface copy utility class. |
michael@0 | 8 | |
michael@0 | 9 | #ifndef LIBGLESV2_BLIT_H_ |
michael@0 | 10 | #define LIBGLESV2_BLIT_H_ |
michael@0 | 11 | |
michael@0 | 12 | #include "common/angleutils.h" |
michael@0 | 13 | |
michael@0 | 14 | namespace gl |
michael@0 | 15 | { |
michael@0 | 16 | class Framebuffer; |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | namespace rx |
michael@0 | 20 | { |
michael@0 | 21 | class Renderer9; |
michael@0 | 22 | class TextureStorageInterface2D; |
michael@0 | 23 | class TextureStorageInterfaceCube; |
michael@0 | 24 | |
michael@0 | 25 | class Blit |
michael@0 | 26 | { |
michael@0 | 27 | public: |
michael@0 | 28 | explicit Blit(Renderer9 *renderer); |
michael@0 | 29 | ~Blit(); |
michael@0 | 30 | |
michael@0 | 31 | // Copy from source surface to dest surface. |
michael@0 | 32 | // sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left) |
michael@0 | 33 | bool copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level); |
michael@0 | 34 | bool copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level); |
michael@0 | 35 | |
michael@0 | 36 | // Copy from source surface to dest surface. |
michael@0 | 37 | // sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left) |
michael@0 | 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. |
michael@0 | 39 | bool formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest); |
michael@0 | 40 | |
michael@0 | 41 | // 2x2 box filter sample from source to dest. |
michael@0 | 42 | // Requires that source is RGB(A) and dest has the same format as source. |
michael@0 | 43 | bool boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest); |
michael@0 | 44 | |
michael@0 | 45 | private: |
michael@0 | 46 | rx::Renderer9 *mRenderer; |
michael@0 | 47 | |
michael@0 | 48 | IDirect3DVertexBuffer9 *mQuadVertexBuffer; |
michael@0 | 49 | IDirect3DVertexDeclaration9 *mQuadVertexDeclaration; |
michael@0 | 50 | |
michael@0 | 51 | void initGeometry(); |
michael@0 | 52 | |
michael@0 | 53 | bool setFormatConvertShaders(GLenum destFormat); |
michael@0 | 54 | |
michael@0 | 55 | bool copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest); |
michael@0 | 56 | IDirect3DTexture9 *copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect); |
michael@0 | 57 | void setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset); |
michael@0 | 58 | void setCommonBlitState(); |
michael@0 | 59 | RECT getSurfaceRect(IDirect3DSurface9 *surface) const; |
michael@0 | 60 | |
michael@0 | 61 | // This enum is used to index mCompiledShaders and mShaderSource. |
michael@0 | 62 | enum ShaderId |
michael@0 | 63 | { |
michael@0 | 64 | SHADER_VS_STANDARD, |
michael@0 | 65 | SHADER_VS_FLIPY, |
michael@0 | 66 | SHADER_PS_PASSTHROUGH, |
michael@0 | 67 | SHADER_PS_LUMINANCE, |
michael@0 | 68 | SHADER_PS_COMPONENTMASK, |
michael@0 | 69 | SHADER_COUNT |
michael@0 | 70 | }; |
michael@0 | 71 | |
michael@0 | 72 | // This actually contains IDirect3DVertexShader9 or IDirect3DPixelShader9 casted to IUnknown. |
michael@0 | 73 | IUnknown *mCompiledShaders[SHADER_COUNT]; |
michael@0 | 74 | |
michael@0 | 75 | template <class D3DShaderType> |
michael@0 | 76 | bool setShader(ShaderId source, const char *profile, |
michael@0 | 77 | D3DShaderType *(Renderer9::*createShader)(const DWORD *, size_t length), |
michael@0 | 78 | HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*)); |
michael@0 | 79 | |
michael@0 | 80 | bool setVertexShader(ShaderId shader); |
michael@0 | 81 | bool setPixelShader(ShaderId shader); |
michael@0 | 82 | void render(); |
michael@0 | 83 | |
michael@0 | 84 | void saveState(); |
michael@0 | 85 | void restoreState(); |
michael@0 | 86 | IDirect3DStateBlock9 *mSavedStateBlock; |
michael@0 | 87 | IDirect3DSurface9 *mSavedRenderTarget; |
michael@0 | 88 | IDirect3DSurface9 *mSavedDepthStencil; |
michael@0 | 89 | |
michael@0 | 90 | DISALLOW_COPY_AND_ASSIGN(Blit); |
michael@0 | 91 | }; |
michael@0 | 92 | } |
michael@0 | 93 | |
michael@0 | 94 | #endif // LIBGLESV2_BLIT_H_ |