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 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* vim: set ts=8 sts=4 et sw=4 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef GLBLITHELPER_H_ |
michael@0 | 8 | #define GLBLITHELPER_H_ |
michael@0 | 9 | |
michael@0 | 10 | #include "GLContextTypes.h" |
michael@0 | 11 | #include "GLConsts.h" |
michael@0 | 12 | #include "nsSize.h" |
michael@0 | 13 | #include "mozilla/Attributes.h" |
michael@0 | 14 | #include "mozilla/gfx/Point.h" |
michael@0 | 15 | |
michael@0 | 16 | namespace mozilla { |
michael@0 | 17 | namespace gl { |
michael@0 | 18 | |
michael@0 | 19 | class GLContext; |
michael@0 | 20 | |
michael@0 | 21 | /** |
michael@0 | 22 | * Helper function that creates a 2D texture aSize.width x aSize.height with |
michael@0 | 23 | * storage type specified by aFormats. Returns GL texture object id. |
michael@0 | 24 | * |
michael@0 | 25 | * See mozilla::gl::CreateTexture. |
michael@0 | 26 | */ |
michael@0 | 27 | GLuint CreateTextureForOffscreen(GLContext* aGL, const GLFormats& aFormats, |
michael@0 | 28 | const gfx::IntSize& aSize); |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * Helper function that creates a 2D texture aSize.width x aSize.height with |
michael@0 | 32 | * storage type aInternalFormat. Returns GL texture object id. |
michael@0 | 33 | * |
michael@0 | 34 | * Initialize textyre parameters to: |
michael@0 | 35 | * GL_TEXTURE_MIN_FILTER = GL_LINEAR |
michael@0 | 36 | * GL_TEXTURE_MAG_FILTER = GL_LINEAR |
michael@0 | 37 | * GL_TEXTURE_WRAP_S = GL_CLAMP_TO_EDGE |
michael@0 | 38 | * GL_TEXTURE_WRAP_T = GL_CLAMP_TO_EDGE |
michael@0 | 39 | */ |
michael@0 | 40 | GLuint CreateTexture(GLContext* aGL, GLenum aInternalFormat, GLenum aFormat, |
michael@0 | 41 | GLenum aType, const gfx::IntSize& aSize); |
michael@0 | 42 | |
michael@0 | 43 | /** |
michael@0 | 44 | * Helper function to create, potentially, multisample render buffers suitable |
michael@0 | 45 | * for offscreen rendering. Buffers of size aSize.width x aSize.height with |
michael@0 | 46 | * storage specified by aFormat. returns GL render buffer object id. |
michael@0 | 47 | */ |
michael@0 | 48 | GLuint CreateRenderbuffer(GLContext* aGL, GLenum aFormat, GLsizei aSamples, |
michael@0 | 49 | const gfx::IntSize& aSize); |
michael@0 | 50 | |
michael@0 | 51 | /** |
michael@0 | 52 | * Helper function to create, potentially, multisample render buffers suitable |
michael@0 | 53 | * for offscreen rendering. Buffers of size aSize.width x aSize.height with |
michael@0 | 54 | * storage specified by aFormats. GL render buffer object ids are returned via |
michael@0 | 55 | * aColorMSRB, aDepthRB, and aStencilRB |
michael@0 | 56 | */ |
michael@0 | 57 | void CreateRenderbuffersForOffscreen(GLContext* aGL, const GLFormats& aFormats, |
michael@0 | 58 | const gfx::IntSize& aSize, bool aMultisample, |
michael@0 | 59 | GLuint* aColorMSRB, GLuint* aDepthRB, |
michael@0 | 60 | GLuint* aStencilRB); |
michael@0 | 61 | |
michael@0 | 62 | |
michael@0 | 63 | /** Buffer blitting helper */ |
michael@0 | 64 | class GLBlitHelper MOZ_FINAL |
michael@0 | 65 | { |
michael@0 | 66 | // The GLContext is the sole owner of the GLBlitHelper. |
michael@0 | 67 | GLContext* mGL; |
michael@0 | 68 | |
michael@0 | 69 | GLuint mTexBlit_Buffer; |
michael@0 | 70 | GLuint mTexBlit_VertShader; |
michael@0 | 71 | GLuint mTex2DBlit_FragShader; |
michael@0 | 72 | GLuint mTex2DRectBlit_FragShader; |
michael@0 | 73 | GLuint mTex2DBlit_Program; |
michael@0 | 74 | GLuint mTex2DRectBlit_Program; |
michael@0 | 75 | |
michael@0 | 76 | void UseBlitProgram(); |
michael@0 | 77 | void SetBlitFramebufferForDestTexture(GLuint aTexture); |
michael@0 | 78 | |
michael@0 | 79 | bool UseTexQuadProgram(GLenum target, const gfx::IntSize& srcSize); |
michael@0 | 80 | bool InitTexQuadProgram(GLenum target = LOCAL_GL_TEXTURE_2D); |
michael@0 | 81 | void DeleteTexBlitProgram(); |
michael@0 | 82 | |
michael@0 | 83 | public: |
michael@0 | 84 | |
michael@0 | 85 | GLBlitHelper(GLContext* gl); |
michael@0 | 86 | ~GLBlitHelper(); |
michael@0 | 87 | |
michael@0 | 88 | // If you don't have |srcFormats| for the 2nd definition, |
michael@0 | 89 | // then you'll need the framebuffer_blit extensions to use |
michael@0 | 90 | // the first BlitFramebufferToFramebuffer. |
michael@0 | 91 | void BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB, |
michael@0 | 92 | const gfx::IntSize& srcSize, |
michael@0 | 93 | const gfx::IntSize& destSize); |
michael@0 | 94 | void BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB, |
michael@0 | 95 | const gfx::IntSize& srcSize, |
michael@0 | 96 | const gfx::IntSize& destSize, |
michael@0 | 97 | const GLFormats& srcFormats); |
michael@0 | 98 | void BlitTextureToFramebuffer(GLuint srcTex, GLuint destFB, |
michael@0 | 99 | const gfx::IntSize& srcSize, |
michael@0 | 100 | const gfx::IntSize& destSize, |
michael@0 | 101 | GLenum srcTarget = LOCAL_GL_TEXTURE_2D); |
michael@0 | 102 | void BlitFramebufferToTexture(GLuint srcFB, GLuint destTex, |
michael@0 | 103 | const gfx::IntSize& srcSize, |
michael@0 | 104 | const gfx::IntSize& destSize, |
michael@0 | 105 | GLenum destTarget = LOCAL_GL_TEXTURE_2D); |
michael@0 | 106 | void BlitTextureToTexture(GLuint srcTex, GLuint destTex, |
michael@0 | 107 | const gfx::IntSize& srcSize, |
michael@0 | 108 | const gfx::IntSize& destSize, |
michael@0 | 109 | GLenum srcTarget = LOCAL_GL_TEXTURE_2D, |
michael@0 | 110 | GLenum destTarget = LOCAL_GL_TEXTURE_2D); |
michael@0 | 111 | }; |
michael@0 | 112 | |
michael@0 | 113 | } |
michael@0 | 114 | } |
michael@0 | 115 | |
michael@0 | 116 | #endif // GLBLITHELPER_H_ |