Loading libs/hwui/BakedOpRenderer.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ namespace uirenderer { OffscreenBuffer* BakedOpRenderer::startTemporaryLayer(uint32_t width, uint32_t height) { LOG_ALWAYS_FATAL_IF(mRenderTarget.offscreenBuffer, "already has layer..."); OffscreenBuffer* buffer = mRenderState.layerPool().get(mRenderState, width, height); OffscreenBuffer* buffer = mRenderState.layerPool().get( mRenderState, width, height, mWideColorGamut); startRepaintLayer(buffer, Rect(width, height)); return buffer; } Loading Loading @@ -103,7 +104,8 @@ void BakedOpRenderer::endLayer() { OffscreenBuffer* BakedOpRenderer::copyToLayer(const Rect& area) { const uint32_t width = area.getWidth(); const uint32_t height = area.getHeight(); OffscreenBuffer* buffer = mRenderState.layerPool().get(mRenderState, width, height); OffscreenBuffer* buffer = mRenderState.layerPool().get( mRenderState, width, height, mWideColorGamut); if (!area.isEmpty() && width != 0 && height != 0) { mCaches.textureState().activateTexture(0); mCaches.textureState().bindTexture(buffer->texture.id()); Loading libs/hwui/BakedOpRenderer.h +3 −1 Original line number Diff line number Diff line Loading @@ -54,12 +54,13 @@ public: uint8_t spotShadowAlpha; }; BakedOpRenderer(Caches& caches, RenderState& renderState, bool opaque, BakedOpRenderer(Caches& caches, RenderState& renderState, bool opaque, bool wideColorGamut, const LightInfo& lightInfo) : mGlopReceiver(DefaultGlopReceiver) , mRenderState(renderState) , mCaches(caches) , mOpaque(opaque) , mWideColorGamut(wideColorGamut) , mLightInfo(lightInfo) { } Loading Loading @@ -118,6 +119,7 @@ private: RenderState& mRenderState; Caches& mCaches; bool mOpaque; bool mWideColorGamut; bool mHasDrawn = false; // render target state - setup by start/end layer/frame Loading libs/hwui/Texture.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -120,6 +120,10 @@ void Texture::resetCachedParams() { void Texture::upload(GLint internalFormat, uint32_t width, uint32_t height, GLenum format, GLenum type, const void* pixels) { GL_CHECKPOINT(MODERATE); // We don't have color space information, we assume the data is gamma encoded mIsLinear = false; bool needsAlloc = updateLayout(width, height, internalFormat, format, GL_TEXTURE_2D); if (!mId) { glGenTextures(1, &mId); Loading Loading @@ -309,11 +313,16 @@ void Texture::upload(Bitmap& bitmap) { bool rgba16fNeedsConversion = bitmap.colorType() == kRGBA_F16_SkColorType && internalFormat != GL_RGBA16F; // RGBA16F is always linear extended sRGB if (internalFormat == GL_RGBA16F) { mIsLinear = true; } mConnector.reset(); // RGBA16F is always extended sRGB, alpha masks don't have color profiles // Alpha masks don't have color profiles // If an RGBA16F bitmap needs conversion, we know the target will be sRGB if (internalFormat != GL_RGBA16F && internalFormat != GL_ALPHA && !rgba16fNeedsConversion) { if (!mIsLinear && internalFormat != GL_ALPHA && !rgba16fNeedsConversion) { SkColorSpace* colorSpace = bitmap.info().colorSpace(); // If the bitmap is sRGB we don't need conversion if (colorSpace != nullptr && !colorSpace->isSRGB()) { Loading libs/hwui/Texture.h +6 −2 Original line number Diff line number Diff line Loading @@ -88,7 +88,8 @@ public: * The image data is undefined after calling this. */ void resize(uint32_t width, uint32_t height, GLint internalFormat, GLint format) { upload(internalFormat, width, height, format, GL_UNSIGNED_BYTE, nullptr); upload(internalFormat, width, height, format, internalFormat == GL_RGBA16F ? GL_HALF_FLOAT : GL_UNSIGNED_BYTE, nullptr); } /** Loading Loading @@ -155,7 +156,7 @@ public: * Returns true if this texture uses a linear encoding format. */ constexpr bool isLinear() const { return mInternalFormat == GL_RGBA16F; return mIsLinear; } /** Loading Loading @@ -219,6 +220,9 @@ private: GLenum mMinFilter = GL_NEAREST_MIPMAP_LINEAR; GLenum mMagFilter = GL_LINEAR; // Indicates whether the content of the texture is in linear space bool mIsLinear = false; Caches& mCaches; std::unique_ptr<ColorSpaceConnector> mConnector; Loading libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ bool SkiaOpenGLPipeline::draw(const Frame& frame, const SkRect& screenDirty, const SkRect& dirty, const FrameBuilder::LightGeometry& lightGeometry, LayerUpdateQueue* layerUpdateQueue, const Rect& contentDrawBounds, bool opaque, const Rect& contentDrawBounds, bool opaque, bool wideColorGamut, const BakedOpRenderer::LightInfo& lightInfo, const std::vector<sp<RenderNode>>& renderNodes, FrameInfoVisualizer* profiler) { Loading @@ -85,7 +85,8 @@ bool SkiaOpenGLPipeline::draw(const Frame& frame, const SkRect& screenDirty, mRenderThread.getGrContext(), renderTargetDesc, &props)); SkiaPipeline::updateLighting(lightGeometry, lightInfo); renderFrame(*layerUpdateQueue, dirty, renderNodes, opaque, contentDrawBounds, surface); renderFrame(*layerUpdateQueue, dirty, renderNodes, opaque, wideColorGamut, contentDrawBounds, surface); layerUpdateQueue->clear(); // Draw visual debugging features Loading Loading
libs/hwui/BakedOpRenderer.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ namespace uirenderer { OffscreenBuffer* BakedOpRenderer::startTemporaryLayer(uint32_t width, uint32_t height) { LOG_ALWAYS_FATAL_IF(mRenderTarget.offscreenBuffer, "already has layer..."); OffscreenBuffer* buffer = mRenderState.layerPool().get(mRenderState, width, height); OffscreenBuffer* buffer = mRenderState.layerPool().get( mRenderState, width, height, mWideColorGamut); startRepaintLayer(buffer, Rect(width, height)); return buffer; } Loading Loading @@ -103,7 +104,8 @@ void BakedOpRenderer::endLayer() { OffscreenBuffer* BakedOpRenderer::copyToLayer(const Rect& area) { const uint32_t width = area.getWidth(); const uint32_t height = area.getHeight(); OffscreenBuffer* buffer = mRenderState.layerPool().get(mRenderState, width, height); OffscreenBuffer* buffer = mRenderState.layerPool().get( mRenderState, width, height, mWideColorGamut); if (!area.isEmpty() && width != 0 && height != 0) { mCaches.textureState().activateTexture(0); mCaches.textureState().bindTexture(buffer->texture.id()); Loading
libs/hwui/BakedOpRenderer.h +3 −1 Original line number Diff line number Diff line Loading @@ -54,12 +54,13 @@ public: uint8_t spotShadowAlpha; }; BakedOpRenderer(Caches& caches, RenderState& renderState, bool opaque, BakedOpRenderer(Caches& caches, RenderState& renderState, bool opaque, bool wideColorGamut, const LightInfo& lightInfo) : mGlopReceiver(DefaultGlopReceiver) , mRenderState(renderState) , mCaches(caches) , mOpaque(opaque) , mWideColorGamut(wideColorGamut) , mLightInfo(lightInfo) { } Loading Loading @@ -118,6 +119,7 @@ private: RenderState& mRenderState; Caches& mCaches; bool mOpaque; bool mWideColorGamut; bool mHasDrawn = false; // render target state - setup by start/end layer/frame Loading
libs/hwui/Texture.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -120,6 +120,10 @@ void Texture::resetCachedParams() { void Texture::upload(GLint internalFormat, uint32_t width, uint32_t height, GLenum format, GLenum type, const void* pixels) { GL_CHECKPOINT(MODERATE); // We don't have color space information, we assume the data is gamma encoded mIsLinear = false; bool needsAlloc = updateLayout(width, height, internalFormat, format, GL_TEXTURE_2D); if (!mId) { glGenTextures(1, &mId); Loading Loading @@ -309,11 +313,16 @@ void Texture::upload(Bitmap& bitmap) { bool rgba16fNeedsConversion = bitmap.colorType() == kRGBA_F16_SkColorType && internalFormat != GL_RGBA16F; // RGBA16F is always linear extended sRGB if (internalFormat == GL_RGBA16F) { mIsLinear = true; } mConnector.reset(); // RGBA16F is always extended sRGB, alpha masks don't have color profiles // Alpha masks don't have color profiles // If an RGBA16F bitmap needs conversion, we know the target will be sRGB if (internalFormat != GL_RGBA16F && internalFormat != GL_ALPHA && !rgba16fNeedsConversion) { if (!mIsLinear && internalFormat != GL_ALPHA && !rgba16fNeedsConversion) { SkColorSpace* colorSpace = bitmap.info().colorSpace(); // If the bitmap is sRGB we don't need conversion if (colorSpace != nullptr && !colorSpace->isSRGB()) { Loading
libs/hwui/Texture.h +6 −2 Original line number Diff line number Diff line Loading @@ -88,7 +88,8 @@ public: * The image data is undefined after calling this. */ void resize(uint32_t width, uint32_t height, GLint internalFormat, GLint format) { upload(internalFormat, width, height, format, GL_UNSIGNED_BYTE, nullptr); upload(internalFormat, width, height, format, internalFormat == GL_RGBA16F ? GL_HALF_FLOAT : GL_UNSIGNED_BYTE, nullptr); } /** Loading Loading @@ -155,7 +156,7 @@ public: * Returns true if this texture uses a linear encoding format. */ constexpr bool isLinear() const { return mInternalFormat == GL_RGBA16F; return mIsLinear; } /** Loading Loading @@ -219,6 +220,9 @@ private: GLenum mMinFilter = GL_NEAREST_MIPMAP_LINEAR; GLenum mMagFilter = GL_LINEAR; // Indicates whether the content of the texture is in linear space bool mIsLinear = false; Caches& mCaches; std::unique_ptr<ColorSpaceConnector> mConnector; Loading
libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ bool SkiaOpenGLPipeline::draw(const Frame& frame, const SkRect& screenDirty, const SkRect& dirty, const FrameBuilder::LightGeometry& lightGeometry, LayerUpdateQueue* layerUpdateQueue, const Rect& contentDrawBounds, bool opaque, const Rect& contentDrawBounds, bool opaque, bool wideColorGamut, const BakedOpRenderer::LightInfo& lightInfo, const std::vector<sp<RenderNode>>& renderNodes, FrameInfoVisualizer* profiler) { Loading @@ -85,7 +85,8 @@ bool SkiaOpenGLPipeline::draw(const Frame& frame, const SkRect& screenDirty, mRenderThread.getGrContext(), renderTargetDesc, &props)); SkiaPipeline::updateLighting(lightGeometry, lightInfo); renderFrame(*layerUpdateQueue, dirty, renderNodes, opaque, contentDrawBounds, surface); renderFrame(*layerUpdateQueue, dirty, renderNodes, opaque, wideColorGamut, contentDrawBounds, surface); layerUpdateQueue->clear(); // Draw visual debugging features Loading