OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 16 matching lines...) Expand all Loading... |
27 #ifndef LayerTextureUpdaterCanvas_h | 27 #ifndef LayerTextureUpdaterCanvas_h |
28 #define LayerTextureUpdaterCanvas_h | 28 #define LayerTextureUpdaterCanvas_h |
29 | 29 |
30 #if USE(ACCELERATED_COMPOSITING) | 30 #if USE(ACCELERATED_COMPOSITING) |
31 | 31 |
32 #include "GraphicsTypes3D.h" | 32 #include "GraphicsTypes3D.h" |
33 #include "LayerTextureSubImage.h" | 33 #include "LayerTextureSubImage.h" |
34 #include "LayerTextureUpdater.h" | 34 #include "LayerTextureUpdater.h" |
35 #include "PlatformCanvas.h" | 35 #include "PlatformCanvas.h" |
36 #include <wtf/PassOwnPtr.h> | 36 #include <wtf/PassOwnPtr.h> |
| 37 #include <wtf/PassRefPtr.h> |
37 | 38 |
38 #if USE(SKIA) | 39 #if USE(SKIA) |
39 #include "SkPicture.h" | 40 #include "SkPicture.h" |
40 | 41 |
41 class GrContext; | 42 class GrContext; |
42 class SkCanvas; | 43 class SkCanvas; |
43 class SkPicture; | 44 class SkPicture; |
44 #endif | 45 #endif |
45 | 46 |
46 namespace WebCore { | 47 namespace WebCore { |
47 | 48 |
48 class GraphicsContext3D; | 49 class GraphicsContext3D; |
49 class LayerPainterChromium; | 50 class LayerPainterChromium; |
50 | 51 |
51 // A LayerTextureUpdater with an internal canvas. | 52 // A LayerTextureUpdater with an internal canvas. |
52 class LayerTextureUpdaterCanvas : public LayerTextureUpdater { | 53 class LayerTextureUpdaterCanvas : public LayerTextureUpdater { |
53 WTF_MAKE_NONCOPYABLE(LayerTextureUpdaterCanvas); | |
54 protected: | 54 protected: |
55 explicit LayerTextureUpdaterCanvas(PassOwnPtr<LayerPainterChromium>); | 55 explicit LayerTextureUpdaterCanvas(PassOwnPtr<LayerPainterChromium>); |
56 | 56 |
57 void paintContents(GraphicsContext&, const IntRect& contentRect); | 57 void paintContents(GraphicsContext&, const IntRect& contentRect); |
58 const IntRect& contentRect() const { return m_contentRect; } | 58 const IntRect& contentRect() const { return m_contentRect; } |
59 | 59 |
60 private: | 60 private: |
61 | 61 |
62 IntRect m_contentRect; | 62 IntRect m_contentRect; |
63 OwnPtr<LayerPainterChromium> m_painter; | 63 OwnPtr<LayerPainterChromium> m_painter; |
64 }; | 64 }; |
65 | 65 |
66 // A LayerTextureUpdater with an internal bitmap canvas. | 66 // A LayerTextureUpdater with an internal bitmap canvas. |
67 class LayerTextureUpdaterBitmap : public LayerTextureUpdaterCanvas { | 67 class LayerTextureUpdaterBitmap : public LayerTextureUpdaterCanvas { |
68 WTF_MAKE_NONCOPYABLE(LayerTextureUpdaterBitmap); | |
69 public: | 68 public: |
70 static PassOwnPtr<LayerTextureUpdaterBitmap> create(PassOwnPtr<LayerPainterC
hromium>, bool useMapTexSubImage); | 69 static PassRefPtr<LayerTextureUpdaterBitmap> create(PassOwnPtr<LayerPainterC
hromium>, bool useMapTexSubImage); |
71 | 70 |
72 virtual Orientation orientation() { return LayerTextureUpdater::BottomUpOrie
ntation; } | 71 virtual Orientation orientation() { return LayerTextureUpdater::BottomUpOrie
ntation; } |
73 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat); | 72 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat); |
74 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, int borderTexels); | 73 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, int borderTexels); |
75 virtual void updateTextureRect(GraphicsContext3D*, ManagedTexture*, const In
tRect& sourceRect, const IntRect& destRect); | 74 virtual void updateTextureRect(GraphicsContext3D*, ManagedTexture*, const In
tRect& sourceRect, const IntRect& destRect); |
76 | 75 |
77 private: | 76 private: |
78 LayerTextureUpdaterBitmap(PassOwnPtr<LayerPainterChromium>, bool useMapTexSu
bImage); | 77 LayerTextureUpdaterBitmap(PassOwnPtr<LayerPainterChromium>, bool useMapTexSu
bImage); |
79 PlatformCanvas m_canvas; | 78 PlatformCanvas m_canvas; |
80 LayerTextureSubImage m_texSubImage; | 79 LayerTextureSubImage m_texSubImage; |
81 }; | 80 }; |
82 | 81 |
83 #if USE(SKIA) | 82 #if USE(SKIA) |
84 class LayerTextureUpdaterSkPicture : public LayerTextureUpdaterCanvas { | 83 class LayerTextureUpdaterSkPicture : public LayerTextureUpdaterCanvas { |
85 WTF_MAKE_NONCOPYABLE(LayerTextureUpdaterSkPicture); | |
86 public: | 84 public: |
87 static PassOwnPtr<LayerTextureUpdaterSkPicture> create(PassOwnPtr<LayerPaint
erChromium>); | 85 static PassRefPtr<LayerTextureUpdaterSkPicture> create(PassOwnPtr<LayerPaint
erChromium>); |
88 virtual ~LayerTextureUpdaterSkPicture(); | 86 virtual ~LayerTextureUpdaterSkPicture(); |
89 | 87 |
90 virtual Orientation orientation() { return LayerTextureUpdater::TopDownOrien
tation; } | 88 virtual Orientation orientation() { return LayerTextureUpdater::TopDownOrien
tation; } |
91 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat); | 89 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat); |
92 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, int borderTexels); | 90 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, int borderTexels); |
93 virtual void updateTextureRect(GraphicsContext3D*, ManagedTexture*, const In
tRect& sourceRect, const IntRect& destRect); | 91 virtual void updateTextureRect(GraphicsContext3D*, ManagedTexture*, const In
tRect& sourceRect, const IntRect& destRect); |
94 | 92 |
95 private: | 93 private: |
96 explicit LayerTextureUpdaterSkPicture(PassOwnPtr<LayerPainterChromium>); | 94 explicit LayerTextureUpdaterSkPicture(PassOwnPtr<LayerPainterChromium>); |
97 void deleteFrameBuffer(); | 95 void deleteFrameBuffer(); |
98 bool createFrameBuffer(); | 96 bool createFrameBuffer(); |
99 GraphicsContext3D* context() { return m_context; } | 97 GraphicsContext3D* context() { return m_context; } |
100 | 98 |
101 GraphicsContext3D* m_context; | 99 GraphicsContext3D* m_context; |
102 | 100 |
103 bool m_createFrameBuffer; // Need to create FBO if true. | 101 bool m_createFrameBuffer; // Need to create FBO if true. |
104 SkPicture m_picture; // Recording canvas. | 102 SkPicture m_picture; // Recording canvas. |
105 IntSize m_bufferSize; // Frame buffer size. | 103 IntSize m_bufferSize; // Frame buffer size. |
106 Platform3DObject m_fbo; // Frame buffer id. | 104 Platform3DObject m_fbo; // Frame buffer id. |
107 Platform3DObject m_depthStencilBuffer; | 105 Platform3DObject m_depthStencilBuffer; |
108 OwnPtr<SkCanvas> m_canvas; // GPU accelerated canvas. | 106 OwnPtr<SkCanvas> m_canvas; // GPU accelerated canvas. |
109 }; | 107 }; |
110 #endif // SKIA | 108 #endif // SKIA |
111 | 109 |
112 } // namespace WebCore | 110 } // namespace WebCore |
113 #endif // USE(ACCELERATED_COMPOSITING) | 111 #endif // USE(ACCELERATED_COMPOSITING) |
114 #endif // LayerTextureUpdaterCanvas_h | 112 #endif // LayerTextureUpdaterCanvas_h |
OLD | NEW |