summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/jni/android_view_Surface.cpp8
-rw-r--r--libs/hostgraphics/ANativeWindow.cpp6
-rw-r--r--libs/hostgraphics/gui/Surface.h5
-rw-r--r--libs/hwui/utils/Color.cpp4
-rw-r--r--libs/hwui/utils/Color.h2
5 files changed, 10 insertions, 15 deletions
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 7c78f7b09937..0190f9ecc0bf 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -60,9 +60,7 @@ namespace android {
static const char* const IllegalArgumentException = "java/lang/IllegalArgumentException";
-#ifdef __ANDROID__
static const char* const OutOfResourcesException = "android/view/Surface$OutOfResourcesException";
-#endif
static struct {
jclass clazz;
@@ -204,7 +202,6 @@ static jboolean nativeIsConsumerRunningBehind(JNIEnv* env, jclass clazz, jlong n
static jlong nativeLockCanvas(JNIEnv* env, jclass clazz,
jlong nativeObject, jobject canvasObj, jobject dirtyRectObj) {
-#ifdef __ANDROID__ // host does not support locking Canvas
sp<Surface> surface(reinterpret_cast<Surface *>(nativeObject));
if (!isSurfaceValid(surface)) {
@@ -256,14 +253,10 @@ static jlong nativeLockCanvas(JNIEnv* env, jclass clazz,
sp<Surface> lockedSurface(surface);
lockedSurface->incStrong(&sRefBaseOwner);
return (jlong) lockedSurface.get();
-#else
- return (jlong)nativeObject;
-#endif
}
static void nativeUnlockCanvasAndPost(JNIEnv* env, jclass clazz,
jlong nativeObject, jobject canvasObj) {
-#ifdef __ANDROID__ // host does not support locking Canvas
sp<Surface> surface(reinterpret_cast<Surface *>(nativeObject));
if (!isSurfaceValid(surface)) {
return;
@@ -278,7 +271,6 @@ static void nativeUnlockCanvasAndPost(JNIEnv* env, jclass clazz,
if (err < 0) {
jniThrowException(env, IllegalArgumentException, NULL);
}
-#endif
}
static void nativeAllocateBuffers(JNIEnv* /* env */ , jclass /* clazz */,
diff --git a/libs/hostgraphics/ANativeWindow.cpp b/libs/hostgraphics/ANativeWindow.cpp
index b7b8732b3f0d..442a49ae48dd 100644
--- a/libs/hostgraphics/ANativeWindow.cpp
+++ b/libs/hostgraphics/ANativeWindow.cpp
@@ -92,6 +92,10 @@ int32_t ANativeWindow_getHeight(ANativeWindow* window) {
return query(window, NATIVE_WINDOW_HEIGHT);
}
+int32_t ANativeWindow_getFormat(ANativeWindow* window) {
+ return query(window, NATIVE_WINDOW_FORMAT);
+}
+
void ANativeWindow_acquire(ANativeWindow* window) {
// incStrong/decStrong token must be the same, doesn't matter what it is
window->incStrong((void*)ANativeWindow_acquire);
@@ -100,4 +104,4 @@ void ANativeWindow_acquire(ANativeWindow* window) {
void ANativeWindow_release(ANativeWindow* window) {
// incStrong/decStrong token must be the same, doesn't matter what it is
window->decStrong((void*)ANativeWindow_acquire);
-} \ No newline at end of file
+}
diff --git a/libs/hostgraphics/gui/Surface.h b/libs/hostgraphics/gui/Surface.h
index 664657bff92d..170b3eeac779 100644
--- a/libs/hostgraphics/gui/Surface.h
+++ b/libs/hostgraphics/gui/Surface.h
@@ -61,6 +61,11 @@ public:
status_t setDequeueTimeout(nsecs_t timeout) { return OK; }
nsecs_t getLastDequeueStartTime() const { return 0; }
+
+ int getBuffersDataSpace() {
+ return 0;
+ }
+
protected:
virtual ~Surface() {}
diff --git a/libs/hwui/utils/Color.cpp b/libs/hwui/utils/Color.cpp
index 5d9f2297c15a..35b0967a315c 100644
--- a/libs/hwui/utils/Color.cpp
+++ b/libs/hwui/utils/Color.cpp
@@ -19,10 +19,8 @@
#include <ui/ColorSpace.h>
#include <utils/Log.h>
-#ifdef __ANDROID__ // Layoutlib does not support hardware buffers or native windows
#include <android/hardware_buffer.h>
#include <android/native_window.h>
-#endif
#include <algorithm>
#include <cmath>
@@ -31,7 +29,6 @@
namespace android {
namespace uirenderer {
-#ifdef __ANDROID__ // Layoutlib does not support hardware buffers or native windows
static inline SkImageInfo createImageInfo(int32_t width, int32_t height, int32_t format,
sk_sp<SkColorSpace> colorSpace) {
SkColorType colorType = kUnknown_SkColorType;
@@ -95,7 +92,6 @@ uint32_t ColorTypeToBufferFormat(SkColorType colorType) {
return AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM;
}
}
-#endif
namespace {
static constexpr skcms_TransferFunction k2Dot6 = {2.6f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
diff --git a/libs/hwui/utils/Color.h b/libs/hwui/utils/Color.h
index 1654072fd264..15b4519d1889 100644
--- a/libs/hwui/utils/Color.h
+++ b/libs/hwui/utils/Color.h
@@ -90,7 +90,6 @@ static constexpr float EOCF_sRGB(float srgb) {
return srgb <= 0.04045f ? srgb / 12.92f : powf((srgb + 0.055f) / 1.055f, 2.4f);
}
-#ifdef __ANDROID__ // Layoutlib does not support hardware buffers or native windows
SkImageInfo ANativeWindowToImageInfo(const ANativeWindow_Buffer& buffer,
sk_sp<SkColorSpace> colorSpace);
@@ -98,7 +97,6 @@ SkImageInfo BufferDescriptionToImageInfo(const AHardwareBuffer_Desc& bufferDesc,
sk_sp<SkColorSpace> colorSpace);
uint32_t ColorTypeToBufferFormat(SkColorType colorType);
-#endif
ANDROID_API sk_sp<SkColorSpace> DataSpaceToColorSpace(android_dataspace dataspace);