OSDN Git Service

FUJIXでのLiveViewちらつきを抑止。
authorMRSa <mrsa@myad.jp>
Sun, 28 Jul 2019 15:00:37 +0000 (00:00 +0900)
committerMRSa <mrsa@myad.jp>
Sun, 28 Jul 2019 15:00:37 +0000 (00:00 +0900)
app/build.gradle
app/src/main/java/net/osdn/gokigen/a01d/liveview/CameraLiveImageView.java

index a6d509f..4ea564f 100644 (file)
@@ -6,8 +6,8 @@ android {
         applicationId "net.osdn.gokigen.a01d"
         minSdkVersion 14
         targetSdkVersion 29
-        versionCode 10400
-        versionName "1.4.0"
+        versionCode 10401
+        versionName "1.4.1"
     }
     buildTypes {
         release {
index ce7d81d..ea174ac 100644 (file)
@@ -193,7 +193,28 @@ public class CameraLiveImageView extends View implements IImageDataReceiver, IAu
             // Create a bitmap.
             try
             {
+                //ByteArrayInputStream bais = new ByteArrayInputStream(data);
+                //bitmap = BitmapFactory.decodeStream(bais);
+                //bais.close();
                 bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
+                if (bitmap == null)
+                {
+                    BitmapFactory.Options opts = new BitmapFactory.Options();
+                    //opts.inPreferredConfig = Bitmap.Config.ARGB_8888;
+                    opts.inPreferredConfig = Bitmap.Config.RGB_565;
+                    bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, opts);
+                    //byte[] temp = Arrays.copyOfRange(data, 0, data.length);
+                    //ByteArrayInputStream bais = new ByteArrayInputStream(temp);
+                    //bitmap = BitmapFactory.decodeStream(bais);
+                    //bais.close();
+                    //bitmap = BitmapFactory.decodeStream(new ByteArrayInputStream(data, 0, data.length));
+                    //Log.v(TAG, " BitmapFactory.decodeStream() ");
+                }
+                if (bitmap == null)
+                {
+                    // bitmapがNULLの場合、表示は省略する...
+                    return;
+                }
             }
             catch (Throwable e)
             {