OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chromoting.cardboard; | 5 package org.chromium.chromoting.cardboard; |
6 | 6 |
7 import static org.chromium.chromoting.cardboard.CardboardUtil.makeFloatBuffer; | 7 import static org.chromium.chromoting.cardboard.CardboardUtil.makeFloatBuffer; |
8 import static org.chromium.chromoting.cardboard.CardboardUtil.makeRectangularTex
tureBuffer; | 8 import static org.chromium.chromoting.cardboard.CardboardUtil.makeRectangularTex
tureBuffer; |
9 | 9 |
10 import android.graphics.Bitmap; | 10 import android.graphics.Bitmap; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Lock to allow multithreaded access to mReloadTexture. | 73 // Lock to allow multithreaded access to mReloadTexture. |
74 private final Object mReloadTextureLock = new Object(); | 74 private final Object mReloadTextureLock = new Object(); |
75 | 75 |
76 private Bitmap mCursorBitmap; | 76 private Bitmap mCursorBitmap; |
77 | 77 |
78 // Half width and half height of the cursor. | 78 // Half width and half height of the cursor. |
79 private PointF mHalfFrameSize; | 79 private PointF mHalfFrameSize; |
80 | 80 |
81 private PointF mCursorPosition; | 81 private PointF mCursorPosition; |
82 | 82 |
83 public Cursor(Client client) { | 83 public Cursor(Client client, Display display) { |
84 mClient = client; | 84 mClient = client; |
85 mDisplay = (Display) client.getDisplay(); | 85 mDisplay = display; |
86 mHalfFrameSize = new PointF(0.0f, 0.0f); | 86 mHalfFrameSize = new PointF(0.0f, 0.0f); |
87 mCursorPosition = new PointF(0.0f, 0.0f); | 87 mCursorPosition = new PointF(0.0f, 0.0f); |
88 | 88 |
89 mVertexShaderHandle = | 89 mVertexShaderHandle = |
90 ShaderHelper.compileShader(GLES20.GL_VERTEX_SHADER, VERTEX_SHADE
R); | 90 ShaderHelper.compileShader(GLES20.GL_VERTEX_SHADER, VERTEX_SHADE
R); |
91 mFragmentShaderHandle = | 91 mFragmentShaderHandle = |
92 ShaderHelper.compileShader(GLES20.GL_FRAGMENT_SHADER, FRAGMENT_S
HADER); | 92 ShaderHelper.compileShader(GLES20.GL_FRAGMENT_SHADER, FRAGMENT_S
HADER); |
93 mProgramHandle = ShaderHelper.createAndLinkProgram(mVertexShaderHandle, | 93 mProgramHandle = ShaderHelper.createAndLinkProgram(mVertexShaderHandle, |
94 mFragmentShaderHandle, new String[] {"a_Position", "a_TexCoordin
ate", | 94 mFragmentShaderHandle, new String[] {"a_Position", "a_TexCoordin
ate", |
95 "u_CombinedMatrix", "u_Texture"}); | 95 "u_CombinedMatrix", "u_Texture"}); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 239 |
240 /* | 240 /* |
241 * Clean cursor related opengl data. | 241 * Clean cursor related opengl data. |
242 */ | 242 */ |
243 public void cleanup() { | 243 public void cleanup() { |
244 GLES20.glDeleteShader(mVertexShaderHandle); | 244 GLES20.glDeleteShader(mVertexShaderHandle); |
245 GLES20.glDeleteShader(mFragmentShaderHandle); | 245 GLES20.glDeleteShader(mFragmentShaderHandle); |
246 GLES20.glDeleteTextures(1, new int[] {mTextureDataHandle}, 0); | 246 GLES20.glDeleteTextures(1, new int[] {mTextureDataHandle}, 0); |
247 } | 247 } |
248 } | 248 } |
OLD | NEW |