Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QtSurface.java
Go to the documentation of this file.
1// Copyright (C) 2014 BogDan Vatra <bogdan@kde.org>
2// Copyright (C) 2016 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5package org.qtproject.qt.android;
6
7import android.annotation.SuppressLint;
8import android.content.Context;
9import android.graphics.PixelFormat;
10import android.view.Surface;
11import android.view.SurfaceHolder;
12import android.view.SurfaceView;
13
14@SuppressLint("ViewConstructor")
15class QtSurface extends SurfaceView implements SurfaceHolder.Callback
16{
17 private QtSurfaceInterface m_surfaceCallback;
18
19 public QtSurface(Context context, QtSurfaceInterface surfaceCallback, boolean onTop, int imageDepth)
20 {
21 super(context);
22 setFocusable(false);
23 setFocusableInTouchMode(false);
24 setZOrderMediaOverlay(onTop);
25 m_surfaceCallback = surfaceCallback;
26 getHolder().addCallback(this);
27 if (imageDepth == 16)
28 getHolder().setFormat(PixelFormat.RGB_565);
29 else
30 getHolder().setFormat(PixelFormat.RGBA_8888);
31 }
32
33 @Override
34 public void surfaceCreated(SurfaceHolder holder)
35 {
36 }
37
38 @Override
39 public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
40 {
41 if (width < 1 || height < 1)
42 return;
43 if (m_surfaceCallback != null)
44 m_surfaceCallback.onSurfaceChanged(holder.getSurface());
45 }
46
47 @Override
48 public void surfaceDestroyed(SurfaceHolder holder)
49 {
50 if (m_surfaceCallback != null)
51 m_surfaceCallback.onSurfaceChanged(null);
52 }
53}
static void * context
GLint GLsizei GLsizei height
GLint GLsizei width
GLint GLsizei GLsizei GLenum format
static bool onTop(QWaylandQuickShellSurfaceItem *surf)