Skip to content

Instantly share code, notes, and snippets.

@Volcanoscar
Volcanoscar / HardwareBuffer.cpp
Created October 28, 2018 16:07 — forked from billhsu/HardwareBuffer.cpp
HardwareBuffer
// Shipeng Xu
// billhsu.x@gmail.com
/* Copyright [2016] [Shipeng Xu]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
----- BEGIN LICENSE -----
sgbteam
Single User License
EA7E-1153259
8891CBB9 F1513E4F 1A3405C1 A865D53F
115F202E 7B91AB2D 0D2A40ED 352B269B
76E84F0B CD69BFC7 59F2DFEF E267328F
215652A3 E88F9D8F 4C38E3BA 5B2DAAE4
969624E7 DC9CD4D5 717FB40C 1B9738CF
20B3C4F1 E917B5B3 87C38D9C ACCE7DD8
@Volcanoscar
Volcanoscar / README.md
Created January 27, 2018 07:40 — forked from lopspower/README.md
How to Analyze & Manage Memory on Android Like a Boss

Analyze & Manage Memory on Android Like a Boss

This Blog is all about memory management in Android. It provides information about how you can analyze & reduce memory usage while developing an Android app.

Memory management is a complex field of computer science and there are many techniques being developed to make it more efficient. This guide is designed to introduce you to some of the basic memory management issues that programmers face.

Memory Management in Android

Android is a Linux based operating system. It uses native open source C libraries which power Linux machines. All the basic operating system operations like I/O, memory management and so on are handled by the Linux kernel. Like Java and .NET, Android uses its own run time and virtual machine to manage application memory. Unlike either of these frameworks, the Android run time also manages the lifetime processes. Each Android application runs in a separate process within its own Dalvik instance, relinquishing all responsibility for memo

@Volcanoscar
Volcanoscar / WifiConnection.java
Created May 15, 2017 15:27 — forked from liu7yong/WifiConnection.java
How to connect to a specific wifi network in Android programmatically?
WifiConfiguration wifiConfig = new WifiConfiguration();
wifiConfig.SSID = String.format("\"%s\"", ssid);
wifiConfig.preSharedKey = String.format("\"%s\"", key);
WifiManager wifiManager = (WifiManager)getSystemService(WIFI_SERVICE);
//remember id
int netId = wifiManager.addNetwork(wifiConfig);
wifiManager.disconnect();
wifiManager.enableNetwork(netId, true);
wifiManager.reconnect();
1. The texture target needs to be GLES20.GL_TEXTURE_EXTERNAL_OES instead of GL_TEXTURE_2D, e.g. in the glBindTexture calls and glTexParameteri calls.
2. In the fragment shader define a requirement to use the extension:
#extension GL_OES_EGL_image_external : require
3. For the texture sampler used in the fragment shader, use samplerExternalOES instead of sampler2D.
Everything below here is all in the C code, no more Java.
4. In the C code, use glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, eglImage) to specify where the data is, instead of using glTexImage2D family of functions.
@Volcanoscar
Volcanoscar / DeCryptor.java
Created February 22, 2017 03:18 — forked from JosiasSena/DeCryptor.java
Encryptor and Decryptor for data encryption.decryption using the Android KeyStore.
/**
_____ _____ _
| __ \ / ____| | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__|
| |__| | __/ |____| | | |_| | |_) | || (_) | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_|
__/ | |
|___/|_|
*/
#!/usr/bin/env zsh
chromium_version="52.0.2743.98"
clean=0
supported_arch=(arm arm64 x86 x64)
usage() {
echo "Usage:"
echo " build_webview [ options ]"
echo
From 34b73571a4d322ab2afe59a80912337783f29fb7 Mon Sep 17 00:00:00 2001
From: BigBrother1984 <stevewatersy@gmail.com>
Date: Thu, 10 Apr 2014 18:07:26 +0200
Subject: [PATCH] base: floating window
Squash commits from aospa
Change-Id: I81ba0bfaf8e6f29388e07beb78197dd316a11de7
Signed-off-by: jrizzoli <joey@cyanogenmoditalia.it>
---
#define PROCESSING_TEXTURE_SHADER
uniform sampler2D texture;
uniform vec2 texOffset;
varying vec4 vertColor;
varying vec4 vertTexCoord;
uniform float level;
float map(float a,float amin,float amax,float bmin,float bmax) {
return (a-amin)/(amax-amin) * (bmax-bmin) + bmin;
@Volcanoscar
Volcanoscar / fisheye.frag
Created January 19, 2017 08:50 — forked from wilbefast/fisheye.frag
Fish-eye Shader for Love 2D
const float PI = 3.1415926535;
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords)
{
float aperture = 178.0;
float apertureHalf = 0.5 * aperture * (PI / 180.0);
float maxFactor = sin(apertureHalf);
vec2 uv;
vec2 xy = 2.0 * texture_coords.xy - 1.0;