OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 |
| 5 #ifndef TextureLayerChromium_h |
| 6 #define TextureLayerChromium_h |
| 7 |
| 8 #if USE(ACCELERATED_COMPOSITING) |
| 9 |
| 10 #include "LayerChromium.h" |
| 11 |
| 12 namespace WebKit { |
| 13 class WebGraphicsContext3D; |
| 14 } |
| 15 |
| 16 namespace cc { |
| 17 |
| 18 class TextureLayerChromiumClient; |
| 19 |
| 20 // A Layer containing a the rendered output of a plugin instance. |
| 21 class TextureLayerChromium : public LayerChromium { |
| 22 public: |
| 23 // If this texture layer requires special preparation logic for each frame d
riven by |
| 24 // the compositor, pass in a non-nil client. Pass in a nil client pointer if
texture updates |
| 25 // are driven by an external process. |
| 26 static scoped_refptr<TextureLayerChromium> create(TextureLayerChromiumClient
*); |
| 27 |
| 28 void clearClient() { m_client = 0; } |
| 29 |
| 30 virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; |
| 31 |
| 32 // Sets whether this texture should be Y-flipped at draw time. Defaults to t
rue. |
| 33 void setFlipped(bool); |
| 34 |
| 35 // Sets a UV transform to be used at draw time. Defaults to (0, 0, 1, 1). |
| 36 void setUVRect(const FloatRect&); |
| 37 |
| 38 // Sets whether the alpha channel is premultiplied or unpremultiplied. Defau
lts to true. |
| 39 void setPremultipliedAlpha(bool); |
| 40 |
| 41 // Sets whether this context should rate limit on damage to prevent too many
frames from |
| 42 // being queued up before the compositor gets a chance to run. Requires a no
n-nil client. |
| 43 // Defaults to false. |
| 44 void setRateLimitContext(bool); |
| 45 |
| 46 // Code path for plugins which supply their own texture ID. |
| 47 void setTextureId(unsigned); |
| 48 |
| 49 void willModifyTexture(); |
| 50 |
| 51 virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE; |
| 52 |
| 53 virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE; |
| 54 virtual bool drawsContent() const OVERRIDE; |
| 55 virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRend
eringStats&) OVERRIDE; |
| 56 virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; |
| 57 |
| 58 protected: |
| 59 explicit TextureLayerChromium(TextureLayerChromiumClient*); |
| 60 virtual ~TextureLayerChromium(); |
| 61 |
| 62 private: |
| 63 TextureLayerChromiumClient* m_client; |
| 64 |
| 65 bool m_flipped; |
| 66 FloatRect m_uvRect; |
| 67 bool m_premultipliedAlpha; |
| 68 bool m_rateLimitContext; |
| 69 bool m_contextLost; |
| 70 |
| 71 unsigned m_textureId; |
| 72 }; |
| 73 |
| 74 } |
| 75 #endif // USE(ACCELERATED_COMPOSITING) |
| 76 |
| 77 #endif |
OLD | NEW |