Bumping manifests a=b2g-bump
[gecko.git] / gfx / gl / GLBlitTextureImageHelper.h
blob5d1493039c604cbbae29b87eed9f997f6534a8ed
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 GLBLITTEXTUREIMAGEHELPER_H_
8 #define GLBLITTEXTUREIMAGEHELPER_H_
10 #include "mozilla/Attributes.h"
11 #include "GLContextTypes.h"
12 #include "GLConsts.h"
14 struct nsIntRect;
16 namespace mozilla {
17 namespace gl {
19 class GLContext;
20 class TextureImage;
22 class GLBlitTextureImageHelper MOZ_FINAL
24 // The GLContext is the sole owner of the GLBlitTextureImageHelper.
25 GLContext* mGL;
27 // lazy-initialized things
28 GLuint mBlitProgram, mBlitFramebuffer;
29 void UseBlitProgram();
30 void SetBlitFramebufferForDestTexture(GLuint aTexture);
32 public:
34 explicit GLBlitTextureImageHelper(GLContext *gl);
35 ~GLBlitTextureImageHelper();
37 /**
38 * Copy a rectangle from one TextureImage into another. The
39 * source and destination are given in integer coordinates, and
40 * will be converted to texture coordinates.
42 * For the source texture, the wrap modes DO apply -- it's valid
43 * to use REPEAT or PAD and expect appropriate behaviour if the source
44 * rectangle extends beyond its bounds.
46 * For the destination texture, the wrap modes DO NOT apply -- the
47 * destination will be clipped by the bounds of the texture.
49 * Note: calling this function will cause the following OpenGL state
50 * to be changed:
52 * - current program
53 * - framebuffer binding
54 * - viewport
55 * - blend state (will be enabled at end)
56 * - scissor state (will be enabled at end)
57 * - vertex attrib 0 and 1 (pointer and enable state [enable state will be disabled at exit])
58 * - array buffer binding (will be 0)
59 * - active texture (will be 0)
60 * - texture 0 binding
62 void BlitTextureImage(TextureImage *aSrc, const nsIntRect& aSrcRect,
63 TextureImage *aDst, const nsIntRect& aDstRect);
69 #endif // GLBLITTEXTUREIMAGEHELPER_H_