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.
1 /* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef GLUploadHelpers_h_
7 #define GLUploadHelpers_h_
9 #include "GLDefs.h"
10 #include "mozilla/gfx/Types.h"
11 #include "nsPoint.h"
13 class nsIntRegion;
15 namespace mozilla {
17 namespace gfx {
18 class DataSourceSurface;
19 }
21 namespace gl {
23 class GLContext;
25 /**
26 * Creates a RGB/RGBA texture (or uses one provided) and uploads the surface
27 * contents to it within aSrcRect.
28 *
29 * aSrcRect.x/y will be uploaded to 0/0 in the texture, and the size
30 * of the texture with be aSrcRect.width/height.
31 *
32 * If an existing texture is passed through aTexture, it is assumed it
33 * has already been initialised with glTexImage2D (or this function),
34 * and that its size is equal to or greater than aSrcRect + aDstPoint.
35 * You can alternatively set the overwrite flag to true and have a new
36 * texture memory block allocated.
37 *
38 * The aDstPoint parameter is ignored if no texture was provided
39 * or aOverwrite is true.
40 *
41 * \param aData Image data to upload.
42 * \param aDstRegion Region of texture to upload to.
43 * \param aTexture Texture to use, or 0 to have one created for you.
44 * \param aOverwrite Over an existing texture with a new one.
45 * \param aSrcPoint Offset into aSrc where the region's bound's
46 * TopLeft() sits.
47 * \param aPixelBuffer Pass true to upload texture data with an
48 * offset from the base data (generally for pixel buffer objects),
49 * otherwise textures are upload with an absolute pointer to the data.
50 * \param aTextureUnit, the texture unit used temporarily to upload the
51 * surface. This testure may be overridden, clients should not rely on
52 * the contents of this texture after this call or even on this
53 * texture unit being active.
54 * \return Surface format of this texture.
55 */
56 gfx::SurfaceFormat
57 UploadImageDataToTexture(GLContext* gl,
58 unsigned char* aData,
59 int32_t aStride,
60 gfx::SurfaceFormat aFormat,
61 const nsIntRegion& aDstRegion,
62 GLuint& aTexture,
63 bool aOverwrite = false,
64 bool aPixelBuffer = false,
65 GLenum aTextureUnit = LOCAL_GL_TEXTURE0,
66 GLenum aTextureTarget = LOCAL_GL_TEXTURE_2D);
68 /**
69 * Convenience wrapper around UploadImageDataToTexture for gfx::DataSourceSurface's.
70 */
71 gfx::SurfaceFormat
72 UploadSurfaceToTexture(GLContext* gl,
73 gfx::DataSourceSurface *aSurface,
74 const nsIntRegion& aDstRegion,
75 GLuint& aTexture,
76 bool aOverwrite = false,
77 const nsIntPoint& aSrcPoint = nsIntPoint(0, 0),
78 bool aPixelBuffer = false,
79 GLenum aTextureUnit = LOCAL_GL_TEXTURE0,
80 GLenum aTextureTarget = LOCAL_GL_TEXTURE_2D);
82 bool CanUploadSubTextures(GLContext* gl);
83 bool CanUploadNonPowerOfTwo(GLContext* gl);
85 }
86 }
88 #endif