diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/androidfw/Android.bp | 2 | ||||
| -rw-r--r-- | libs/androidfw/Locale.cpp | 2 | ||||
| -rw-r--r-- | libs/androidfw/ResourceTypes.cpp | 6 | ||||
| -rw-r--r-- | libs/hwui/FrameInfoVisualizer.cpp | 1 | ||||
| -rw-r--r-- | libs/hwui/hwui/MinikinSkia.cpp | 2 | ||||
| -rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 12 | ||||
| -rw-r--r-- | libs/hwui/renderthread/CanvasContext.h | 5 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 22 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderProxy.h | 11 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderThread.h | 2 | ||||
| -rw-r--r-- | libs/hwui/tests/macrobench/TestSceneRunner.cpp | 6 |
11 files changed, 37 insertions, 34 deletions
diff --git a/libs/androidfw/Android.bp b/libs/androidfw/Android.bp index 92efb6ba8914..98af3eb05391 100644 --- a/libs/androidfw/Android.bp +++ b/libs/androidfw/Android.bp @@ -59,8 +59,6 @@ cc_library { "ZipFileRO.cpp", "ZipUtils.cpp", ], - // Allow implicit fallthroughs in Locale.cpp and ResourceTypes.cpp until they are fixed. - cflags: ["-Wno-implicit-fallthrough"], export_include_dirs: ["include"], export_shared_lib_headers: ["libz"], target: { diff --git a/libs/androidfw/Locale.cpp b/libs/androidfw/Locale.cpp index 2870066ccbba..3eedda88fdce 100644 --- a/libs/androidfw/Locale.cpp +++ b/libs/androidfw/Locale.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include "android-base/macros.h" #include "androidfw/Locale.h" #include "androidfw/Util.h" @@ -162,6 +163,7 @@ bool LocaleValue::InitFromBcp47TagImpl(const StringPiece& bcp47tag, const char s set_script(subtags[1].c_str()); break; } + FALLTHROUGH_INTENDED; case 5: case 6: case 7: diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index 388548b174f9..76db18de6122 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -29,6 +29,7 @@ #include <memory> #include <type_traits> +#include <android-base/macros.h> #include <androidfw/ByteBucketArray.h> #include <androidfw/ResourceTypes.h> #include <androidfw/TypeWrappers.h> @@ -3073,6 +3074,7 @@ struct LocaleParserState { } break; } + FALLTHROUGH_INTENDED; case 5: case 6: case 7: @@ -7002,7 +7004,7 @@ status_t DynamicRefTable::lookupResourceValue(Res_value* value) const { switch (value->dataType) { case Res_value::TYPE_ATTRIBUTE: resolvedType = Res_value::TYPE_ATTRIBUTE; - // fallthrough + FALLTHROUGH_INTENDED; case Res_value::TYPE_REFERENCE: // Only resolve non-dynamic references and attributes if the package is loaded as a // library or if a shared library is attempting to retrieve its own resource @@ -7015,7 +7017,7 @@ status_t DynamicRefTable::lookupResourceValue(Res_value* value) const { break; case Res_value::TYPE_DYNAMIC_ATTRIBUTE: resolvedType = Res_value::TYPE_ATTRIBUTE; - // fallthrough + FALLTHROUGH_INTENDED; case Res_value::TYPE_DYNAMIC_REFERENCE: break; default: diff --git a/libs/hwui/FrameInfoVisualizer.cpp b/libs/hwui/FrameInfoVisualizer.cpp index 236a6b667f3b..b04c77430367 100644 --- a/libs/hwui/FrameInfoVisualizer.cpp +++ b/libs/hwui/FrameInfoVisualizer.cpp @@ -66,6 +66,7 @@ static int dpToPx(int dp, float density) { FrameInfoVisualizer::FrameInfoVisualizer(FrameInfoSource& source) : mFrameSource(source) { setDensity(1); + consumeProperties(); } FrameInfoVisualizer::~FrameInfoVisualizer() { diff --git a/libs/hwui/hwui/MinikinSkia.cpp b/libs/hwui/hwui/MinikinSkia.cpp index c58bcb34e242..769fce498a70 100644 --- a/libs/hwui/hwui/MinikinSkia.cpp +++ b/libs/hwui/hwui/MinikinSkia.cpp @@ -84,7 +84,7 @@ void MinikinFontSkia::GetFontExtent(minikin::MinikinExtent* extent, const minikin::FontFakery& fakery) const { SkPaint skPaint; MinikinFontSkia_SetSkiaPaint(this, &skPaint, paint, fakery); - SkPaint::FontMetrics metrics; + SkFontMetrics metrics; skPaint.getFontMetrics(&metrics); extent->ascent = metrics.fAscent; extent->descent = metrics.fDescent; diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index 92a749f3da33..f1a522ecd588 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -180,14 +180,20 @@ void CanvasContext::setStopped(bool stopped) { } } -void CanvasContext::setup(float lightRadius, uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha) { - mLightGeometry.radius = lightRadius; +void CanvasContext::allocateBuffers() { + if (mNativeSurface) { + mNativeSurface->allocateBuffers(); + } +} + +void CanvasContext::setLightAlpha(uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha) { mLightInfo.ambientShadowAlpha = ambientShadowAlpha; mLightInfo.spotShadowAlpha = spotShadowAlpha; } -void CanvasContext::setLightCenter(const Vector3& lightCenter) { +void CanvasContext::setLightGeometry(const Vector3& lightCenter, float lightRadius) { mLightGeometry.center = lightCenter; + mLightGeometry.radius = lightRadius; } void CanvasContext::setOpaque(bool opaque) { diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h index 2307ee4801d3..70be4a6d7730 100644 --- a/libs/hwui/renderthread/CanvasContext.h +++ b/libs/hwui/renderthread/CanvasContext.h @@ -113,9 +113,10 @@ public: bool pauseSurface(); void setStopped(bool stopped); bool hasSurface() { return mNativeSurface.get(); } + void allocateBuffers(); - void setup(float lightRadius, uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha); - void setLightCenter(const Vector3& lightCenter); + void setLightAlpha(uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha); + void setLightGeometry(const Vector3& lightCenter, float lightRadius); void setOpaque(bool opaque); void setWideGamut(bool wideGamut); bool makeCurrent(); diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index 54219b5a1489..085812a00f71 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -80,22 +80,16 @@ void RenderProxy::setName(const char* name) { mRenderThread.queue().runSync([this, name]() { mContext->setName(std::string(name)); }); } -void RenderProxy::initialize(const sp<Surface>& surface) { +void RenderProxy::setSurface(const sp<Surface>& surface) { mRenderThread.queue().post( [ this, surf = surface ]() mutable { mContext->setSurface(std::move(surf)); }); } -void RenderProxy::allocateBuffers(const sp<Surface>& surface) { - mRenderThread.queue().post( - [ surf = surface ]() mutable { surf->allocateBuffers(); }); -} - -void RenderProxy::updateSurface(const sp<Surface>& surface) { - mRenderThread.queue().post( - [ this, surf = surface ]() mutable { mContext->setSurface(std::move(surf)); }); +void RenderProxy::allocateBuffers() { + mRenderThread.queue().post([=]() { mContext->allocateBuffers(); }); } -bool RenderProxy::pauseSurface(const sp<Surface>& surface) { +bool RenderProxy::pause() { return mRenderThread.queue().runSync([this]() -> bool { return mContext->pauseSurface(); }); } @@ -103,13 +97,13 @@ void RenderProxy::setStopped(bool stopped) { mRenderThread.queue().runSync([this, stopped]() { mContext->setStopped(stopped); }); } -void RenderProxy::setup(float lightRadius, uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha) { +void RenderProxy::setLightAlpha(uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha) { mRenderThread.queue().post( - [=]() { mContext->setup(lightRadius, ambientShadowAlpha, spotShadowAlpha); }); + [=]() { mContext->setLightAlpha(ambientShadowAlpha, spotShadowAlpha); }); } -void RenderProxy::setLightCenter(const Vector3& lightCenter) { - mRenderThread.queue().post([=]() { mContext->setLightCenter(lightCenter); }); +void RenderProxy::setLightGeometry(const Vector3& lightCenter, float lightRadius) { + mRenderThread.queue().post([=]() { mContext->setLightGeometry(lightCenter, lightRadius); }); } void RenderProxy::setOpaque(bool opaque) { diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h index d29fcc49d7a6..6668c5840c3e 100644 --- a/libs/hwui/renderthread/RenderProxy.h +++ b/libs/hwui/renderthread/RenderProxy.h @@ -69,13 +69,12 @@ public: ANDROID_API bool loadSystemProperties(); ANDROID_API void setName(const char* name); - ANDROID_API void initialize(const sp<Surface>& surface); - ANDROID_API void allocateBuffers(const sp<Surface>& surface); - ANDROID_API void updateSurface(const sp<Surface>& surface); - ANDROID_API bool pauseSurface(const sp<Surface>& surface); + ANDROID_API void setSurface(const sp<Surface>& surface); + ANDROID_API void allocateBuffers(); + ANDROID_API bool pause(); ANDROID_API void setStopped(bool stopped); - ANDROID_API void setup(float lightRadius, uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha); - ANDROID_API void setLightCenter(const Vector3& lightCenter); + ANDROID_API void setLightAlpha(uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha); + ANDROID_API void setLightGeometry(const Vector3& lightCenter, float lightRadius); ANDROID_API void setOpaque(bool opaque); ANDROID_API void setWideGamut(bool wideGamut); ANDROID_API int64_t* frameInfo(); diff --git a/libs/hwui/renderthread/RenderThread.h b/libs/hwui/renderthread/RenderThread.h index 62f704b08771..2384f9541ec0 100644 --- a/libs/hwui/renderthread/RenderThread.h +++ b/libs/hwui/renderthread/RenderThread.h @@ -74,7 +74,7 @@ class RenderThread : private ThreadBase { PREVENT_COPY_AND_ASSIGN(RenderThread); public: - // Sets a callback that fires before any RenderThread setup has occured. + // Sets a callback that fires before any RenderThread setup has occurred. ANDROID_API static void setOnStartHook(void (*onStartHook)()); WorkQueue& queue() { return ThreadBase::queue(); } diff --git a/libs/hwui/tests/macrobench/TestSceneRunner.cpp b/libs/hwui/tests/macrobench/TestSceneRunner.cpp index 5f5a92e55bf2..5fa008b5b4df 100644 --- a/libs/hwui/tests/macrobench/TestSceneRunner.cpp +++ b/libs/hwui/tests/macrobench/TestSceneRunner.cpp @@ -132,10 +132,10 @@ void run(const TestScene::Info& info, const TestScene::Options& opts, ContextFactory factory; std::unique_ptr<RenderProxy> proxy(new RenderProxy(false, rootNode.get(), &factory)); proxy->loadSystemProperties(); - proxy->initialize(surface); + proxy->setSurface(surface); float lightX = width / 2.0; - proxy->setup(dp(800.0f), 255 * 0.075, 255 * 0.15); - proxy->setLightCenter((Vector3){lightX, dp(-200.0f), dp(800.0f)}); + proxy->setLightAlpha(255 * 0.075, 255 * 0.15); + proxy->setLightGeometry((Vector3){lightX, dp(-200.0f), dp(800.0f)}, dp(800.0f)); // Do a few cold runs then reset the stats so that the caches are all hot int warmupFrameCount = 5; |