| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 package com.skia; | 8 package com.skia; |
| 9 | 9 |
| 10 import javax.microedition.khronos.egl.EGL10; | 10 import javax.microedition.khronos.egl.EGL10; |
| 11 import javax.microedition.khronos.egl.EGLConfig; | 11 import javax.microedition.khronos.egl.EGLConfig; |
| 12 import javax.microedition.khronos.egl.EGLDisplay; | 12 import javax.microedition.khronos.egl.EGLDisplay; |
| 13 import javax.microedition.khronos.opengles.GL10; | 13 import javax.microedition.khronos.opengles.GL10; |
| 14 | 14 |
| 15 import android.content.Context; | 15 import android.content.Context; |
| 16 import android.opengl.EGL14; | 16 import android.opengl.EGL14; |
| 17 import android.opengl.GLSurfaceView; | 17 import android.opengl.GLSurfaceView; |
| 18 import android.os.Build; | 18 import android.os.Build; |
| 19 import android.util.Log; | 19 import android.util.Log; |
| 20 import android.view.MotionEvent; | 20 import android.view.MotionEvent; |
| 21 | 21 |
| 22 public class SkiaSampleView extends GLSurfaceView { | 22 public class SkiaSampleView extends GLSurfaceView { |
| 23 | 23 |
| 24 private final SkiaSampleRenderer mSampleRenderer; | 24 private final SkiaSampleRenderer mSampleRenderer; |
| 25 private boolean mRequestedOpenGLAPI; // true == use (desktop) OpenGL. false
== use OpenGL ES. | 25 private boolean mRequestedOpenGLAPI; // true == use (desktop) OpenGL. false
== use OpenGL ES. |
| 26 private int mRequestedMSAASampleCount; | 26 private int mRequestedMSAASampleCount; |
| 27 | 27 |
| 28 public SkiaSampleView(Context ctx, boolean useOpenGL, int msaaSampleCount) { | 28 public SkiaSampleView(Context ctx, String cmdLineFlags, boolean useOpenGL, i
nt msaaSampleCount) { |
| 29 super(ctx); | 29 super(ctx); |
| 30 | 30 |
| 31 mSampleRenderer = new SkiaSampleRenderer(this); | 31 mSampleRenderer = new SkiaSampleRenderer(this, cmdLineFlags); |
| 32 mRequestedMSAASampleCount = msaaSampleCount; | 32 mRequestedMSAASampleCount = msaaSampleCount; |
| 33 | 33 |
| 34 setEGLContextClientVersion(2); | 34 setEGLContextClientVersion(2); |
| 35 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { | 35 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { |
| 36 setEGLConfigChooser(8, 8, 8, 8, 0, 8); | 36 setEGLConfigChooser(8, 8, 8, 8, 0, 8); |
| 37 } else { | 37 } else { |
| 38 mRequestedOpenGLAPI = useOpenGL; | 38 mRequestedOpenGLAPI = useOpenGL; |
| 39 setEGLConfigChooser(new SampleViewEGLConfigChooser()); | 39 setEGLConfigChooser(new SampleViewEGLConfigChooser()); |
| 40 } | 40 } |
| 41 setRenderer(mSampleRenderer); | 41 setRenderer(mSampleRenderer); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 EGLConfig config, int attribute, int defaultValue) { | 297 EGLConfig config, int attribute, int defaultValue) { |
| 298 int[] value = new int[1]; | 298 int[] value = new int[1]; |
| 299 if (egl.eglGetConfigAttrib(display, config, attribute, value)) { | 299 if (egl.eglGetConfigAttrib(display, config, attribute, value)) { |
| 300 return value[0]; | 300 return value[0]; |
| 301 } | 301 } |
| 302 return defaultValue; | 302 return defaultValue; |
| 303 } | 303 } |
| 304 | 304 |
| 305 } | 305 } |
| 306 } | 306 } |
| OLD | NEW |