Fix build break
[chromium-blink-merge.git] / ui / surface / d3d9_utils_win.h
blob4f11a3a95cc6d84f6d9ce11cda501d1805441947
1 // Copyright (c) 2012 The Chromium 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.
5 // Helper functions that Direct3D 9Ex code a little easier to work with for
6 // the ui/surface code.
8 #ifndef UI_SURFACE_D3D9_UTILS_WIN_H_
9 #define UI_SURFACE_D3D9_UTILS_WIN_H_
11 #include <d3d9.h>
13 #include "base/basictypes.h"
14 #include "ui/surface/surface_export.h"
16 namespace base {
17 class ScopedNativeLibrary;
20 namespace gfx {
21 class Size;
24 namespace ui_surface_d3d9_utils {
26 // Visible for testing. Loads the Direct3D9 library. Returns true on success.
27 SURFACE_EXPORT
28 bool LoadD3D9(base::ScopedNativeLibrary* storage);
30 // Visible for testing. Creates a Direct3D9 device suitable for use with the
31 // accelerated surface code. Returns true on success.
32 SURFACE_EXPORT
33 bool CreateDevice(const base::ScopedNativeLibrary& d3d_module,
34 D3DDEVTYPE device_type,
35 uint32 presentation_interval,
36 IDirect3DDevice9Ex** device);
38 // Calls the Vista+ (WDDM1.0) variant of CreateTexture that semantically
39 // opens a texture allocated (possibly in another process) as shared. The
40 // shared texture is identified by its surface handle. The resulting texture
41 // is written into |opened_texture|.
43 // Returns true on success.
44 SURFACE_EXPORT
45 bool OpenSharedTexture(IDirect3DDevice9* device,
46 int64 surface_handle,
47 const gfx::Size& size,
48 IDirect3DTexture9** opened_texture);
50 // Create a one-off lockable surface of a specified size.
52 // Returns true on success.
53 SURFACE_EXPORT
54 bool CreateTemporaryLockableSurface(IDirect3DDevice9* device,
55 const gfx::Size& size,
56 IDirect3DSurface9** surface);
58 // Create a one-off renderable texture of a specified size. The texture object
59 // as well as the surface object for the texture's level 0 is returned (callers
60 // almost always need to use both).
62 // Returns true on success.
63 SURFACE_EXPORT
64 bool CreateTemporaryRenderTargetTexture(IDirect3DDevice9* device,
65 const gfx::Size& size,
66 IDirect3DTexture9** texture,
67 IDirect3DSurface9** render_target);
69 SURFACE_EXPORT
70 gfx::Size GetSize(IDirect3DTexture9* texture);
72 SURFACE_EXPORT
73 gfx::Size GetSize(IDirect3DSurface9* surface);
75 } // namespace ui_surface_d3d9_utils
77 #endif // UI_SURFACE_D3D9_UTILS_WIN_H_