gfx/gl/GLReadTexImageHelper.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 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim: set ts=8 sts=4 et sw=4 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef GLREADTEXIMAGEHELPER_H_
     8 #define GLREADTEXIMAGEHELPER_H_
    10 #include "GLContextTypes.h"
    11 #include "mozilla/Attributes.h"
    12 #include "nsSize.h"
    13 #include "nsAutoPtr.h"
    14 #include "mozilla/RefPtr.h"
    15 #include "mozilla/gfx/Types.h"
    17 class gfxImageSurface;
    19 namespace mozilla {
    21 namespace gfx {
    22 class DataSourceSurface;
    23 }
    25 namespace gl {
    27 void ReadPixelsIntoImageSurface(GLContext* aGL, gfxImageSurface* aSurface);
    28 void ReadScreenIntoImageSurface(GLContext* aGL, gfxImageSurface* aSurface);
    30 TemporaryRef<gfx::DataSourceSurface>
    31 ReadBackSurface(GLContext* gl, GLuint aTexture, bool aYInvert, gfx::SurfaceFormat aFormat);
    33 class GLReadTexImageHelper MOZ_FINAL
    34 {
    35     // The GLContext is the sole owner of the GLBlitHelper.
    36     GLContext* mGL;
    38     GLuint mPrograms[4];
    40     GLuint TextureImageProgramFor(GLenum aTextureTarget, int aShader);
    42     bool DidGLErrorOccur(const char* str);
    44 public:
    46     GLReadTexImageHelper(GLContext* gl);
    47     ~GLReadTexImageHelper();
    49     /**
    50       * Read the image data contained in aTexture, and return it as an ImageSurface.
    51       * If GL_RGBA is given as the format, a gfxImageFormat::ARGB32 surface is returned.
    52       * Not implemented yet:
    53       * If GL_RGB is given as the format, a gfxImageFormat::RGB24 surface is returned.
    54       * If GL_LUMINANCE is given as the format, a gfxImageFormat::A8 surface is returned.
    55       *
    56       * THIS IS EXPENSIVE.  It is ridiculously expensive.  Only do this
    57       * if you absolutely positively must, and never in any performance
    58       * critical path.
    59       *
    60       * NOTE: aShaderProgram is really mozilla::layers::ShaderProgramType. It is
    61       * passed as int to eliminate including LayerManagerOGLProgram.h here.
    62       */
    63     TemporaryRef<gfx::DataSourceSurface> ReadTexImage(GLuint aTextureId,
    64                                                       GLenum aTextureTarget,
    65                                                       const gfx::IntSize& aSize,
    66                               /* ShaderProgramType */ int aShaderProgram,
    67                                                       bool aYInvert = false);
    70 };
    72 }
    73 }
    75 #endif

mercurial