1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46

android_webview / browser / gfx / aw_gl_surface_external_stencil.h [blame]

// Copyright 2020 The Chromium Authors
// 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_AW_GL_SURFACE_EXTERNAL_STENCIL_H_
#define ANDROID_WEBVIEW_BROWSER_GFX_AW_GL_SURFACE_EXTERNAL_STENCIL_H_

#include "android_webview/browser/gfx/aw_gl_surface.h"

// Lifetime: WebView
namespace android_webview {
class AwGLSurfaceExternalStencil : public AwGLSurface {
 public:
  AwGLSurfaceExternalStencil(gl::GLDisplayEGL* display, bool is_angle);

  AwGLSurfaceExternalStencil(const AwGLSurfaceExternalStencil&) = delete;
  AwGLSurfaceExternalStencil& operator=(const AwGLSurfaceExternalStencil&) =
      delete;

  unsigned int GetBackingFramebufferObject() override;
  gfx::SwapResult SwapBuffers(
      PresentationCallback callbackaw_gl_surface_external_stencil,
      gfx::FrameData data) override;
  void RecalculateClipAndTransform(gfx::Size* viewport,
                                   gfx::Rect* clip_rect,
                                   gfx::Transform* transform) override;
  bool IsDrawingToFBO() override;
  void DestroyExternalStencilFramebuffer() override;

 protected:
  ~AwGLSurfaceExternalStencil() override;

 private:
  class BlitContext;
  class FrameBuffer;

  // Contains GL shader and other info required to draw a quad.
  std::unique_ptr<BlitContext> blit_context_;
  std::unique_ptr<FrameBuffer> framebuffer_;
  gfx::Rect clip_rect_;
  gfx::Size viewport_;
};

}  // namespace android_webview

#endif  // ANDROID_WEBVIEW_BROWSER_GFX_AW_GL_SURFACE_EXTERNAL_STENCIL_H_