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.

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 GLREADTEXIMAGEHELPER_H_
michael@0 8 #define GLREADTEXIMAGEHELPER_H_
michael@0 9
michael@0 10 #include "GLContextTypes.h"
michael@0 11 #include "mozilla/Attributes.h"
michael@0 12 #include "nsSize.h"
michael@0 13 #include "nsAutoPtr.h"
michael@0 14 #include "mozilla/RefPtr.h"
michael@0 15 #include "mozilla/gfx/Types.h"
michael@0 16
michael@0 17 class gfxImageSurface;
michael@0 18
michael@0 19 namespace mozilla {
michael@0 20
michael@0 21 namespace gfx {
michael@0 22 class DataSourceSurface;
michael@0 23 }
michael@0 24
michael@0 25 namespace gl {
michael@0 26
michael@0 27 void ReadPixelsIntoImageSurface(GLContext* aGL, gfxImageSurface* aSurface);
michael@0 28 void ReadScreenIntoImageSurface(GLContext* aGL, gfxImageSurface* aSurface);
michael@0 29
michael@0 30 TemporaryRef<gfx::DataSourceSurface>
michael@0 31 ReadBackSurface(GLContext* gl, GLuint aTexture, bool aYInvert, gfx::SurfaceFormat aFormat);
michael@0 32
michael@0 33 class GLReadTexImageHelper MOZ_FINAL
michael@0 34 {
michael@0 35 // The GLContext is the sole owner of the GLBlitHelper.
michael@0 36 GLContext* mGL;
michael@0 37
michael@0 38 GLuint mPrograms[4];
michael@0 39
michael@0 40 GLuint TextureImageProgramFor(GLenum aTextureTarget, int aShader);
michael@0 41
michael@0 42 bool DidGLErrorOccur(const char* str);
michael@0 43
michael@0 44 public:
michael@0 45
michael@0 46 GLReadTexImageHelper(GLContext* gl);
michael@0 47 ~GLReadTexImageHelper();
michael@0 48
michael@0 49 /**
michael@0 50 * Read the image data contained in aTexture, and return it as an ImageSurface.
michael@0 51 * If GL_RGBA is given as the format, a gfxImageFormat::ARGB32 surface is returned.
michael@0 52 * Not implemented yet:
michael@0 53 * If GL_RGB is given as the format, a gfxImageFormat::RGB24 surface is returned.
michael@0 54 * If GL_LUMINANCE is given as the format, a gfxImageFormat::A8 surface is returned.
michael@0 55 *
michael@0 56 * THIS IS EXPENSIVE. It is ridiculously expensive. Only do this
michael@0 57 * if you absolutely positively must, and never in any performance
michael@0 58 * critical path.
michael@0 59 *
michael@0 60 * NOTE: aShaderProgram is really mozilla::layers::ShaderProgramType. It is
michael@0 61 * passed as int to eliminate including LayerManagerOGLProgram.h here.
michael@0 62 */
michael@0 63 TemporaryRef<gfx::DataSourceSurface> ReadTexImage(GLuint aTextureId,
michael@0 64 GLenum aTextureTarget,
michael@0 65 const gfx::IntSize& aSize,
michael@0 66 /* ShaderProgramType */ int aShaderProgram,
michael@0 67 bool aYInvert = false);
michael@0 68
michael@0 69
michael@0 70 };
michael@0 71
michael@0 72 }
michael@0 73 }
michael@0 74
michael@0 75 #endif

mercurial