Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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.SurfaceHolder;
11import android.view.SurfaceView;
12
13@SuppressLint("ViewConstructor")
14class QtSurface extends SurfaceView implements SurfaceHolder.Callback
15{
16 private final QtSurfaceInterface m_surfaceCallback;
17
18 QtSurface(Context context, QtSurfaceInterface surfaceCallback, boolean onTop, int imageDepth)
19 {
20 super(context);
21 setFocusable(false);
22 setFocusableInTouchMode(false);
23 setZOrderMediaOverlay(onTop);
24 m_surfaceCallback = surfaceCallback;
25 SurfaceHolder holder = getHolder();
26 holder.setFormat(imageDepth == 16 ? PixelFormat.RGB_565 : PixelFormat.RGBA_8888);
27 holder.addCallback(this);
28 }
29
30 @Override
31 public void surfaceCreated(SurfaceHolder holder)
32 {
33 if (m_surfaceCallback != null)
34 m_surfaceCallback.onSurfaceChanged(holder.getSurface());
35 }
36
37 @Override
38 public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
39 {
40 // FIXME: this can sometimes cause flicker on orientation change
41 if (m_surfaceCallback != null)
42 m_surfaceCallback.onSurfaceChanged(holder.getSurface());
43 }
44
45 @Override
46 public void surfaceDestroyed(SurfaceHolder holder)
47 {
48 // Once we return from this function, the Surface will be destroyed,
49 // so everything holding a reference to it needs to clean it up before we do that
50 if (m_surfaceCallback != null)
51 m_surfaceCallback.onSurfaceChanged(null);
52 }
53}
QPainter Context
static const QString context()
Definition java.cpp:398
QVideoFrameFormat::PixelFormat PixelFormat
GLint GLsizei width
QT_BEGIN_NAMESPACE typedef void(* Callback)(QQmlNotifierEndpoint *, void **)
EGLint EGLint EGLint format
static bool onTop(QWaylandQuickShellSurfaceItem *surf)