| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 * Link the texture data for cursor if {@link mReloadTexture} is true. | 133 * Link the texture data for cursor if {@link mReloadTexture} is true. |
| 134 * Invoked from {@link com.google.vrtoolkit.cardboard.CardboardView.StereoRe
nderer.onNewFrame} | 134 * Invoked from {@link com.google.vrtoolkit.cardboard.CardboardView.StereoRe
nderer.onNewFrame} |
| 135 */ | 135 */ |
| 136 public void maybeLoadTexture(Desktop desktop) { | 136 public void maybeLoadTexture(Desktop desktop) { |
| 137 synchronized (mReloadTextureLock) { | 137 synchronized (mReloadTextureLock) { |
| 138 if (!mReloadTexture || !desktop.hasVideoFrame()) { | 138 if (!mReloadTexture || !desktop.hasVideoFrame()) { |
| 139 return; | 139 return; |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 Bitmap cursorBitmap = mClient.getCursorBitmap(); | 143 Bitmap cursorBitmap = mClient.getDisplay().getCursorBitmap(); |
| 144 | 144 |
| 145 if (cursorBitmap == mCursorBitmap) { | 145 if (cursorBitmap == mCursorBitmap) { |
| 146 // Case when cursor image has not changed. | 146 // Case when cursor image has not changed. |
| 147 synchronized (mReloadTextureLock) { | 147 synchronized (mReloadTextureLock) { |
| 148 mReloadTexture = false; | 148 mReloadTexture = false; |
| 149 } | 149 } |
| 150 return; | 150 return; |
| 151 } | 151 } |
| 152 | 152 |
| 153 mCursorBitmap = cursorBitmap; | 153 mCursorBitmap = cursorBitmap; |
| 154 updatePosition(desktop, mCursorBitmap, mClient.getCursorHotspot()); | 154 updatePosition(desktop, mCursorBitmap, mClient.getDisplay().getCursorHot
spot()); |
| 155 | 155 |
| 156 TextureHelper.linkTexture(mTextureDataHandle, cursorBitmap); | 156 TextureHelper.linkTexture(mTextureDataHandle, cursorBitmap); |
| 157 | 157 |
| 158 synchronized (mReloadTextureLock) { | 158 synchronized (mReloadTextureLock) { |
| 159 mReloadTexture = false; | 159 mReloadTexture = false; |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 public boolean hasImageFrame() { | 163 public boolean hasImageFrame() { |
| 164 return mCursorBitmap != null; | 164 return mCursorBitmap != null; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 /* | 237 /* |
| 238 * Clean cursor related opengl data. | 238 * Clean cursor related opengl data. |
| 239 */ | 239 */ |
| 240 public void cleanup() { | 240 public void cleanup() { |
| 241 GLES20.glDeleteShader(mVertexShaderHandle); | 241 GLES20.glDeleteShader(mVertexShaderHandle); |
| 242 GLES20.glDeleteShader(mFragmentShaderHandle); | 242 GLES20.glDeleteShader(mFragmentShaderHandle); |
| 243 GLES20.glDeleteTextures(1, new int[] {mTextureDataHandle}, 0); | 243 GLES20.glDeleteTextures(1, new int[] {mTextureDataHandle}, 0); |
| 244 } | 244 } |
| 245 } | 245 } |
| OLD | NEW |