| 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 import android.widget.Toast; |
| 21 | 22 |
| 22 public class SkiaSampleView extends GLSurfaceView { | 23 public class SkiaSampleView extends GLSurfaceView { |
| 23 | 24 |
| 24 private final SkiaSampleRenderer mSampleRenderer; | 25 private final SkiaSampleRenderer mSampleRenderer; |
| 25 private boolean mRequestedOpenGLAPI; // true == use (desktop) OpenGL. false
== use OpenGL ES. | 26 private boolean mRequestedOpenGLAPI; // true == use (desktop) OpenGL. false
== use OpenGL ES. |
| 26 private int mRequestedMSAASampleCount; | 27 private int mRequestedMSAASampleCount; |
| 27 | 28 |
| 28 public SkiaSampleView(Context ctx, String cmdLineFlags, boolean useOpenGL, i
nt msaaSampleCount) { | 29 public SkiaSampleView(Context ctx, String cmdLineFlags, boolean useOpenGL, i
nt msaaSampleCount) { |
| 29 super(ctx); | 30 super(ctx); |
| 30 | 31 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 }); | 171 }); |
| 171 } | 172 } |
| 172 | 173 |
| 173 public void saveToPDF() { | 174 public void saveToPDF() { |
| 174 queueEvent(new Runnable() { | 175 queueEvent(new Runnable() { |
| 175 @Override | 176 @Override |
| 176 public void run() { | 177 public void run() { |
| 177 mSampleRenderer.saveToPDF(); | 178 mSampleRenderer.saveToPDF(); |
| 178 } | 179 } |
| 179 }); | 180 }); |
| 181 |
| 182 String msg = getContext().getString(R.string.pdf_save_info); |
| 183 Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show(); |
| 180 } | 184 } |
| 181 | 185 |
| 182 public boolean getUsesOpenGLAPI() { | 186 public boolean getUsesOpenGLAPI() { |
| 183 return mRequestedOpenGLAPI; | 187 return mRequestedOpenGLAPI; |
| 184 } | 188 } |
| 185 | 189 |
| 186 public int getMSAASampleCount() { | 190 public int getMSAASampleCount() { |
| 187 return mSampleRenderer.getMSAASampleCount(); | 191 return mSampleRenderer.getMSAASampleCount(); |
| 188 } | 192 } |
| 189 | 193 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 EGLConfig config, int attribute, int defaultValue) { | 301 EGLConfig config, int attribute, int defaultValue) { |
| 298 int[] value = new int[1]; | 302 int[] value = new int[1]; |
| 299 if (egl.eglGetConfigAttrib(display, config, attribute, value)) { | 303 if (egl.eglGetConfigAttrib(display, config, attribute, value)) { |
| 300 return value[0]; | 304 return value[0]; |
| 301 } | 305 } |
| 302 return defaultValue; | 306 return defaultValue; |
| 303 } | 307 } |
| 304 | 308 |
| 305 } | 309 } |
| 306 } | 310 } |
| OLD | NEW |