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 explicit CompositorImpl(Compositor::Client* client); | 28 explicit CompositorImpl(Compositor::Client* client); |
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 Composite() OVERRIDE; | 39 virtual void Composite() OVERRIDE; |
| 40 virtual WebKit::WebGLId GenerateTexture(gfx::JavaBitmap& bitmap) OVERRIDE; |
| 41 virtual WebKit::WebGLId GenerateCompressedTexture( |
| 42 gfx::Size& size, int data_size, void* data) OVERRIDE; |
| 43 virtual void DeleteTexture(WebKit::WebGLId texture_id) OVERRIDE; |
39 | 44 |
40 // WebLayerTreeViewClient implementation. | 45 // WebLayerTreeViewClient implementation. |
41 virtual void updateAnimations(double frameBeginTime) OVERRIDE; | 46 virtual void updateAnimations(double frameBeginTime) OVERRIDE; |
42 virtual void layout() OVERRIDE; | 47 virtual void layout() OVERRIDE; |
43 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, | 48 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, |
44 float scaleFactor) OVERRIDE; | 49 float scaleFactor) OVERRIDE; |
45 virtual WebKit::WebCompositorOutputSurface* createOutputSurface() OVERRIDE; | 50 virtual WebKit::WebCompositorOutputSurface* createOutputSurface() OVERRIDE; |
46 virtual void didRecreateOutputSurface(bool success) OVERRIDE; | 51 virtual void didRecreateOutputSurface(bool success) OVERRIDE; |
47 virtual void didCommit() OVERRIDE; | 52 virtual void didCommit() OVERRIDE; |
48 virtual void didCommitAndDrawFrame() OVERRIDE; | 53 virtual void didCommitAndDrawFrame() OVERRIDE; |
49 virtual void didCompleteSwapBuffers() OVERRIDE; | 54 virtual void didCompleteSwapBuffers() OVERRIDE; |
50 virtual void scheduleComposite() OVERRIDE; | 55 virtual void scheduleComposite() OVERRIDE; |
51 | 56 |
52 private: | 57 private: |
| 58 WebKit::WebGLId BuildBasicTexture(); |
| 59 WebKit::WGC3Denum GetGLFormatForBitmap(gfx::JavaBitmap& bitmap); |
| 60 WebKit::WGC3Denum GetGLTypeForBitmap(gfx::JavaBitmap& bitmap); |
| 61 |
53 scoped_ptr<WebKit::WebLayer> root_layer_; | 62 scoped_ptr<WebKit::WebLayer> root_layer_; |
54 scoped_ptr<WebKit::WebLayerTreeView> host_; | 63 scoped_ptr<WebKit::WebLayerTreeView> host_; |
55 | 64 |
56 gfx::Size size_; | 65 gfx::Size size_; |
57 | 66 |
58 ANativeWindow* window_; | 67 ANativeWindow* window_; |
59 int surface_id_; | 68 int surface_id_; |
60 | 69 |
61 Compositor::Client* client_; | 70 Compositor::Client* client_; |
62 | 71 |
63 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | 72 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
64 }; | 73 }; |
65 | 74 |
66 } // namespace content | 75 } // namespace content |
67 | 76 |
68 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 77 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
OLD | NEW |