Loading libs/hwui/DeferredLayerUpdater.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -133,9 +133,10 @@ void DeferredLayerUpdater::doUpdateTexImage() { bool forceFilter = false; sp<GraphicBuffer> buffer = mSurfaceTexture->getCurrentBuffer(); if (buffer != nullptr) { mLayer->setBufferSize(buffer->getWidth(), buffer->getHeight()); // force filtration if buffer size != layer size forceFilter = mWidth != static_cast<int>(buffer->getWidth()) || mHeight != static_cast<int>(buffer->getHeight()); forceFilter = mWidth != static_cast<int>(mLayer->getBufferWidth()) || mHeight != static_cast<int>(mLayer->getBufferHeight()); } #if DEBUG_RENDERER Loading libs/hwui/Layer.h +12 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,15 @@ public: */ void postDecStrong(); inline void setBufferSize(uint32_t width, uint32_t height) { mBufferWidth = width; mBufferHeight = height; } inline uint32_t getBufferWidth() const { return mBufferWidth; } inline uint32_t getBufferHeight() const { return mBufferHeight; } protected: Layer(RenderState& renderState, Api api, sk_sp<SkColorFilter>, int alpha, SkBlendMode mode); Loading Loading @@ -145,6 +154,9 @@ private: */ mat4 transform; uint32_t mBufferWidth = 0; uint32_t mBufferHeight = 0; }; // struct Layer }; // namespace uirenderer Loading libs/hwui/pipeline/skia/LayerDrawable.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,11 @@ bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer sk_sp<SkImage> layerImage; const int layerWidth = layer->getWidth(); const int layerHeight = layer->getHeight(); const int bufferWidth = layer->getBufferWidth(); const int bufferHeight = layer->getBufferHeight(); if (bufferWidth <= 0 || bufferHeight <=0) { return false; } if (layer->getApi() == Layer::Api::OpenGL) { GlLayer* glLayer = static_cast<GlLayer*>(layer); GrGLTextureInfo externalTexture; Loading @@ -57,7 +62,7 @@ bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer // this is anticipated to have is that for some format types if we are not bound as an OES // texture we may get invalid results for SKP capture if we read back the texture. externalTexture.fFormat = GL_RGBA8; GrBackendTexture backendTexture(layerWidth, layerHeight, GrMipMapped::kNo, externalTexture); GrBackendTexture backendTexture(bufferWidth, bufferHeight, GrMipMapped::kNo, externalTexture); layerImage = SkImage::MakeFromTexture(context, backendTexture, kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, nullptr); } else { Loading @@ -76,7 +81,7 @@ bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer flipV.setAll(1, 0, 0, 0, -1, 1, 0, 0, 1); textureMatrixInv.preConcat(flipV); textureMatrixInv.preScale(1.0f / layerWidth, 1.0f / layerHeight); textureMatrixInv.postScale(layerWidth, layerHeight); textureMatrixInv.postScale(bufferWidth, bufferHeight); SkMatrix textureMatrix; if (!textureMatrixInv.invert(&textureMatrix)) { textureMatrix = textureMatrixInv; Loading @@ -95,6 +100,9 @@ bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer paint.setAlpha(layer->getAlpha()); paint.setBlendMode(layer->getMode()); paint.setColorFilter(layer->getColorSpaceWithFilter()); if (layer->getForceFilter()) { paint.setFilterQuality(kLow_SkFilterQuality); } const bool nonIdentityMatrix = !matrix.isIdentity(); if (nonIdentityMatrix) { Loading Loading
libs/hwui/DeferredLayerUpdater.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -133,9 +133,10 @@ void DeferredLayerUpdater::doUpdateTexImage() { bool forceFilter = false; sp<GraphicBuffer> buffer = mSurfaceTexture->getCurrentBuffer(); if (buffer != nullptr) { mLayer->setBufferSize(buffer->getWidth(), buffer->getHeight()); // force filtration if buffer size != layer size forceFilter = mWidth != static_cast<int>(buffer->getWidth()) || mHeight != static_cast<int>(buffer->getHeight()); forceFilter = mWidth != static_cast<int>(mLayer->getBufferWidth()) || mHeight != static_cast<int>(mLayer->getBufferHeight()); } #if DEBUG_RENDERER Loading
libs/hwui/Layer.h +12 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,15 @@ public: */ void postDecStrong(); inline void setBufferSize(uint32_t width, uint32_t height) { mBufferWidth = width; mBufferHeight = height; } inline uint32_t getBufferWidth() const { return mBufferWidth; } inline uint32_t getBufferHeight() const { return mBufferHeight; } protected: Layer(RenderState& renderState, Api api, sk_sp<SkColorFilter>, int alpha, SkBlendMode mode); Loading Loading @@ -145,6 +154,9 @@ private: */ mat4 transform; uint32_t mBufferWidth = 0; uint32_t mBufferHeight = 0; }; // struct Layer }; // namespace uirenderer Loading
libs/hwui/pipeline/skia/LayerDrawable.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,11 @@ bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer sk_sp<SkImage> layerImage; const int layerWidth = layer->getWidth(); const int layerHeight = layer->getHeight(); const int bufferWidth = layer->getBufferWidth(); const int bufferHeight = layer->getBufferHeight(); if (bufferWidth <= 0 || bufferHeight <=0) { return false; } if (layer->getApi() == Layer::Api::OpenGL) { GlLayer* glLayer = static_cast<GlLayer*>(layer); GrGLTextureInfo externalTexture; Loading @@ -57,7 +62,7 @@ bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer // this is anticipated to have is that for some format types if we are not bound as an OES // texture we may get invalid results for SKP capture if we read back the texture. externalTexture.fFormat = GL_RGBA8; GrBackendTexture backendTexture(layerWidth, layerHeight, GrMipMapped::kNo, externalTexture); GrBackendTexture backendTexture(bufferWidth, bufferHeight, GrMipMapped::kNo, externalTexture); layerImage = SkImage::MakeFromTexture(context, backendTexture, kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, nullptr); } else { Loading @@ -76,7 +81,7 @@ bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer flipV.setAll(1, 0, 0, 0, -1, 1, 0, 0, 1); textureMatrixInv.preConcat(flipV); textureMatrixInv.preScale(1.0f / layerWidth, 1.0f / layerHeight); textureMatrixInv.postScale(layerWidth, layerHeight); textureMatrixInv.postScale(bufferWidth, bufferHeight); SkMatrix textureMatrix; if (!textureMatrixInv.invert(&textureMatrix)) { textureMatrix = textureMatrixInv; Loading @@ -95,6 +100,9 @@ bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer paint.setAlpha(layer->getAlpha()); paint.setBlendMode(layer->getMode()); paint.setColorFilter(layer->getColorSpaceWithFilter()); if (layer->getForceFilter()) { paint.setFilterQuality(kLow_SkFilterQuality); } const bool nonIdentityMatrix = !matrix.isIdentity(); if (nonIdentityMatrix) { Loading