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 #ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "content/public/browser/android/compositor.h" | 11 #include "content/public/browser/android/compositor.h" |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli
ent.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli
ent.h" |
15 | 15 |
| 16 |
16 struct ANativeWindow; | 17 struct ANativeWindow; |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 class GraphicsContext; | 20 class GraphicsContext; |
20 | 21 |
21 // ----------------------------------------------------------------------------- | 22 // ----------------------------------------------------------------------------- |
22 // Browser-side compositor that manages a tree of content and UI layers. | 23 // Browser-side compositor that manages a tree of content and UI layers. |
23 // ----------------------------------------------------------------------------- | 24 // ----------------------------------------------------------------------------- |
24 class CompositorImpl : public Compositor, | 25 class CompositorImpl : public Compositor, |
25 public WebKit::WebLayerTreeViewClient { | 26 public WebKit::WebLayerTreeViewClient { |
26 public: | 27 public: |
27 CompositorImpl(); | 28 CompositorImpl(); |
28 virtual ~CompositorImpl(); | 29 virtual ~CompositorImpl(); |
29 | 30 |
30 static bool IsInitialized(); | 31 static bool IsInitialized(); |
31 | 32 |
32 // Compositor implementation. | 33 // Compositor implementation. |
33 virtual void SetRootLayer(WebKit::WebLayer* root) OVERRIDE; | 34 virtual void SetRootLayer(WebKit::WebLayer* root) OVERRIDE; |
34 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; | 35 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE; |
35 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE; | 36 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE; |
36 virtual bool CompositeAndReadback( | 37 virtual bool CompositeAndReadback( |
37 void *pixels, const gfx::Rect& rect) OVERRIDE; | 38 void *pixels, const gfx::Rect& rect) OVERRIDE; |
38 virtual void OnSurfaceUpdated( | 39 virtual void OnSurfaceUpdated( |
39 const SurfacePresentedCallback& callback) OVERRIDE; | 40 const SurfacePresentedCallback& callback) OVERRIDE; |
| 41 virtual WebKit::WebGLId GenerateTexture(gfx::JavaBitmap& bitmap) OVERRIDE; |
| 42 virtual WebKit::WebGLId GenerateCompressedTexture( |
| 43 gfx::Size& size, int data_size, void* data) OVERRIDE; |
| 44 virtual bool DeleteTexture(WebKit::WebGLId texture_id) OVERRIDE; |
40 | 45 |
41 // WebLayerTreeViewClient implementation. | 46 // WebLayerTreeViewClient implementation. |
42 virtual void updateAnimations(double frameBeginTime) OVERRIDE; | 47 virtual void updateAnimations(double frameBeginTime) OVERRIDE; |
43 virtual void layout() OVERRIDE; | 48 virtual void layout() OVERRIDE; |
44 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, | 49 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, |
45 float scaleFactor) OVERRIDE; | 50 float scaleFactor) OVERRIDE; |
46 virtual WebKit::WebCompositorOutputSurface* createOutputSurface() OVERRIDE; | 51 virtual WebKit::WebCompositorOutputSurface* createOutputSurface() OVERRIDE; |
47 virtual void didRecreateOutputSurface(bool success) OVERRIDE; | 52 virtual void didRecreateOutputSurface(bool success) OVERRIDE; |
48 virtual void didCommit() OVERRIDE; | 53 virtual void didCommit() OVERRIDE; |
49 virtual void didCommitAndDrawFrame() OVERRIDE; | 54 virtual void didCommitAndDrawFrame() OVERRIDE; |
50 virtual void didCompleteSwapBuffers() OVERRIDE; | 55 virtual void didCompleteSwapBuffers() OVERRIDE; |
51 virtual void scheduleComposite() OVERRIDE; | 56 virtual void scheduleComposite() OVERRIDE; |
52 | 57 |
53 private: | 58 private: |
| 59 WebKit::WebGLId BuildBasicTexture(); |
| 60 WebKit::WGC3Denum GetGLFormatForBitmap(gfx::JavaBitmap& bitmap); |
| 61 WebKit::WGC3Denum GetGLTypeForBitmap(gfx::JavaBitmap& bitmap); |
| 62 |
54 scoped_ptr<WebKit::WebLayer> root_layer_; | 63 scoped_ptr<WebKit::WebLayer> root_layer_; |
55 scoped_ptr<WebKit::WebLayerTreeView> host_; | 64 scoped_ptr<WebKit::WebLayerTreeView> host_; |
56 | 65 |
57 gfx::Size size_; | 66 gfx::Size size_; |
58 | 67 |
59 ANativeWindow* window_; | 68 ANativeWindow* window_; |
60 int surface_id_; | 69 int surface_id_; |
61 | 70 |
62 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | 71 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
63 }; | 72 }; |
64 | 73 |
65 } // namespace content | 74 } // namespace content |
66 | 75 |
67 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 76 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
OLD | NEW |