diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 15 | ||||
| -rw-r--r-- | libs/hwui/Properties.cpp | 4 | ||||
| -rw-r--r-- | libs/hwui/RenderNode.cpp | 3 | ||||
| -rw-r--r-- | libs/hwui/RenderProperties.cpp | 4 | ||||
| -rw-r--r-- | libs/hwui/renderstate/RenderState.cpp | 4 | ||||
| -rw-r--r-- | libs/hwui/renderthread/EglManager.cpp | 7 |
6 files changed, 18 insertions, 19 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 54bcd7e43d1d..b3fb7ef3f5a3 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -841,7 +841,7 @@ void OpenGLRenderer::composeLayer(const Snapshot& removed, const Snapshot& resto } void OpenGLRenderer::drawTextureLayer(Layer* layer, const Rect& rect) { - bool snap = !layer->getForceFilter() + const bool tryToSnap = !layer->getForceFilter() && layer->getWidth() == (uint32_t) rect.getWidth() && layer->getHeight() == (uint32_t) rect.getHeight(); Glop glop; @@ -849,7 +849,7 @@ void OpenGLRenderer::drawTextureLayer(Layer* layer, const Rect& rect) { .setMeshTexturedUvQuad(nullptr, Rect(0, 1, 1, 0)) // TODO: simplify with VBO .setFillTextureLayer(*layer, getLayerAlpha(layer)) .setTransform(currentSnapshot()->getOrthoMatrix(), *currentTransform(), false) - .setModelViewMapUnitToRectOptionalSnap(snap, rect) + .setModelViewMapUnitToRectOptionalSnap(tryToSnap, rect) .setRoundRectClipState(currentSnapshot()->roundRectClipState) .build(); renderGlop(glop); @@ -865,7 +865,7 @@ void OpenGLRenderer::composeLayerRect(Layer* layer, const Rect& rect, bool swap) Blend::ModeOrderSwap modeUsage = swap ? Blend::ModeOrderSwap::Swap : Blend::ModeOrderSwap::NoSwap; const Matrix4& transform = swap ? Matrix4::identity() : *currentTransform(); - bool snap = !swap + const bool tryToSnap = !swap && layer->getWidth() == static_cast<uint32_t>(rect.getWidth()) && layer->getHeight() == static_cast<uint32_t>(rect.getHeight()); Glop glop; @@ -873,7 +873,7 @@ void OpenGLRenderer::composeLayerRect(Layer* layer, const Rect& rect, bool swap) .setMeshTexturedUvQuad(nullptr, layer->texCoords) .setFillLayer(layer->getTexture(), layer->getColorFilter(), getLayerAlpha(layer), layer->getMode(), modeUsage) .setTransform(currentSnapshot()->getOrthoMatrix(), transform, false) - .setModelViewMapUnitToRectOptionalSnap(snap, rect) + .setModelViewMapUnitToRectOptionalSnap(tryToSnap, rect) .setRoundRectClipState(currentSnapshot()->roundRectClipState) .build(); renderGlop(glop); @@ -1654,14 +1654,17 @@ void OpenGLRenderer::drawBitmap(const SkBitmap* bitmap, Rect src, Rect dst, cons fmin(1.0f, src.right / texture->width), fmin(1.0f, src.bottom / texture->height)); - int textureFillFlags = static_cast<int>((bitmap->colorType() == kAlpha_8_SkColorType) + const int textureFillFlags = static_cast<int>((bitmap->colorType() == kAlpha_8_SkColorType) ? TextureFillFlags::kIsAlphaMaskTexture : TextureFillFlags::kNone); + const bool tryToSnap = MathUtils::areEqual(src.getWidth(), dst.getWidth()) + && MathUtils::areEqual(src.getHeight(), dst.getHeight()); + Glop glop; GlopBuilder(mRenderState, mCaches, &glop) .setMeshTexturedUvQuad(texture->uvMapper, uv) .setFillTexturePaint(*texture, textureFillFlags, paint, currentSnapshot()->alpha) .setTransform(currentSnapshot()->getOrthoMatrix(), *currentTransform(), false) - .setModelViewMapUnitToRectSnap(dst) + .setModelViewMapUnitToRectOptionalSnap(tryToSnap, dst) .setRoundRectClipState(currentSnapshot()->roundRectClipState) .build(); renderGlop(glop); diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp index 723a177317fc..7dbe3b78839c 100644 --- a/libs/hwui/Properties.cpp +++ b/libs/hwui/Properties.cpp @@ -29,7 +29,7 @@ bool Properties::debugLayersUpdates = false; bool Properties::debugOverdraw = false; bool Properties::showDirtyRegions = false; bool Properties::skipEmptyFrames = true; -bool Properties::swapBuffersWithDamage = false; +bool Properties::swapBuffersWithDamage = true; DebugLevel Properties::debugLevel = kDebugDisabled; OverdrawColorSet Properties::overdrawColorSet = OverdrawColorSet::Default; @@ -104,7 +104,7 @@ bool Properties::load() { } skipEmptyFrames = property_get_bool(PROPERTY_SKIP_EMPTY_DAMAGE, true); - swapBuffersWithDamage = property_get_bool(PROPERTY_SWAP_WITH_DAMAGE, false); + swapBuffersWithDamage = property_get_bool(PROPERTY_SWAP_WITH_DAMAGE, true); return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw) diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 9146b6831a9b..9e5ec28ac11a 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -83,8 +83,9 @@ void RenderNode::setStagingDisplayList(DisplayListData* data) { * display list. This function should remain in sync with the replay() function. */ void RenderNode::output(uint32_t level) { - ALOGD("%*sStart display list (%p, %s%s%s%s)", (level - 1) * 2, "", this, + ALOGD("%*sStart display list (%p, %s%s%s%s%s)", (level - 1) * 2, "", this, getName(), + (MathUtils::isZero(properties().getAlpha()) ? ", zero alpha" : ""), (properties().hasShadow() ? ", casting shadow" : ""), (isRenderable() ? "" : ", empty"), (mLayer != nullptr ? ", on HW Layer" : "")); diff --git a/libs/hwui/RenderProperties.cpp b/libs/hwui/RenderProperties.cpp index 7b756904c249..07b8ce6d3320 100644 --- a/libs/hwui/RenderProperties.cpp +++ b/libs/hwui/RenderProperties.cpp @@ -146,12 +146,12 @@ void RenderProperties::debugOutputProperties(const int level) const { const bool isLayer = effectiveLayerType() != LayerType::None; int clipFlags = getClippingFlags(); - if (mPrimitiveFields.mAlpha < 1) { + if (mPrimitiveFields.mAlpha < 1 + && !MathUtils::isZero(mPrimitiveFields.mAlpha)) { if (isLayer) { clipFlags &= ~CLIP_TO_BOUNDS; // bounds clipping done by layer } - LOG_ALWAYS_FATAL_IF(!isLayer && mPrimitiveFields.mHasOverlappingRendering); ALOGD("%*sScaleAlpha %.2f", level * 2, "", mPrimitiveFields.mAlpha); } if (clipFlags) { diff --git a/libs/hwui/renderstate/RenderState.cpp b/libs/hwui/renderstate/RenderState.cpp index d7c831603843..df12e63017f4 100644 --- a/libs/hwui/renderstate/RenderState.cpp +++ b/libs/hwui/renderstate/RenderState.cpp @@ -266,10 +266,10 @@ void RenderState::render(const Glop& glop) { mCaches->textureState().activateTexture(0); if (texture.clamp != GL_INVALID_ENUM) { - texture.texture->setWrap(texture.clamp, true); + texture.texture->setWrap(texture.clamp, true, false, texture.target); } if (texture.filter != GL_INVALID_ENUM) { - texture.texture->setFilter(texture.filter, true); + texture.texture->setFilter(texture.filter, true, false, texture.target); } mCaches->textureState().bindTexture(texture.target, texture.texture->id); diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp index c0e7c73b9de7..cb34e0072545 100644 --- a/libs/hwui/renderthread/EglManager.cpp +++ b/libs/hwui/renderthread/EglManager.cpp @@ -256,7 +256,7 @@ bool EglManager::swapBuffers(EGLSurface surface, const SkRect& dirty, #endif #ifdef EGL_KHR_swap_buffers_with_damage - if (CC_UNLIKELY(Properties::swapBuffersWithDamage)) { + if (CC_LIKELY(Properties::swapBuffersWithDamage)) { SkIRect idirty; dirty.roundOut(&idirty); /* @@ -273,11 +273,6 @@ bool EglManager::swapBuffers(EGLSurface surface, const SkRect& dirty, // layout: {x, y, width, height} EGLint rects[4] = { idirty.x(), y, idirty.width(), idirty.height() }; EGLint numrects = dirty.isEmpty() ? 0 : 1; - // TODO: Remove prior to enabling this path by default - ALOGD("Swap buffers with damage %d: %d, %d, %d, %d (src=" - RECT_STRING ")", - dirty.isEmpty() ? 0 : 1, rects[0], rects[1], rects[2], rects[3], - SK_RECT_ARGS(dirty)); eglSwapBuffersWithDamageKHR(mEglDisplay, surface, rects, numrects); } else { eglSwapBuffers(mEglDisplay, surface); |