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

Side by Side Diff: ui/surface/accelerated_surface_transformer_win.h

Issue 11464017: Separate image processing logic from presentation logic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed dependencies of surface_gpu_tests. Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/surface/accelerated_surface_transformer_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef UI_SURFACE_ACCELERATED_SURFACE_TRANSFORMER_WIN_H_
6 #define UI_SURFACE_ACCELERATED_SURFACE_TRANSFORMER_WIN_H_
7
8 #include <d3d9.h>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/single_thread_task_runner.h"
12 #include "base/synchronization/lock.h"
13 #include "base/synchronization/waitable_event.h"
14 #include "base/win/scoped_comptr.h"
15 #include "ui/gfx/native_widget_types.h"
16 #include "ui/gfx/size.h"
17 #include "ui/surface/surface_export.h"
18
19 namespace gfx {
20 class Size;
21 class Rect;
22 } // namespace gfx
23
24 // Provides useful image filtering operations that are implemented
25 // efficiently on DirectX9-class hardware using fragment programs.
26 class SURFACE_EXPORT AcceleratedSurfaceTransformer {
27 public:
28 // Constructs an uninitialized surface transformer. Call Init() before
29 // using the resulting object.
30 AcceleratedSurfaceTransformer();
31
32 // Init() initializes the transformer to operate on a device. This must be
33 // called before any other method of this class, and it must be called
34 // again after ReleaseAll() or DetachAll() before the class is used.
35 //
36 // Returns true if successful.
37 bool Init(IDirect3DDevice9* device);
38
39 // ReleaseAll() releases all direct3d resource references.
40 void ReleaseAll();
41
42 // DetachAll() leaks all direct3d resource references. This exists in order to
43 // work around particular driver bugs, and should only be called at shutdown.
44 // TODO(ncarter): Update the leak expectations before checkin.
45 void DetachAll();
46
47 // Draw a textured quad to a surface, flipping orientation in the y direction.
48 bool CopyInverted(
49 IDirect3DTexture9* src_texture,
50 IDirect3DSurface9* dst_surface,
51 const gfx::Size& dst_size);
52
53 // Resize a surface using repeated bilinear interpolation.
54 bool ResizeBilinear(
55 IDirect3DSurface9* src_surface,
56 const gfx::Rect& src_subrect,
57 IDirect3DSurface9* dst_surface);
58
59 private:
60 enum ShaderCombo {
61 SIMPLE_TEXTURE,
62 NUM_SHADERS
63 };
64
65 // Set the active vertex and pixel shader combination.
66 bool SetShaderCombo(ShaderCombo combo);
67
68 // Intitializes a vertex and pixel shader combination from compiled bytecode.
69 bool InitShaderCombo(const BYTE vertex_shader_instructions[],
70 const BYTE pixel_shader_instructions[],
71 ShaderCombo shader_combo_name);
72
73 IDirect3DDevice9* device();
74
75 base::win::ScopedComPtr<IDirect3DDevice9> device_;
76 base::win::ScopedComPtr<IDirect3DVertexShader9> vertex_shaders_[NUM_SHADERS];
77 base::win::ScopedComPtr<IDirect3DPixelShader9> pixel_shaders_[NUM_SHADERS];
78 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceTransformer);
79 };
80
81 #endif // UI_SURFACE_ACCELERATED_SURFACE_TRANSFORMER_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | ui/surface/accelerated_surface_transformer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698