Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: gpu/ipc/service/direct_composition_surface_win.h

Issue 2646243002: Use IDCompositionSurface to implement DirectCompositionSurfaceWin. (Closed)
Patch Set: more changes Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/ipc/service/direct_composition_surface_win.h
diff --git a/gpu/ipc/service/direct_composition_surface_win.h b/gpu/ipc/service/direct_composition_surface_win.h
index 01fdbb18b650e42f9c10ece9ed20b3abc72594d5..547e76ba3202df598adc26353a98d6c1c647abb7 100644
--- a/gpu/ipc/service/direct_composition_surface_win.h
+++ b/gpu/ipc/service/direct_composition_surface_win.h
@@ -5,7 +5,12 @@
#ifndef GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_
#define GPU_IPC_SERVICE_DIRECT_COMPOSITION_SURFACE_WIN_H_
+#include <d3d11.h>
sunnyps 2017/01/28 01:33:59 nit: group this with <windows.h> or vice-versa.
+#include <dcomp.h>
+
#include "base/memory/weak_ptr.h"
+#include "base/win/scoped_comptr.h"
+#include "gpu/gpu_export.h"
#include "gpu/ipc/service/child_window_win.h"
#include "gpu/ipc/service/image_transport_surface_delegate.h"
#include "ui/gl/gl_image.h"
@@ -15,7 +20,7 @@
namespace gpu {
-class DirectCompositionSurfaceWin : public gl::GLSurfaceEGL {
+class GPU_EXPORT DirectCompositionSurfaceWin : public gl::GLSurfaceEGL {
public:
DirectCompositionSurfaceWin(
base::WeakPtr<ImageTransportSurfaceDelegate> delegate,
@@ -41,7 +46,11 @@ class DirectCompositionSurfaceWin : public gl::GLSurfaceEGL {
gl::GLImage* image,
const gfx::Rect& bounds_rect,
const gfx::RectF& crop_rect) override;
+ bool FlipsVertically() const override;
bool SupportsPostSubBuffer() override;
+ bool OnMakeCurrent(gl::GLContext* context) override;
+ bool SupportsSetDrawRectangle() const override;
+ bool SetDrawRectangle(const gfx::Rect& rect) override;
bool Initialize(std::unique_ptr<gfx::VSyncProvider> vsync_provider);
@@ -67,16 +76,35 @@ class DirectCompositionSurfaceWin : public gl::GLSurfaceEGL {
};
bool CommitAndClearPendingOverlays();
+ void InitializeSurface();
+ void ReleaseDrawTexture();
ChildWindowWin child_window_;
HWND window_;
- EGLSurface surface_;
+ // This is a placeholder surface used when not rendering to the
+ // DirectComposition surface.
+ EGLSurface default_surface_;
sunnyps 2017/01/28 01:33:59 nit: default_surface_ = 0
+
+ // This is the real surface representing the backbuffer. It may be null
+ // outside of a BeginDraw/EndDraw pair.
+ EGLSurface real_surface_;
sunnyps 2017/01/28 01:33:59 nit: real_surface_ = 0
gfx::Size size_;
bool first_swap_;
sunnyps 2017/01/28 01:33:59 nit: first_swap_ = false
std::unique_ptr<gfx::VSyncProvider> vsync_provider_;
std::vector<Overlay> pending_overlays_;
+ base::win::ScopedComPtr<ID3D11Device> d3d11_device_;
+ base::win::ScopedComPtr<IDCompositionDevice2> dcomp_device_;
+ base::win::ScopedComPtr<IDCompositionTarget> dcomp_target_;
+ base::win::ScopedComPtr<IDCompositionVisual2> visual_;
+ base::win::ScopedComPtr<IDCompositionSurface> dcomp_surface_;
+ base::win::ScopedComPtr<ID3D11Texture2D> draw_texture_;
+
+ // Keep track of whether the texture has been rendered to, as the first draw
+ // to it must overwrite the entire thing.
+ bool has_been_rendered_to_ = false;
+
DISALLOW_COPY_AND_ASSIGN(DirectCompositionSurfaceWin);
};

Powered by Google App Engine
This is Rietveld 408576698