File tree Expand file tree Collapse file tree 2 files changed +19
-11
lines changed Expand file tree Collapse file tree 2 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -785,8 +785,11 @@ public void onPermissionsGranted() {
785
785
// TODO this is only used by A2D, when finishing up a draw. but if the
786
786
// surfaceview has changed, then it might belong to an a3d surfaceview. hrm.
787
787
public SurfaceHolder getSurfaceHolder () {
788
- return surfaceView .getHolder ();
789
- // return surfaceHolder;
788
+ if (surfaceView != null ) {
789
+ return surfaceView .getHolder ();
790
+ } else {
791
+ return null ;
792
+ }
790
793
}
791
794
792
795
Original file line number Diff line number Diff line change 33
33
import android .graphics .*;
34
34
import android .graphics .Bitmap .Config ;
35
35
import android .graphics .Paint .Style ;
36
+ import android .view .SurfaceHolder ;
36
37
37
38
38
39
/**
@@ -208,17 +209,21 @@ public void endDraw() {
208
209
// }
209
210
210
211
if (primaryGraphics ) {
211
- Canvas screen = null ;
212
- try {
213
- screen = parent .getSurfaceHolder ().lockCanvas (null );
214
- if (screen != null ) {
215
- screen .drawBitmap (bitmap , new Matrix (), null );
216
- }
217
- } finally {
218
- if (screen != null ) {
219
- parent .getSurfaceHolder ().unlockCanvasAndPost (screen );
212
+ SurfaceHolder holder = parent .getSurfaceHolder ();
213
+ if (holder != null ) {
214
+ Canvas screen = null ;
215
+ try {
216
+ screen = holder .lockCanvas (null );
217
+ if (screen != null ) {
218
+ screen .drawBitmap (bitmap , new Matrix (), null );
219
+ }
220
+ } finally {
221
+ if (screen != null ) {
222
+ holder .unlockCanvasAndPost (screen );
223
+ }
220
224
}
221
225
}
226
+
222
227
} else {
223
228
// TODO this is probably overkill for most tasks...
224
229
loadPixels ();
You can’t perform that action at this time.
0 commit comments