Flutter Engine
The Flutter Engine
surface_texture_external_texture.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_SURFACE_TEXTURE_EXTERNAL_TEXTURE_H_
6#define FLUTTER_SHELL_PLATFORM_ANDROID_SURFACE_TEXTURE_EXTERNAL_TEXTURE_H_
7
8#include <GLES/gl.h>
9
10#include "flutter/common/graphics/texture.h"
11#include "flutter/shell/platform/android/platform_view_android_jni_impl.h"
12
13namespace flutter {
14
15// External texture peered to an android.graphics.SurfaceTexture.
17 public:
19 int64_t id,
20 const fml::jni::ScopedJavaGlobalRef<jobject>& surface_texture,
21 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
22
24
25 void Paint(PaintContext& context,
26 const SkRect& bounds,
27 bool freeze,
28 const DlImageSampling sampling) override;
29
30 void OnGrContextCreated() override;
31
32 void OnGrContextDestroyed() override;
33
34 void MarkNewFrameAvailable() override;
35
36 void OnTextureUnregistered() override;
37
38 protected:
39 virtual void ProcessFrame(PaintContext& context, const SkRect& bounds) = 0;
40 virtual void Detach();
41
42 void Attach(int gl_tex_id);
43 bool ShouldUpdate();
44 void Update();
45
46 enum class AttachmentState { kUninitialized, kAttached, kDetached };
47
48 std::shared_ptr<PlatformViewAndroidJNI> jni_facade_;
53
55};
56
57} // namespace flutter
58
59#endif // FLUTTER_SHELL_PLATFORM_ANDROID_SURFACE_TEXTURE_EXTERNAL_TEXTURE_H_
FML_DISALLOW_COPY_AND_ASSIGN(SurfaceTextureExternalTexture)
SurfaceTextureExternalTexture(int64_t id, const fml::jni::ScopedJavaGlobalRef< jobject > &surface_texture, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade)
void Paint(PaintContext &context, const SkRect &bounds, bool freeze, const DlImageSampling sampling) override
fml::jni::ScopedJavaGlobalRef< jobject > surface_texture_
std::shared_ptr< PlatformViewAndroidJNI > jni_facade_
virtual void ProcessFrame(PaintContext &context, const SkRect &bounds)=0
Optional< SkRect > bounds
Definition: SkRecords.h:189
SkSamplingOptions sampling
Definition: SkRecords.h:337