Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/gl/TextureImageEGL.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/. */
5
6
#ifndef TEXTUREIMAGEEGL_H_
7
#define TEXTUREIMAGEEGL_H_
8
9
#include "GLTextureImage.h"
10
11
namespace mozilla {
12
namespace gl {
13
14
class TextureImageEGL final
15
    : public TextureImage
16
{
17
public:
18
    TextureImageEGL(GLuint aTexture,
19
                    const gfx::IntSize& aSize,
20
                    GLenum aWrapMode,
21
                    ContentType aContentType,
22
                    GLContext* aContext,
23
                    Flags aFlags = TextureImage::NoFlags,
24
                    TextureState aTextureState = Created,
25
                    TextureImage::ImageFormat aImageFormat = SurfaceFormat::UNKNOWN);
26
27
    virtual ~TextureImageEGL();
28
29
    virtual bool DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom = gfx::IntPoint(0,0)) override;
30
31
    virtual void BindTexture(GLenum aTextureUnit) override;
32
33
    virtual GLuint GetTextureID() override
34
0
    {
35
0
        // Ensure the texture is allocated before it is used.
36
0
        if (mTextureState == Created) {
37
0
            Resize(mSize);
38
0
        }
39
0
        return mTexture;
40
0
    };
41
42
    virtual void Resize(const gfx::IntSize& aSize) override;
43
44
    bool BindTexImage();
45
46
    bool ReleaseTexImage();
47
48
    virtual bool CreateEGLSurface(gfxASurface* aSurface)
49
0
    {
50
0
        return false;
51
0
    }
52
53
    virtual void DestroyEGLSurface(void);
54
55
protected:
56
    typedef gfxImageFormat ImageFormat;
57
58
    GLContext* mGLContext;
59
60
    gfx::SurfaceFormat mUpdateFormat;
61
    EGLImage mEGLImage;
62
    GLuint mTexture;
63
    EGLSurface mSurface;
64
    EGLConfig mConfig;
65
    TextureState mTextureState;
66
67
    bool mBound;
68
};
69
70
already_AddRefed<TextureImage>
71
CreateTextureImageEGL(GLContext* gl,
72
                      const gfx::IntSize& aSize,
73
                      TextureImage::ContentType aContentType,
74
                      GLenum aWrapMode,
75
                      TextureImage::Flags aFlags,
76
                      TextureImage::ImageFormat aImageFormat);
77
78
already_AddRefed<TextureImage>
79
TileGenFuncEGL(GLContext* gl,
80
               const gfx::IntSize& aSize,
81
               TextureImage::ContentType aContentType,
82
               TextureImage::Flags aFlags,
83
               TextureImage::ImageFormat aImageFormat);
84
85
} // namespace gl
86
} // namespace mozilla
87
88
#endif // TEXTUREIMAGEEGL_H_