teapots/image-decoder/src/main/java/com/sample/helper/NDKHelper.java [208:244]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public Object loadImage(String path) {
        Bitmap bitmap = null;
        TextureInformation info = new TextureInformation();
        try {
            String str = path;
            if (!path.startsWith("/")) {
                str = "/" + path;
            }

            File file = new File(activity.getExternalFilesDir(null), str);
            if (file.canRead()) {
                bitmap = BitmapFactory.decodeStream(new FileInputStream(file));
            } else {
                bitmap = BitmapFactory.decodeStream(activity.getResources()
                        .getAssets().open(path));
            }
        } catch (Exception e) {
            Log.w("NDKHelper", "Coundn't load a file:" + path);
            info.ret = false;
            return info;
        }

        if (bitmap != null) {
            GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
        }
        info.ret = true;
        info.alphaChannel = bitmap.hasAlpha();
        info.originalWidth = getBitmapWidth(bitmap);
        info.originalHeight = getBitmapHeight(bitmap);

        int iBytes = bitmap.getWidth() * bitmap.getHeight() * 4;
        ByteBuffer buffer = ByteBuffer.allocateDirect(iBytes);

        bitmap.copyPixelsToBuffer(buffer);
        info.image = buffer;
        return info;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



teapots/choreographer-30fps/src/main/java/com/sample/helper/NDKHelper.java [208:244]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public Object loadImage(String path) {
        Bitmap bitmap = null;
        TextureInformation info = new TextureInformation();
        try {
            String str = path;
            if (!path.startsWith("/")) {
                str = "/" + path;
            }

            File file = new File(activity.getExternalFilesDir(null), str);
            if (file.canRead()) {
                bitmap = BitmapFactory.decodeStream(new FileInputStream(file));
            } else {
                bitmap = BitmapFactory.decodeStream(activity.getResources()
                        .getAssets().open(path));
            }
        } catch (Exception e) {
            Log.w("NDKHelper", "Coundn't load a file:" + path);
            info.ret = false;
            return info;
        }

        if (bitmap != null) {
            GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
        }
        info.ret = true;
        info.alphaChannel = bitmap.hasAlpha();
        info.originalWidth = getBitmapWidth(bitmap);
        info.originalHeight = getBitmapHeight(bitmap);

        int iBytes = bitmap.getWidth() * bitmap.getHeight() * 4;
        ByteBuffer buffer = ByteBuffer.allocateDirect(iBytes);

        bitmap.copyPixelsToBuffer(buffer);
        info.image = buffer;
        return info;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



teapots/classic-teapot/src/main/java/com/sample/helper/NDKHelper.java [208:244]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public Object loadImage(String path) {
        Bitmap bitmap = null;
        TextureInformation info = new TextureInformation();
        try {
            String str = path;
            if (!path.startsWith("/")) {
                str = "/" + path;
            }

            File file = new File(activity.getExternalFilesDir(null), str);
            if (file.canRead()) {
                bitmap = BitmapFactory.decodeStream(new FileInputStream(file));
            } else {
                bitmap = BitmapFactory.decodeStream(activity.getResources()
                        .getAssets().open(path));
            }
        } catch (Exception e) {
            Log.w("NDKHelper", "Coundn't load a file:" + path);
            info.ret = false;
            return info;
        }

        if (bitmap != null) {
            GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
        }
        info.ret = true;
        info.alphaChannel = bitmap.hasAlpha();
        info.originalWidth = getBitmapWidth(bitmap);
        info.originalHeight = getBitmapHeight(bitmap);

        int iBytes = bitmap.getWidth() * bitmap.getHeight() * 4;
        ByteBuffer buffer = ByteBuffer.allocateDirect(iBytes);

        bitmap.copyPixelsToBuffer(buffer);
        info.image = buffer;
        return info;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



teapots/more-teapots/src/main/java/com/sample/helper/NDKHelper.java [208:244]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public Object loadImage(String path) {
        Bitmap bitmap = null;
        TextureInformation info = new TextureInformation();
        try {
            String str = path;
            if (!path.startsWith("/")) {
                str = "/" + path;
            }

            File file = new File(activity.getExternalFilesDir(null), str);
            if (file.canRead()) {
                bitmap = BitmapFactory.decodeStream(new FileInputStream(file));
            } else {
                bitmap = BitmapFactory.decodeStream(activity.getResources()
                        .getAssets().open(path));
            }
        } catch (Exception e) {
            Log.w("NDKHelper", "Coundn't load a file:" + path);
            info.ret = false;
            return info;
        }

        if (bitmap != null) {
            GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
        }
        info.ret = true;
        info.alphaChannel = bitmap.hasAlpha();
        info.originalWidth = getBitmapWidth(bitmap);
        info.originalHeight = getBitmapHeight(bitmap);

        int iBytes = bitmap.getWidth() * bitmap.getHeight() * 4;
        ByteBuffer buffer = ByteBuffer.allocateDirect(iBytes);

        bitmap.copyPixelsToBuffer(buffer);
        info.image = buffer;
        return info;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



teapots/textured-teapot/src/main/java/com/sample/helper/NDKHelper.java [208:244]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public Object loadImage(String path) {
        Bitmap bitmap = null;
        TextureInformation info = new TextureInformation();
        try {
            String str = path;
            if (!path.startsWith("/")) {
                str = "/" + path;
            }

            File file = new File(activity.getExternalFilesDir(null), str);
            if (file.canRead()) {
                bitmap = BitmapFactory.decodeStream(new FileInputStream(file));
            } else {
                bitmap = BitmapFactory.decodeStream(activity.getResources()
                        .getAssets().open(path));
            }
        } catch (Exception e) {
            Log.w("NDKHelper", "Coundn't load a file:" + path);
            info.ret = false;
            return info;
        }

        if (bitmap != null) {
            GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
        }
        info.ret = true;
        info.alphaChannel = bitmap.hasAlpha();
        info.originalWidth = getBitmapWidth(bitmap);
        info.originalHeight = getBitmapHeight(bitmap);

        int iBytes = bitmap.getWidth() * bitmap.getHeight() * 4;
        ByteBuffer buffer = ByteBuffer.allocateDirect(iBytes);

        bitmap.copyPixelsToBuffer(buffer);
        info.image = buffer;
        return info;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



