Lines Matching refs:layer
37 INIT_LOGD(" Setting layer cache size to %sMB", property);
40 INIT_LOGD(" Using default layer cache size of %.2fMB", DEFAULT_LAYER_CACHE_SIZE);
69 void LayerCache::deleteLayer(Layer* layer) {
70 if (layer) {
71 LAYER_LOGD("Destroying layer %dx%d", layer->getWidth(), layer->getHeight());
72 mSize -= layer->getWidth() * layer->getHeight() * 4;
73 layer->deleteFbo();
74 layer->deleteTexture();
75 delete layer;
87 Layer* LayerCache::get(const uint32_t width, const uint32_t height) {
88 Layer* layer = NULL;
97 layer = entry.mLayer;
98 mSize -= layer->getWidth() * layer->getHeight() * 4;
100 LAYER_LOGD("Reusing layer %dx%d", layer->getWidth(), layer->getHeight());
102 LAYER_LOGD("Creating new layer %dx%d", entry.mWidth, entry.mHeight);
104 layer = new Layer(entry.mWidth, entry.mHeight);
105 layer->setBlend(true);
106 layer->setEmpty(true);
107 layer->setFbo(0);
109 layer->generateTexture();
110 layer->bindTexture();
111 layer->setFilter(GL_NEAREST, GL_NEAREST);
112 layer->setWrap(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, false);
120 return layer;
127 LAYER_LOGD(" Layer size %dx%d", entry.mWidth, entry.mHeight);
131 bool LayerCache::resize(Layer* layer, const uint32_t width, const uint32_t height) {
136 if (entry.mWidth <= layer->getWidth() && entry.mHeight <= layer->getHeight()) {
140 uint32_t oldWidth = layer->getWidth();
141 uint32_t oldHeight = layer->getHeight();
144 layer->bindTexture();
145 layer->setSize(entry.mWidth, entry.mHeight);
146 layer->allocateTexture(GL_RGBA, GL_UNSIGNED_BYTE);
149 layer->setSize(oldWidth, oldHeight);
156 bool LayerCache::put(Layer* layer) {
157 if (!layer->isCacheable()) return false;
159 const uint32_t size = layer->getWidth() * layer->getHeight() * 4;
160 // Don't even try to cache a layer that's bigger than the cache
168 Layer* victim = mCache.itemAt(position).mLayer;
172 LAYER_LOGD(" Deleting layer %.2fx%.2f", victim->layer.getWidth(),
173 victim->layer.getHeight());
176 LayerEntry entry(layer);