private NinePatchInstance findInstance(GLCanvas canvas, int w, int h) { int key = w; key = (key << 16) | h; NinePatchInstance instance = mInstanceCache.get(key); if (instance == null) { instance = new NinePatchInstance(this, w, h); NinePatchInstance removed = mInstanceCache.put(key, instance); if (removed != null) { removed.recycle(canvas); } } return instance; }