5#include "flutter/shell/platform/android/image_external_texture.h"
7#include <android/hardware_buffer_jni.h>
8#include <android/sensor.h>
10#include "flutter/fml/platform/android/jni_util.h"
11#include "flutter/impeller/toolkit/android/proc_table.h"
12#include "flutter/shell/platform/android/jni/platform_view_android_jni.h"
19 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
21 image_texture_entry_(image_texture_entry),
22 jni_facade_(jni_facade) {}
33 const bool should_process_frame = !freeze;
34 if (should_process_frame) {
47 FML_LOG(INFO) <<
"No DlImage available for ImageExternalTexture to paint.";
80 jni_facade_->ImageProducerTextureEntryAcquireLatestImage(
86 if (
image.obj() ==
nullptr) {
94 if (hardware_buffer.
obj() ==
nullptr) {
102 if (
image.obj() ==
nullptr) {
115 return proc ? proc(
env, hardware_buffer.
obj()) :
nullptr;
struct AHardwareBuffer AHardwareBuffer
virtual void DrawImageRect(const sk_sp< DlImage > &image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast)=0
void MarkNewFrameAvailable() override
AHardwareBuffer * AHardwareBufferFor(const fml::jni::JavaRef< jobject > &hardware_buffer)
JavaLocalRef HardwareBufferFor(const fml::jni::JavaRef< jobject > &image)
void OnTextureUnregistered() override
virtual void ProcessFrame(PaintContext &context, const SkRect &bounds)=0
void CloseHardwareBuffer(const fml::jni::JavaRef< jobject > &hardware_buffer)
sk_sp< flutter::DlImage > dl_image_
void CloseImage(const fml::jni::JavaRef< jobject > &image)
void OnGrContextDestroyed() override
virtual void Attach(PaintContext &context)=0
std::shared_ptr< PlatformViewAndroidJNI > jni_facade_
ImageExternalTexture(int64_t id, const fml::jni::ScopedJavaGlobalRef< jobject > &image_texture_entry, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade)
void Paint(PaintContext &context, const SkRect &bounds, bool freeze, const DlImageSampling sampling) override
JavaLocalRef AcquireLatestImage()
fml::jni::ScopedJavaGlobalRef< jobject > image_texture_entry_
void OnGrContextCreated() override
void Clear()
Remove all entires from the image cache.
void reset(T *ptr=nullptr)
#define FML_LOG(severity)
#define FML_CHECK(condition)
Optional< SkRect > bounds
sk_sp< const SkImage > image
SkSamplingOptions sampling
std::nullptr_t JavaLocalRef
JNIEnv * AttachCurrentThread()
const ProcTable & GetProcTable()
static SkRect Make(const SkISize &size)