Commit d7b75007 authored by Peng Huang's avatar Peng Huang Committed by Chromium LUCI CQ

android_webview: move ScopedAppGLStateRestoreImpl to a separate files

Bug: 1157501
Change-Id: I6f2035076423e5077bea0c295ef9211ac439cf20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2634836
Commit-Queue: Peng Huang <penghuang@chromium.org>
Auto-Submit: Peng Huang <penghuang@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844919}
parent 07ed5f6e
......@@ -60,6 +60,8 @@ source_set("gfx") {
"root_frame_sink_proxy.h",
"scoped_app_gl_state_restore.cc",
"scoped_app_gl_state_restore.h",
"scoped_app_gl_state_restore_impl.cc",
"scoped_app_gl_state_restore_impl.h",
"skia_output_surface_dependency_webview.cc",
"skia_output_surface_dependency_webview.h",
"surfaces_instance.cc",
......
......@@ -59,10 +59,10 @@ void AwGLSurface::SetSize(const gfx::Size& size) {
size_ = size;
}
void AwGLSurface::MaybeDidPresent(gfx::PresentationFeedback feedback) {
void AwGLSurface::MaybeDidPresent(const gfx::PresentationFeedback& feedback) {
if (!pending_presentation_callback_)
return;
std::move(pending_presentation_callback_).Run(std::move(feedback));
std::move(pending_presentation_callback_).Run(feedback);
}
} // namespace android_webview
......@@ -34,7 +34,7 @@ class AwGLSurface : public gl::GLSurface {
bool has_alpha) override;
void SetSize(const gfx::Size& size);
void MaybeDidPresent(gfx::PresentationFeedback feedback);
void MaybeDidPresent(const gfx::PresentationFeedback& feedback);
virtual void RecalculateClipAndTransform(gfx::Size* viewport,
gfx::Rect* clip_rect,
......
......@@ -12,10 +12,6 @@
namespace android_webview {
namespace internal {
class ScopedAppGLStateRestoreImpl;
}
struct StencilState {
unsigned char stencil_test_enabled;
int stencil_front_func;
......@@ -51,8 +47,21 @@ class ScopedAppGLStateRestore {
StencilState stencil_state() const;
int framebuffer_binding_ext() const;
class Impl {
public:
Impl();
virtual ~Impl();
const StencilState& stencil_state() const { return stencil_state_; }
int framebuffer_binding_ext() const { return framebuffer_binding_ext_; }
protected:
StencilState stencil_state_{};
int framebuffer_binding_ext_ = 0;
};
private:
std::unique_ptr<internal::ScopedAppGLStateRestoreImpl> impl_;
std::unique_ptr<Impl> impl_;
DISALLOW_COPY_AND_ASSIGN(ScopedAppGLStateRestore);
};
......
// Copyright 2021 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 ANDROID_WEBVIEW_BROWSER_GFX_SCOPED_APP_GL_STATE_RESTORE_IMPL_H_
#define ANDROID_WEBVIEW_BROWSER_GFX_SCOPED_APP_GL_STATE_RESTORE_IMPL_H_
#include <memory>
#include <vector>
#include "android_webview/browser/gfx/scoped_app_gl_state_restore.h"
#include "base/macros.h"
#include "ui/gl/gl_bindings.h"
namespace android_webview {
namespace internal {
class ScopedAppGLStateRestoreImpl : public ScopedAppGLStateRestore::Impl {
public:
ScopedAppGLStateRestoreImpl(ScopedAppGLStateRestore::CallMode mode,
bool save_restore);
~ScopedAppGLStateRestoreImpl() override;
protected:
void SaveHWUIState();
void RestoreHWUIState();
const ScopedAppGLStateRestore::CallMode mode_;
const bool save_restore_;
GLint pack_alignment_;
GLint unpack_alignment_;
struct VertexAttributes {
GLint enabled;
GLint size;
GLint type;
GLint normalized;
GLint stride;
GLvoid* pointer;
GLint vertex_attrib_array_buffer_binding;
GLfloat current_vertex_attrib[4];
};
std::vector<VertexAttributes> vertex_attrib_;
GLint vertex_array_buffer_binding_;
GLint index_array_buffer_binding_;
GLboolean depth_test_;
GLboolean cull_face_;
GLint cull_face_mode_;
GLboolean color_mask_[4];
GLfloat color_clear_[4];
GLfloat blend_color_[4];
GLfloat depth_clear_;
GLint current_program_;
GLint depth_func_;
GLboolean depth_mask_;
GLfloat depth_rage_[2];
GLint front_face_;
GLint hint_generate_mipmap_;
GLfloat line_width_;
GLfloat polygon_offset_factor_;
GLfloat polygon_offset_units_;
GLfloat sample_coverage_value_;
GLboolean sample_coverage_invert_;
GLint blend_equation_rgb_;
GLint blend_equation_alpha_;
GLboolean enable_dither_;
GLboolean enable_polygon_offset_fill_;
GLboolean enable_sample_alpha_to_coverage_;
GLboolean enable_sample_coverage_;
GLboolean multisample_enabled_;
// ARM_shader_framebuffer_fetch
GLboolean fetch_per_sample_arm_enabled_;
// Not saved/restored in MODE_DRAW.
GLboolean blend_enabled_;
GLint blend_src_rgb_;
GLint blend_src_alpha_;
GLint blend_dest_rgb_;
GLint blend_dest_alpha_;
GLint active_texture_;
GLint viewport_[4];
GLboolean scissor_test_;
GLint scissor_box_[4];
struct TextureBindings {
GLint texture_2d;
GLint texture_cube_map;
GLint texture_external_oes;
// TODO(boliu): TEXTURE_RECTANGLE_ARB
};
std::vector<TextureBindings> texture_bindings_;
GLint vertex_array_bindings_oes_;
DISALLOW_COPY_AND_ASSIGN(ScopedAppGLStateRestoreImpl);
};
} // namespace internal
} // namespace android_webview
#endif // ANDROID_WEBVIEW_BROWSER_GFX_SCOPED_APP_GL_STATE_RESTORE_IMPL_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment