blob: ac112c4462753b91cb637a276a2a13b27b62da6e [file] [log] [blame]
Dan Stozacb1fcde2013-12-03 12:37:36 -08001/*
2 * Copyright 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_SURFACE_TEXTURE_GL_H
18#define ANDROID_SURFACE_TEXTURE_GL_H
19
20#include "GLTest.h"
21
22#include "FrameWaiter.h"
23#include "TextureRenderer.h"
24
25#include <gui/GLConsumer.h>
26#include <gui/Surface.h>
27
28namespace android {
29
30class FrameWaiter;
31class GLConsumer;
32class TextureRenderer;
33
34class SurfaceTextureGLTest : public GLTest {
35protected:
36 enum { TEX_ID = 123 };
37
38 void SetUp() {
39 GLTest::SetUp();
40 sp<BufferQueue> bq = new BufferQueue();
41 mBQ = bq;
42 mST = new GLConsumer(bq, TEX_ID);
43 mSTC = new Surface(bq);
44 mANW = mSTC;
45 mTextureRenderer = new TextureRenderer(TEX_ID, mST);
46 ASSERT_NO_FATAL_FAILURE(mTextureRenderer->SetUp());
47 mFW = new FrameWaiter;
48 mST->setFrameAvailableListener(mFW);
49 }
50
51 void TearDown() {
52 mTextureRenderer.clear();
53 mANW.clear();
54 mSTC.clear();
55 mST.clear();
56 GLTest::TearDown();
57 }
58
59 void drawTexture() {
60 mTextureRenderer->drawTexture();
61 }
62
63 sp<BufferQueue> mBQ;
64 sp<GLConsumer> mST;
65 sp<Surface> mSTC;
66 sp<ANativeWindow> mANW;
67 sp<TextureRenderer> mTextureRenderer;
68 sp<FrameWaiter> mFW;
69};
70
71} // namespace android
72
73#endif