gfx/gl/GLBlitTextureImageHelper.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/gl/GLBlitTextureImageHelper.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,69 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* vim: set ts=8 sts=4 et sw=4 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef GLBLITTEXTUREIMAGEHELPER_H_
    1.11 +#define GLBLITTEXTUREIMAGEHELPER_H_
    1.12 +
    1.13 +#include "mozilla/Attributes.h"
    1.14 +#include "GLContextTypes.h"
    1.15 +#include "GLConsts.h"
    1.16 +
    1.17 +struct nsIntRect;
    1.18 +
    1.19 +namespace mozilla {
    1.20 +namespace gl {
    1.21 +
    1.22 +class GLContext;
    1.23 +class TextureImage;
    1.24 +
    1.25 +class GLBlitTextureImageHelper MOZ_FINAL
    1.26 +{
    1.27 +    // The GLContext is the sole owner of the GLBlitTextureImageHelper.
    1.28 +    GLContext* mGL;
    1.29 +
    1.30 +    // lazy-initialized things
    1.31 +    GLuint mBlitProgram, mBlitFramebuffer;
    1.32 +    void UseBlitProgram();
    1.33 +    void SetBlitFramebufferForDestTexture(GLuint aTexture);
    1.34 +
    1.35 +public:
    1.36 +
    1.37 +    GLBlitTextureImageHelper(GLContext *gl);
    1.38 +    ~GLBlitTextureImageHelper();
    1.39 +
    1.40 +    /**
    1.41 +     * Copy a rectangle from one TextureImage into another.  The
    1.42 +     * source and destination are given in integer coordinates, and
    1.43 +     * will be converted to texture coordinates.
    1.44 +     *
    1.45 +     * For the source texture, the wrap modes DO apply -- it's valid
    1.46 +     * to use REPEAT or PAD and expect appropriate behaviour if the source
    1.47 +     * rectangle extends beyond its bounds.
    1.48 +     *
    1.49 +     * For the destination texture, the wrap modes DO NOT apply -- the
    1.50 +     * destination will be clipped by the bounds of the texture.
    1.51 +     *
    1.52 +     * Note: calling this function will cause the following OpenGL state
    1.53 +     * to be changed:
    1.54 +     *
    1.55 +     *   - current program
    1.56 +     *   - framebuffer binding
    1.57 +     *   - viewport
    1.58 +     *   - blend state (will be enabled at end)
    1.59 +     *   - scissor state (will be enabled at end)
    1.60 +     *   - vertex attrib 0 and 1 (pointer and enable state [enable state will be disabled at exit])
    1.61 +     *   - array buffer binding (will be 0)
    1.62 +     *   - active texture (will be 0)
    1.63 +     *   - texture 0 binding
    1.64 +     */
    1.65 +    void BlitTextureImage(TextureImage *aSrc, const nsIntRect& aSrcRect,
    1.66 +                          TextureImage *aDst, const nsIntRect& aDstRect);
    1.67 +};
    1.68 +
    1.69 +}
    1.70 +}
    1.71 +
    1.72 +#endif // GLBLITTEXTUREIMAGEHELPER_H_

mercurial