Flutter Engine
The Flutter Engine
RuntimeShaderActivity.java
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8package org.skia.jetskidemo;
9
10import android.app.Activity;
11import android.content.res.Resources;
12import android.os.Bundle;
13import android.view.SurfaceView;
14import org.skia.jetski.*;
15import org.skia.jetski.util.*;
16import org.skia.jetskidemo.samples.RuntimeSample;
17
19 private RuntimeSample mSample;
20 private float mSurfaceWidth,
21 mSurfaceHeight;
22
23 public RuntimeShaderRenderer(Resources res, int resID) {
24 mSample = new RuntimeSample(res, resID);
25 }
26
27 @Override
29 mSurfaceWidth = surface.getWidth();
30 mSurfaceHeight = surface.getHeight();
31 }
32
33 @Override
34 protected void onRenderFrame(Canvas canvas, long ms) {
35 mSample.render(canvas, ms, 0, 0, mSurfaceWidth, mSurfaceHeight);
36 }
37}
38
39public class RuntimeShaderActivity extends Activity {
40 static {
41 System.loadLibrary("jetski");
42 }
43
44 @Override
45 protected void onCreate(Bundle savedInstanceState) {
46 super.onCreate(savedInstanceState);
47 setContentView(R.layout.activity_animation);
48
49 SurfaceView sv = findViewById(R.id.surfaceView);
50 sv.getHolder().addCallback(new RuntimeShaderRenderer(getResources(),
51 R.raw.runtime_shader1));
52 }
53}
void render(Canvas canvas, long ms, float left, float top, float right, float bottom)
VkSurfaceKHR surface
Definition: main.cc:49
#define R(r)