flutter_flutter/shell/platform/android/android_external_texture_gl.h
Alexander Aprelev 0a93f9ffbf
Revert "Apply transform to textures on android (#4486)" (#4502)
This reverts commit eee4a1ed821e98922476f2ce0b1e99ce1a606704.

Original commit caused external_ui integration test failure on Android.
2018-01-02 13:40:27 -08:00

54 lines
1.3 KiB
C++

// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_EXTERNAL_TEXTURE_GL_H_
#define FLUTTER_SHELL_PLATFORM_ANDROID_EXTERNAL_TEXTURE_GL_H_
#include <GLES/gl.h>
#include "flutter/flow/texture.h"
#include "flutter/fml/platform/android/jni_weak_ref.h"
namespace shell {
class AndroidExternalTextureGL : public flow::Texture {
public:
AndroidExternalTextureGL(
int64_t id,
const fml::jni::JavaObjectWeakGlobalRef& surfaceTexture);
~AndroidExternalTextureGL() override;
virtual void Paint(SkCanvas& canvas, const SkRect& bounds) override;
virtual void OnGrContextCreated() override;
virtual void OnGrContextDestroyed() override;
// Called on GPU thread.
void MarkNewFrameAvailable();
private:
void Attach(jint textureName);
void Update();
void Detach();
enum class AttachmentState { uninitialized, attached, detached };
fml::jni::JavaObjectWeakGlobalRef surface_texture_;
AttachmentState state_ = AttachmentState::uninitialized;
bool new_frame_ready_ = false;
GLuint texture_name_ = 0;
FXL_DISALLOW_COPY_AND_ASSIGN(AndroidExternalTextureGL);
};
} // namespace shell
#endif // FLUTTER_SHELL_PLATFORM_ANDROID_EXTERNAL_TEXTURE_GL_H_