diff options
author | Jerome Gaillard <jgaillard@google.com> | 2019-05-14 14:34:46 +0100 |
---|---|---|
committer | Jerome Gaillard <jgaillard@google.com> | 2019-05-29 15:48:53 +0100 |
commit | 21e7e2d9b13ef1d381b7b0f41f1cac6a947e9bdb (patch) | |
tree | 332f758f08cdbd093fe46190db6d0cbd87b1a5a8 /libs/hwui/VectorDrawable.cpp | |
parent | ca03699276bfe799ac1fc038696d22258d31e8bf (diff) |
Build native android graphics library for desktop
The purpose of this is to be able to use the native graphics code from
the Android platform directly in Android Studio (running on desktop) to
do layout rendering.
This creates a host library that is a subset of libandroid_runtime
including only the JNI files relevant to Android graphics. It also
includes LayoutlibLoader.cpp which is used to load the JNI when using
it as part of layoutlib (the graphics library for Android Studio).
This also creates libhwui-host, a host library that is a subset of
libhwui.
Bug: 117921091
Test: lunch sdk && m libandroid_runtime
Change-Id: I3850020d2d4c13c85e377476bc463d3eb6a01c6d
Diffstat (limited to 'libs/hwui/VectorDrawable.cpp')
-rw-r--r-- | libs/hwui/VectorDrawable.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/hwui/VectorDrawable.cpp b/libs/hwui/VectorDrawable.cpp index 5418b337c371..89ad1b99c6b6 100644 --- a/libs/hwui/VectorDrawable.cpp +++ b/libs/hwui/VectorDrawable.cpp @@ -487,6 +487,7 @@ Bitmap& Tree::getBitmapUpdateIfDirty() { } void Tree::updateCache(sp<skiapipeline::VectorDrawableAtlas>& atlas, GrContext* context) { +#ifdef __ANDROID__ // Layoutlib does not support hardware acceleration SkRect dst; sk_sp<SkSurface> surface = mCache.getSurface(&dst); bool canReuseSurface = surface && dst.width() >= mProperties.getScaledWidth() && @@ -514,6 +515,7 @@ void Tree::updateCache(sp<skiapipeline::VectorDrawableAtlas>& atlas, GrContext* } mCache.dirty = false; } +#endif } void Tree::Cache::setAtlas(sp<skiapipeline::VectorDrawableAtlas> newAtlas, @@ -526,6 +528,7 @@ void Tree::Cache::setAtlas(sp<skiapipeline::VectorDrawableAtlas> newAtlas, sk_sp<SkSurface> Tree::Cache::getSurface(SkRect* bounds) { sk_sp<SkSurface> surface; +#ifdef __ANDROID__ // Layoutlib does not support hardware acceleration sp<skiapipeline::VectorDrawableAtlas> atlas = mAtlas.promote(); if (atlas.get() && mAtlasKey != INVALID_ATLAS_KEY) { auto atlasEntry = atlas->getEntry(mAtlasKey); @@ -533,17 +536,20 @@ sk_sp<SkSurface> Tree::Cache::getSurface(SkRect* bounds) { surface = atlasEntry.surface; mAtlasKey = atlasEntry.key; } +#endif return surface; } void Tree::Cache::clear() { +#ifdef __ANDROID__ // Layoutlib does not support hardware acceleration sp<skiapipeline::VectorDrawableAtlas> lockAtlas = mAtlas.promote(); if (lockAtlas.get()) { lockAtlas->releaseEntry(mAtlasKey); } mAtlas = nullptr; mAtlasKey = INVALID_ATLAS_KEY; +#endif } void Tree::draw(SkCanvas* canvas, const SkRect& bounds, const SkPaint& inPaint) { |