aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/views/SkOSWindow_Android.h
blob: 2538a3ea8e7f6d392a9ac4b1bc4a53d924d096ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Copyright 2011 Skia
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkOSWindow_Android_DEFINED
#define SkOSWindow_Android_DEFINED

#include "SkWindow.h"

#include <EGL/egl.h>

struct SkAndroidWindow {
    EGLDisplay fDisplay;
    EGLSurface fSurface;
    EGLContext fContext;
};

class SkOSWindow : public SkWindow {
public:
    SkOSWindow(void*);
    ~SkOSWindow();

    enum SkBackEndTypes {
        kNone_BackEndType,
        kNativeGL_BackEndType,
    };

    bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo* info);
    void detach();
    void present();
    void closeWindow() override;
    void setVsync(bool) override;
    bool destroyRequested() { return fDestroyRequested; }

    virtual void onPDFSaved(const char title[], const char desc[], const char path[]);

protected:
    // overrides from SkWindow
    virtual void onHandleInval(const SkIRect&);
    virtual void onSetTitle(const char title[]);

private:
    SkAndroidWindow fWindow;
    ANativeWindow* fNativeWindow;
    bool fDestroyRequested;

    typedef SkWindow INHERITED;
};

#endif