refactor(force invert): use enum/intdef for force dark type in setForceDark() functions
This allows the RenderNode to differentiate between normal force dark
and force force-dark (force invert color). In the next CL we will treat
force invert slightly differently, not allowing devs to opt-out of force
dark in individual Views/RenderNodes.
This also sets us up to specify a "force light" mode for force invert,
if we ever need it.
Bug: 282821643
Test: atest ViewRootImplTest
Change-Id: I8cc0fe099cccabdd09ea072aca1e70527e91e1a8
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index 37e4f7ec..be9b649 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -46,6 +46,7 @@
#include "renderstate/RenderState.h"
#include "renderthread/RenderTask.h"
#include "renderthread/RenderThread.h"
+#include "utils/ForceDark.h"
#include "utils/RingBuffer.h"
namespace android {
@@ -194,11 +195,9 @@
mRenderPipeline->setPictureCapturedCallback(callback);
}
- void setForceDark(bool enable) { mUseForceDark = enable; }
+ void setForceDark(ForceDarkType type) { mForceDarkType = type; }
- bool useForceDark() {
- return mUseForceDark;
- }
+ ForceDarkType getForceDarkType() { return mForceDarkType; }
SkISize getNextFrameSize() const;
@@ -321,7 +320,7 @@
nsecs_t mLastDropVsync = 0;
bool mOpaque;
- bool mUseForceDark = false;
+ ForceDarkType mForceDarkType = ForceDarkType::NONE;
LightInfo mLightInfo;
LightGeometry mLightGeometry = {{0, 0, 0}, 0};