├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ ├── color │ │ │ └── view_selector.xml │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ ├── layout │ │ │ └── activity_main.xml │ │ └── drawable │ │ │ └── ic_launcher_background.xml │ │ ├── java │ │ └── com │ │ │ └── rosberry │ │ │ └── view60fps │ │ │ ├── IComposer.java │ │ │ ├── IScene.java │ │ │ ├── ISurfaceHolder.java │ │ │ ├── model │ │ │ ├── Shape.java │ │ │ ├── FillShape.java │ │ │ ├── SceneFrame.java │ │ │ ├── RectShape.java │ │ │ ├── SimpleSceneModel.java │ │ │ ├── StressSceneModel.java │ │ │ └── SceneModelComposer.java │ │ │ ├── SurfaceViewHolder.java │ │ │ ├── TextureViewHolder.java │ │ │ ├── view │ │ │ ├── SquareFrameLayout.java │ │ │ ├── GameView.java │ │ │ ├── GameSurfaceView.java │ │ │ └── GameTextureView.java │ │ │ ├── DrawingThread.java │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml ├── build.gradle └── proguard-rules.pro ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── README.md ├── gradle.properties ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neestell/makeview60fps/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neestell/makeview60fps/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neestell/makeview60fps/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neestell/makeview60fps/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neestell/makeview60fps/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neestell/makeview60fps/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neestell/makeview60fps/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neestell/makeview60fps/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neestell/makeview60fps/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neestell/makeview60fps/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neestell/makeview60fps/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Make60FpsView 3 | Simple view 4 | Surface view 5 | Texture view 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jan 25 17:02:41 OMST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #000 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/IComposer.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps; 2 | 3 | import com.rosberry.view60fps.model.SceneModelComposer; 4 | 5 | /** 6 | * Created by dmitry on 26.01.2018. 7 | */ 8 | 9 | public interface IComposer { 10 | void setComposer(SceneModelComposer modelComposer); 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/res/color/view_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/IScene.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps; 2 | 3 | import com.rosberry.view60fps.model.SceneFrame; 4 | 5 | /** 6 | * Created by dmitry on 01.02.2018. 7 | */ 8 | 9 | public interface IScene { 10 | 11 | void change(int value); 12 | void add(SceneFrame sceneFrame); 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/ISurfaceHolder.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Rect; 5 | 6 | /** 7 | * Created by dmitry on 25.01.2018. 8 | */ 9 | 10 | public interface ISurfaceHolder { 11 | 12 | void unlockCanvasAndPost(Canvas canvas); 13 | Canvas lockCanvas(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/model/Shape.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps.model; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Paint; 5 | 6 | /** 7 | * Created by dmitry on 25.01.2018. 8 | */ 9 | 10 | public abstract class Shape { 11 | protected int color; 12 | 13 | abstract void draw(Canvas canvas, Paint paint); 14 | } 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Make your custom view 60fps 2 | There is an issue with 2D graphic to draw on Canvas. 3 | You can use onDraw() method to obtain a Canvas and draw on it or lockCanvas() and post frames using SurfaceView or TextureView. 4 | But how to decide which one you should choose to solve a task? 5 | This example demonstrates a common interface to interact with 3-types of View, turn on/off Hardware Acceleration or count of shapes to draw. 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/model/FillShape.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps.model; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Paint; 5 | 6 | /** 7 | * Created by dmitry on 25.01.2018. 8 | */ 9 | 10 | class FillShape extends Shape { 11 | 12 | FillShape(int color) { 13 | this.color = color; 14 | } 15 | 16 | @Override 17 | void draw(Canvas canvas, Paint paint) { 18 | paint.setColor(color); 19 | canvas.drawPaint(paint); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/model/SceneFrame.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps.model; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Paint; 5 | 6 | import java.util.ArrayList; 7 | 8 | /** 9 | * Created by dmitry on 25.01.2018. 10 | */ 11 | 12 | public class SceneFrame { 13 | 14 | ArrayList shapes = new ArrayList(); 15 | 16 | void drawOn(Canvas canvas, Paint paint) { 17 | for (Shape shape : shapes) 18 | shape.draw(canvas, paint); 19 | } 20 | 21 | void clear() { 22 | shapes.clear(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/SurfaceViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps; 2 | 3 | import android.graphics.Canvas; 4 | import android.view.SurfaceHolder; 5 | 6 | /** 7 | * Created by dmitry on 25.01.2018. 8 | */ 9 | 10 | public class SurfaceViewHolder implements ISurfaceHolder { 11 | 12 | private final SurfaceHolder surfaceHolder; 13 | 14 | public SurfaceViewHolder(SurfaceHolder surfaceHolder){ 15 | this.surfaceHolder = surfaceHolder; 16 | } 17 | 18 | @Override 19 | public void unlockCanvasAndPost(Canvas canvas) { 20 | surfaceHolder.unlockCanvasAndPost(canvas); 21 | } 22 | 23 | @Override 24 | public Canvas lockCanvas() { 25 | return surfaceHolder.lockCanvas(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | applicationId "com.rosberry.view60fps" 7 | minSdkVersion 19 8 | targetSdkVersion 27 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | implementation 'com.android.support:appcompat-v7:27.0.2' 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/TextureViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps; 2 | 3 | import android.graphics.Canvas; 4 | import android.view.SurfaceHolder; 5 | import android.view.TextureView; 6 | 7 | /** 8 | * Created by dmitry on 25.01.2018. 9 | */ 10 | 11 | public class TextureViewHolder implements ISurfaceHolder { 12 | 13 | private final TextureView textureView; 14 | 15 | public TextureViewHolder(TextureView textureView) { 16 | this.textureView = textureView; 17 | } 18 | 19 | @Override 20 | public void unlockCanvasAndPost(Canvas canvas) { 21 | textureView.unlockCanvasAndPost(canvas); 22 | } 23 | 24 | @Override 25 | public Canvas lockCanvas() { 26 | return textureView.lockCanvas(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/model/RectShape.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps.model; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Color; 5 | import android.graphics.Paint; 6 | import android.graphics.Rect; 7 | 8 | /** 9 | * Created by dmitry on 25.01.2018. 10 | */ 11 | 12 | public class RectShape extends Shape { 13 | 14 | private final int strokeWidth; 15 | final Rect rect; 16 | 17 | RectShape(Rect rect, int strokeWidth) { 18 | this.rect = rect; 19 | this.strokeWidth = strokeWidth; 20 | this.color = Color.BLACK; 21 | 22 | } 23 | 24 | @Override 25 | void draw(Canvas canvas, Paint paint) { 26 | paint.setColor(color); 27 | paint.setStrokeWidth(strokeWidth); 28 | 29 | canvas.drawRect(rect, paint); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/model/SimpleSceneModel.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps.model; 2 | 3 | import android.graphics.Rect; 4 | 5 | import com.rosberry.view60fps.IScene; 6 | 7 | /** 8 | * Created by dmitry on 29.01.2018. 9 | */ 10 | 11 | public class SimpleSceneModel implements IScene { 12 | 13 | private final int size = 10; 14 | private RectShape rectShape = new RectShape(new Rect(0, 0, size , size), 1); 15 | 16 | public void change(int value){ 17 | 18 | rectShape.rect.left = 0; 19 | rectShape.rect.top = 0; 20 | rectShape.rect.right = size * value; 21 | rectShape.rect.bottom = size * value; 22 | 23 | } 24 | 25 | public void add(SceneFrame sceneFrame) { 26 | sceneFrame.shapes.clear(); 27 | sceneFrame.shapes.add(rectShape); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/view/SquareFrameLayout.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps.view; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | import android.support.annotation.Nullable; 6 | import android.util.AttributeSet; 7 | import android.widget.FrameLayout; 8 | 9 | /** 10 | * Created by dmitry on 26.01.2018. 11 | */ 12 | 13 | public class SquareFrameLayout extends FrameLayout { 14 | 15 | public SquareFrameLayout(@NonNull Context context) { 16 | super(context); 17 | } 18 | 19 | public SquareFrameLayout(@NonNull Context context, 20 | @Nullable AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public SquareFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 25 | super(context, attrs, defStyleAttr); 26 | } 27 | 28 | public SquareFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, 29 | int defStyleRes) { 30 | super(context, attrs, defStyleAttr, defStyleRes); 31 | } 32 | 33 | @Override 34 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 35 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 36 | setMeasuredDimension(getMeasuredWidth(), getMeasuredWidth()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/view/GameView.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps.view; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.support.annotation.Nullable; 6 | import android.util.AttributeSet; 7 | import android.util.Log; 8 | import android.view.View; 9 | 10 | import com.rosberry.view60fps.IComposer; 11 | import com.rosberry.view60fps.model.SceneModelComposer; 12 | 13 | /** 14 | * Created by dmitry on 25.01.2018. 15 | */ 16 | 17 | public class GameView extends View implements IComposer { 18 | 19 | private SceneModelComposer sceneComposer; 20 | 21 | public GameView(Context context) { 22 | super(context); 23 | } 24 | 25 | public GameView(Context context, @Nullable AttributeSet attrs) { 26 | super(context, attrs); 27 | } 28 | 29 | public GameView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 30 | super(context, attrs, defStyleAttr); 31 | } 32 | 33 | public GameView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { 34 | super(context, attrs, defStyleAttr, defStyleRes); 35 | } 36 | 37 | public void setSceneComposer(SceneModelComposer sceneComposer){ 38 | this.sceneComposer = sceneComposer; 39 | } 40 | 41 | @Override 42 | protected void onDraw(Canvas canvas) { 43 | if (canvas != null && sceneComposer != null) sceneComposer.drawOn(canvas); 44 | } 45 | 46 | @Override 47 | public void setComposer(SceneModelComposer modelComposer) { 48 | this.sceneComposer = modelComposer; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/model/StressSceneModel.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps.model; 2 | 3 | import android.graphics.Rect; 4 | 5 | import com.rosberry.view60fps.IScene; 6 | 7 | /** 8 | * Created by dmitry on 29.01.2018. 9 | */ 10 | 11 | public class StressSceneModel implements IScene{ 12 | 13 | private Rect bound = new Rect(0, 0, 50, 50); 14 | private SceneFrame frame = new SceneFrame(); 15 | private float step; 16 | 17 | public StressSceneModel(int screenWidth) { 18 | 19 | this.step = screenWidth / (float) bound.width(); 20 | 21 | for (int i = 0; i < bound.width(); i++) { 22 | for (int j = 0; j < bound.height(); j++) { 23 | frame.shapes.add(new RectShape(new Rect(0, 0, 1, 1), 1)); 24 | } 25 | } 26 | 27 | } 28 | 29 | public void change(int value){ 30 | 31 | for (int i = 0; i < bound.width(); i++) { 32 | for (int j = 0; j < bound.height(); j++) { 33 | 34 | int left = (int) (j * step) + value + 1; 35 | int right = (int) (left + step) - 1; 36 | int top = (int) (i * step) + 1; 37 | int bottom = (int) (top + step) - 1; 38 | 39 | RectShape rectShape = (RectShape) frame.shapes.get(i * bound.width() + j); 40 | 41 | rectShape.rect.left = left; 42 | rectShape.rect.top = top; 43 | rectShape.rect.right = right; 44 | rectShape.rect.bottom = bottom; 45 | } 46 | } 47 | } 48 | 49 | public void add(SceneFrame sceneFrame) { 50 | 51 | sceneFrame.shapes.clear(); 52 | sceneFrame.shapes.addAll(frame.shapes); 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/view/GameSurfaceView.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps.view; 2 | 3 | import android.content.Context; 4 | import android.view.SurfaceHolder; 5 | import android.view.SurfaceView; 6 | 7 | import com.rosberry.view60fps.DrawingThread; 8 | import com.rosberry.view60fps.IComposer; 9 | import com.rosberry.view60fps.SurfaceViewHolder; 10 | import com.rosberry.view60fps.model.SceneModelComposer; 11 | 12 | /** 13 | * Created by dmitry on 25.01.2018. 14 | */ 15 | 16 | public class GameSurfaceView extends SurfaceView implements SurfaceHolder.Callback, IComposer { 17 | private SceneModelComposer sceneComposer; 18 | 19 | private DrawingThread drawingThread; 20 | 21 | public GameSurfaceView(Context context) { 22 | super(context); 23 | getHolder().addCallback(this); 24 | } 25 | 26 | @Override 27 | public void surfaceChanged(SurfaceHolder holder, int format, int width, 28 | int height) { 29 | // do something 30 | } 31 | 32 | @Override 33 | public void surfaceCreated(SurfaceHolder holder) { 34 | drawingThread = new DrawingThread(new SurfaceViewHolder(holder)); 35 | drawingThread.setRunning(true); 36 | drawingThread.start(); 37 | drawingThread.setSceneComposer(sceneComposer); 38 | } 39 | 40 | @Override 41 | public void surfaceDestroyed(SurfaceHolder holder) { 42 | boolean retry = true; 43 | 44 | drawingThread.setRunning(false); 45 | 46 | while (retry) { 47 | try { 48 | drawingThread.join(); 49 | retry = false; 50 | } catch (InterruptedException e) { 51 | e.printStackTrace(); 52 | } 53 | } 54 | } 55 | 56 | @Override 57 | public void setComposer(SceneModelComposer modelComposer) { 58 | this.sceneComposer = modelComposer; 59 | if (drawingThread != null) drawingThread.setRunning(false); 60 | } 61 | 62 | @Override 63 | public void invalidate() { 64 | super.invalidate(); 65 | 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/DrawingThread.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps; 2 | 3 | import android.graphics.Canvas; 4 | 5 | import com.rosberry.view60fps.model.SceneModelComposer; 6 | 7 | /** 8 | * Created by dmitry on 25.01.2018. 9 | */ 10 | 11 | public class DrawingThread extends Thread { 12 | private SceneModelComposer sceneComposer; 13 | 14 | private ISurfaceHolder surfaceHolder; 15 | private boolean isRunning = false; 16 | private long previousTime; 17 | private final int fps = 70; 18 | 19 | public DrawingThread(ISurfaceHolder surfaceHolder) { 20 | this.surfaceHolder = surfaceHolder; 21 | 22 | previousTime = System.currentTimeMillis(); 23 | } 24 | 25 | public void setRunning(boolean run) { 26 | isRunning = run; 27 | } 28 | 29 | @Override 30 | public void run() { 31 | Canvas canvas; 32 | 33 | while (isRunning) { 34 | 35 | long currentTimeMillis = System.currentTimeMillis(); 36 | long elapsedTimeMs = currentTimeMillis - previousTime; 37 | long sleepTimeMs = (long) (1000f/ fps - elapsedTimeMs); 38 | 39 | canvas = null; 40 | try { 41 | 42 | canvas = surfaceHolder.lockCanvas(); 43 | 44 | if (canvas == null) { 45 | Thread.sleep(1); 46 | 47 | continue; 48 | 49 | }else if (sleepTimeMs > 0){ 50 | 51 | Thread.sleep(sleepTimeMs); 52 | 53 | } 54 | 55 | synchronized (surfaceHolder) { 56 | sceneComposer.drawOn(canvas); 57 | } 58 | 59 | } catch (Exception e) { 60 | e.printStackTrace(); 61 | } finally { 62 | if (canvas != null) { 63 | surfaceHolder.unlockCanvasAndPost(canvas); 64 | previousTime = System.currentTimeMillis(); 65 | } 66 | } 67 | } 68 | } 69 | 70 | public void setSceneComposer(SceneModelComposer sceneComposer) { 71 | this.sceneComposer = sceneComposer; 72 | } 73 | } -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/view/GameTextureView.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps.view; 2 | 3 | import android.content.Context; 4 | import android.graphics.SurfaceTexture; 5 | import android.view.SurfaceHolder; 6 | import android.view.SurfaceView; 7 | import android.view.TextureView; 8 | 9 | import com.rosberry.view60fps.DrawingThread; 10 | import com.rosberry.view60fps.IComposer; 11 | import com.rosberry.view60fps.SurfaceViewHolder; 12 | import com.rosberry.view60fps.TextureViewHolder; 13 | import com.rosberry.view60fps.model.SceneModelComposer; 14 | 15 | /** 16 | * Created by dmitry on 25.01.2018. 17 | */ 18 | 19 | public class GameTextureView extends TextureView 20 | implements TextureView.SurfaceTextureListener, IComposer { 21 | private SceneModelComposer sceneComposer; 22 | 23 | private DrawingThread drawingThread; 24 | 25 | public GameTextureView(Context context) { 26 | super(context); 27 | setSurfaceTextureListener(this); 28 | } 29 | 30 | 31 | @Override 32 | public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { 33 | drawingThread = new DrawingThread(new TextureViewHolder(this)); 34 | drawingThread.setRunning(true); 35 | drawingThread.start(); 36 | drawingThread.setSceneComposer(sceneComposer); 37 | 38 | } 39 | 40 | @Override 41 | public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { 42 | 43 | } 44 | 45 | @Override 46 | public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { 47 | boolean retry = true; 48 | 49 | drawingThread.setRunning(false); 50 | 51 | while (retry) { 52 | try { 53 | drawingThread.join(); 54 | retry = false; 55 | } catch (InterruptedException e) { 56 | e.printStackTrace(); 57 | } 58 | } 59 | return false; 60 | } 61 | 62 | @Override 63 | public void onSurfaceTextureUpdated(SurfaceTexture surface) { 64 | 65 | } 66 | 67 | @Override 68 | public void setComposer(SceneModelComposer modelComposer) { 69 | sceneComposer = modelComposer; 70 | if (drawingThread != null) drawingThread.setRunning(false); 71 | } 72 | 73 | @Override 74 | public void invalidate() { 75 | super.invalidate(); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/model/SceneModelComposer.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps.model; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Color; 5 | import android.graphics.Paint; 6 | import android.util.Log; 7 | 8 | import com.rosberry.view60fps.IScene; 9 | 10 | import java.util.LinkedList; 11 | 12 | /** 13 | * Created by dmitry on 25.01.2018. 14 | */ 15 | 16 | public class SceneModelComposer { 17 | 18 | private LinkedList drawnFrames = new LinkedList<>(); 19 | private LinkedList bufferedFrames = new LinkedList<>(); 20 | private final Paint paint = new Paint() { 21 | 22 | { 23 | setStyle(Paint.Style.FILL); 24 | } 25 | }; 26 | private final int countFrames = 120; 27 | private final SceneFrame initialFrame = new SceneFrame() { 28 | 29 | { 30 | shapes.add(new FillShape(Color.WHITE)); 31 | } 32 | 33 | }; 34 | 35 | private IScene sceneModel = null; 36 | private int value; 37 | 38 | public SceneModelComposer(int widthPixels) { 39 | 40 | sceneModel = new StressSceneModel(widthPixels); 41 | 42 | for (int i = 0; i < countFrames; i++) 43 | drawnFrames.add(new SceneFrame()); 44 | } 45 | 46 | public synchronized void drawOn(Canvas canvas) { 47 | 48 | synchronized (paint) { 49 | initialFrame.drawOn(canvas, paint); 50 | 51 | if (bufferedFrames.size() > 0) { 52 | 53 | SceneFrame frame = null; 54 | boolean keepLastFrame = true; 55 | 56 | if (bufferedFrames.size() > 1) { 57 | 58 | keepLastFrame = false; 59 | frame = bufferedFrames.removeLast(); 60 | 61 | } else 62 | 63 | frame = bufferedFrames.getLast(); 64 | 65 | frame.drawOn(canvas, paint); 66 | 67 | if (!keepLastFrame) { 68 | drawnFrames.addLast(frame); 69 | frame.clear(); 70 | } 71 | } 72 | } 73 | } 74 | 75 | public void changeModel(int value) { 76 | this.value = value; 77 | if (drawnFrames.size() == 0) 78 | return; 79 | 80 | sceneModel.change(value); 81 | SceneFrame sceneFrame = drawnFrames.removeFirst(); 82 | sceneModel.add(sceneFrame); 83 | 84 | bufferedFrames.addFirst(sceneFrame); 85 | 86 | } 87 | 88 | public void invalidate() { 89 | changeModel(value); 90 | } 91 | 92 | public void setSceneModel(IScene sceneModel) { 93 | this.sceneModel = sceneModel; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 16 | 24 | 25 | 31 | 32 | 38 | 39 | 45 | 46 | 52 | 53 | 54 | 61 | 62 | 71 | 72 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /app/src/main/java/com/rosberry/view60fps/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.rosberry.view60fps; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | import android.widget.CheckBox; 7 | import android.widget.CompoundButton; 8 | import android.widget.RadioGroup; 9 | import android.widget.SeekBar; 10 | 11 | import com.rosberry.view60fps.model.SceneModelComposer; 12 | import com.rosberry.view60fps.model.SimpleSceneModel; 13 | import com.rosberry.view60fps.model.StressSceneModel; 14 | import com.rosberry.view60fps.view.GameSurfaceView; 15 | import com.rosberry.view60fps.view.GameTextureView; 16 | import com.rosberry.view60fps.view.GameView; 17 | import com.rosberry.view60fps.view.SquareFrameLayout; 18 | 19 | public class MainActivity extends AppCompatActivity implements SeekBar.OnSeekBarChangeListener, 20 | CompoundButton.OnCheckedChangeListener, 21 | RadioGroup.OnCheckedChangeListener { 22 | 23 | SquareFrameLayout continer; 24 | SceneModelComposer sceneModelComposer; 25 | IComposer gameView = null; 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | setContentView(R.layout.activity_main); 31 | continer = findViewById(R.id.viewContainer); 32 | SeekBar seekBar = findViewById(R.id.seekbarSceneModel); 33 | seekBar.setOnSeekBarChangeListener(this); 34 | ((RadioGroup)findViewById(R.id.radio_group_views)).setOnCheckedChangeListener(this); 35 | ((CheckBox) findViewById(R.id.checkbox_ha)).setOnCheckedChangeListener(this); 36 | ((CheckBox) findViewById(R.id.checkbox_mode)).setOnCheckedChangeListener(this); 37 | sceneModelComposer = new SceneModelComposer(getResources().getDisplayMetrics().widthPixels); 38 | 39 | } 40 | 41 | @Override 42 | public void onCheckedChanged(RadioGroup group, int checkedId) { 43 | switch (checkedId) { 44 | case R.id.viewCanvas: 45 | gameView = new GameView(this); 46 | break; 47 | case R.id.surfaceViewCanvas: 48 | gameView = new GameSurfaceView(this); 49 | break; 50 | case R.id.textureViewCanvas: 51 | gameView = new GameTextureView(this); 52 | break; 53 | } 54 | gameView.setComposer(sceneModelComposer); 55 | 56 | continer.removeAllViews(); 57 | continer.addView((View) gameView); 58 | } 59 | 60 | @Override 61 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 62 | if (gameView != null ) { 63 | if (buttonView.getId() == R.id.checkbox_ha) 64 | if (isChecked) { 65 | ((View) gameView).setLayerType(View.LAYER_TYPE_HARDWARE, null); 66 | } else { 67 | ((View) gameView).setLayerType(View.LAYER_TYPE_SOFTWARE, null); 68 | } 69 | if (buttonView.getId() == R.id.checkbox_mode) 70 | if (isChecked) { 71 | sceneModelComposer.setSceneModel(new StressSceneModel(getResources().getDisplayMetrics().widthPixels)); 72 | } else { 73 | sceneModelComposer.setSceneModel(new SimpleSceneModel()); 74 | } 75 | ((View)gameView).invalidate(); 76 | sceneModelComposer.invalidate(); 77 | } 78 | } 79 | 80 | @Override 81 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { 82 | sceneModelComposer.changeModel(progress); 83 | if (continer.getChildCount() > 0) { 84 | continer.getChildAt(0).invalidate(); 85 | } 86 | } 87 | 88 | @Override 89 | public void onStartTrackingTouch(SeekBar seekBar) { 90 | 91 | } 92 | 93 | @Override 94 | public void onStopTrackingTouch(SeekBar seekBar) { 95 | 96 | } 97 | 98 | 99 | } 100 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | 16 | 21 | 26 | 31 | 36 | 41 | 46 | 51 | 56 | 61 | 66 | 71 | 76 | 81 | 86 | 91 | 96 | 101 | 106 | 111 | 116 | 121 | 126 | 131 | 136 | 141 | 146 | 151 | 156 | 161 | 166 | 171 | 172 | --------------------------------------------------------------------------------