Skip to content

Commit cfb3c3f

Browse files
Andrew HsiehGerrit Code Review
authored andcommitted
Merge "Fix sample bitmap-plasma to draw on whole screen"
2 parents eb0b562 + 055992f commit cfb3c3f

File tree

1 file changed

+6
-7
lines changed
  • ndk/platforms/android-8/samples/bitmap-plasma/src/com/example/plasma

1 file changed

+6
-7
lines changed

ndk/platforms/android-8/samples/bitmap-plasma/src/com/example/plasma/Plasma.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import android.view.View;
2222
import android.graphics.Bitmap;
2323
import android.graphics.Canvas;
24+
import android.view.Display;
25+
import android.view.WindowManager;
2426

2527
public class Plasma extends Activity
2628
{
@@ -29,7 +31,8 @@ public class Plasma extends Activity
2931
public void onCreate(Bundle savedInstanceState)
3032
{
3133
super.onCreate(savedInstanceState);
32-
setContentView(new PlasmaView(this));
34+
Display display = getWindowManager().getDefaultDisplay();
35+
setContentView(new PlasmaView(this, display.getWidth(), display.getHeight()));
3336
}
3437

3538
/* load our native library */
@@ -45,13 +48,9 @@ class PlasmaView extends View {
4548
/* implementend by libplasma.so */
4649
private static native void renderPlasma(Bitmap bitmap, long time_ms);
4750

48-
public PlasmaView(Context context) {
51+
public PlasmaView(Context context, int width, int height) {
4952
super(context);
50-
51-
final int W = 200;
52-
final int H = 200;
53-
54-
mBitmap = Bitmap.createBitmap(W, H, Bitmap.Config.RGB_565);
53+
mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
5554
mStartTime = System.currentTimeMillis();
5655
}
5756

0 commit comments

Comments
 (0)