* commit '8f36bedcf3fd3b5b3e5746af689b9915d506365f': Don't attempt to create empty layers. Bug #3369888
This commit is contained in:
@@ -452,11 +452,14 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
@Override
|
||||
public int saveLayer(float left, float top, float right, float bottom, Paint paint,
|
||||
int saveFlags) {
|
||||
boolean hasColorFilter = paint != null && setupColorFilter(paint);
|
||||
final int nativePaint = paint == null ? 0 : paint.mNativePaint;
|
||||
int count = nSaveLayer(mRenderer, left, top, right, bottom, nativePaint, saveFlags);
|
||||
if (hasColorFilter) nResetModifiers(mRenderer);
|
||||
return count;
|
||||
if (left < right && top < bottom) {
|
||||
boolean hasColorFilter = paint != null && setupColorFilter(paint);
|
||||
final int nativePaint = paint == null ? 0 : paint.mNativePaint;
|
||||
int count = nSaveLayer(mRenderer, left, top, right, bottom, nativePaint, saveFlags);
|
||||
if (hasColorFilter) nResetModifiers(mRenderer);
|
||||
return count;
|
||||
}
|
||||
return save(saveFlags);
|
||||
}
|
||||
|
||||
private native int nSaveLayer(int renderer, float left, float top, float right, float bottom,
|
||||
@@ -471,7 +474,10 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
@Override
|
||||
public int saveLayerAlpha(float left, float top, float right, float bottom, int alpha,
|
||||
int saveFlags) {
|
||||
return nSaveLayerAlpha(mRenderer, left, top, right, bottom, alpha, saveFlags);
|
||||
if (left < right && top < bottom) {
|
||||
return nSaveLayerAlpha(mRenderer, left, top, right, bottom, alpha, saveFlags);
|
||||
}
|
||||
return save(saveFlags);
|
||||
}
|
||||
|
||||
private native int nSaveLayerAlpha(int renderer, float left, float top, float right,
|
||||
|
||||
@@ -298,8 +298,10 @@ Font* Font::create(FontRenderer* state, uint32_t fontId, float fontSize,
|
||||
// FontRenderer
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool sLogFontRendererCreate = true;
|
||||
|
||||
FontRenderer::FontRenderer() {
|
||||
LOGD("Creating FontRenderer");
|
||||
if (sLogFontRendererCreate) LOGD("Creating FontRenderer");
|
||||
|
||||
mGammaTable = NULL;
|
||||
mInitialized = false;
|
||||
@@ -317,18 +319,24 @@ FontRenderer::FontRenderer() {
|
||||
|
||||
char property[PROPERTY_VALUE_MAX];
|
||||
if (property_get(PROPERTY_TEXT_CACHE_WIDTH, property, NULL) > 0) {
|
||||
LOGD(" Setting text cache width to %s pixels", property);
|
||||
if (sLogFontRendererCreate) LOGD(" Setting text cache width to %s pixels", property);
|
||||
mCacheWidth = atoi(property);
|
||||
} else {
|
||||
LOGD(" Using default text cache width of %i pixels", mCacheWidth);
|
||||
if (sLogFontRendererCreate) {
|
||||
LOGD(" Using default text cache width of %i pixels", mCacheWidth);
|
||||
}
|
||||
}
|
||||
|
||||
if (property_get(PROPERTY_TEXT_CACHE_HEIGHT, property, NULL) > 0) {
|
||||
LOGD(" Setting text cache width to %s pixels", property);
|
||||
if (sLogFontRendererCreate) LOGD(" Setting text cache width to %s pixels", property);
|
||||
mCacheHeight = atoi(property);
|
||||
} else {
|
||||
LOGD(" Using default text cache height of %i pixels", mCacheHeight);
|
||||
if (sLogFontRendererCreate) {
|
||||
LOGD(" Using default text cache height of %i pixels", mCacheHeight);
|
||||
}
|
||||
}
|
||||
|
||||
sLogFontRendererCreate = false;
|
||||
}
|
||||
|
||||
FontRenderer::~FontRenderer() {
|
||||
|
||||
@@ -430,18 +430,18 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top,
|
||||
} else {
|
||||
// Copy the framebuffer into the layer
|
||||
glBindTexture(GL_TEXTURE_2D, layer->texture);
|
||||
|
||||
if (layer->empty) {
|
||||
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left,
|
||||
snapshot->height - bounds.bottom, layer->width, layer->height, 0);
|
||||
layer->empty = false;
|
||||
} else {
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left,
|
||||
snapshot->height - bounds.bottom, bounds.getWidth(), bounds.getHeight());
|
||||
if (!bounds.isEmpty()) {
|
||||
if (layer->empty) {
|
||||
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left,
|
||||
snapshot->height - bounds.bottom, layer->width, layer->height, 0);
|
||||
layer->empty = false;
|
||||
} else {
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left,
|
||||
snapshot->height - bounds.bottom, bounds.getWidth(), bounds.getHeight());
|
||||
}
|
||||
// Enqueue the buffer coordinates to clear the corresponding region later
|
||||
mLayers.push(new Rect(bounds));
|
||||
}
|
||||
|
||||
// Enqueue the buffer coordinates to clear the corresponding region later
|
||||
mLayers.push(new Rect(bounds));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -565,8 +565,10 @@ void OpenGLRenderer::composeLayer(sp<Snapshot> current, sp<Snapshot> previous) {
|
||||
resetColorFilter();
|
||||
}
|
||||
} else {
|
||||
dirtyLayer(rect.left, rect.top, rect.right, rect.bottom);
|
||||
composeLayerRect(layer, rect, true);
|
||||
if (!rect.isEmpty()) {
|
||||
dirtyLayer(rect.left, rect.top, rect.right, rect.bottom);
|
||||
composeLayerRect(layer, rect, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (fboLayer) {
|
||||
|
||||
Reference in New Issue
Block a user