~mir-team/qtmir/trunk

« back to all changes in this revision

Viewing changes to src/modules/Unity/Application/mirbuffersgtexture.h

  • Committer: Bileto Bot
  • Author(s): Albert Astals Cid, Gerry Boland
  • Date: 2017-03-20 21:15:13 UTC
  • mfrom: (606.4.12 make_sure_surface_not_null)
  • Revision ID: ci-train-bot@canonical.com-20170320211513-z7v3z0ldes3gtcc0
Check for find() result not being null before using it

We do it in onWindowReady, onWindowMoved, onWindowFocusChanged, etc so no reason to not do it in onWindowRemoved

Approved by: Lukáš Tinkl, Unity8 CI Bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#ifndef MIRBUFFERSGTEXTURE_H
18
18
#define MIRBUFFERSGTEXTURE_H
19
19
 
20
 
#include <memory>
 
20
#include "miral/mirbuffer.h"
21
21
 
22
22
#include <QSGTexture>
23
23
 
24
24
#include <QtGui/qopengl.h>
25
25
 
26
 
namespace mir { namespace graphics { class Buffer; }}
27
 
 
28
26
class MirBufferSGTexture : public QSGTexture
29
27
{
30
28
    Q_OBJECT
32
30
    MirBufferSGTexture();
33
31
    virtual ~MirBufferSGTexture();
34
32
 
35
 
    void setBuffer(std::shared_ptr<mir::graphics::Buffer> buffer);
 
33
    void setBuffer(const std::shared_ptr<mir::graphics::Buffer>& buffer);
36
34
    void freeBuffer();
37
35
    bool hasBuffer() const;
38
36
 
44
42
    void bind() override;
45
43
 
46
44
private:
47
 
    std::shared_ptr<mir::graphics::Buffer> m_mirBuffer;
 
45
    miral::GLBuffer m_mirBuffer;
48
46
    int m_width;
49
47
    int m_height;
50
48
    GLuint m_textureId;