OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/surface/d3d9_utils_win.h" | 5 #include "ui/surface/d3d9_utils_win.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/scoped_native_library.h" | 8 #include "base/scoped_native_library.h" |
9 #include "base/win/scoped_comptr.h" | 9 #include "base/win/scoped_comptr.h" |
10 #include "ui/gfx/size.h" | 10 #include "ui/gfx/size.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 D3DFMT_A8R8G8B8, | 109 D3DFMT_A8R8G8B8, |
110 D3DPOOL_DEFAULT, | 110 D3DPOOL_DEFAULT, |
111 texture, | 111 texture, |
112 NULL); | 112 NULL); |
113 if (!SUCCEEDED(hr)) | 113 if (!SUCCEEDED(hr)) |
114 return false; | 114 return false; |
115 hr = (*texture)->GetSurfaceLevel(0, render_target); | 115 hr = (*texture)->GetSurfaceLevel(0, render_target); |
116 return SUCCEEDED(hr); | 116 return SUCCEEDED(hr); |
117 } | 117 } |
118 | 118 |
| 119 gfx::Size GetSize(IDirect3DSurface9* surface) { |
| 120 D3DSURFACE_DESC surface_description; |
| 121 HRESULT hr = surface->GetDesc(&surface_description); |
| 122 if (FAILED(hr)) |
| 123 return gfx::Size(0, 0); |
| 124 return gfx::Size(surface_description.Width, surface_description.Height); |
| 125 } |
| 126 |
| 127 gfx::Size GetSize(IDirect3DTexture9* texture) { |
| 128 D3DSURFACE_DESC surface_description; |
| 129 HRESULT hr = texture->GetLevelDesc(0, &surface_description); |
| 130 if (FAILED(hr)) |
| 131 return gfx::Size(0, 0); |
| 132 return gfx::Size(surface_description.Width, surface_description.Height); |
| 133 } |
| 134 |
119 } // namespace ui_surface_d3d9_utils | 135 } // namespace ui_surface_d3d9_utils |
OLD | NEW |