LCOV - code coverage report
Current view: directory - gfx/layers/opengl - CanvasLayerOGL.h (source / functions) Found Hit Coverage
Test: app.info Lines: 7 0 0.0 %
Date: 2012-06-02 Functions: 5 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2                 :  * ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is Mozilla Corporation code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is Mozilla Foundation.
      18                 :  * Portions created by the Initial Developer are Copyright (C) 2010
      19                 :  * the Initial Developer. All Rights Reserved.
      20                 :  *
      21                 :  * Contributor(s):
      22                 :  *   Vladimir Vukicevic <vladimir@pobox.com>
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      26                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      28                 :  * of those above. If you wish to allow use of your version of this file only
      29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      30                 :  * use your version of this file under the terms of the MPL, indicate your
      31                 :  * decision by deleting the provisions above and replace them with the notice
      32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      33                 :  * the provisions above, a recipient may use your version of this file under
      34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      35                 :  *
      36                 :  * ***** END LICENSE BLOCK ***** */
      37                 : 
      38                 : #ifndef GFX_CANVASLAYEROGL_H
      39                 : #define GFX_CANVASLAYEROGL_H
      40                 : 
      41                 : 
      42                 : #include "LayerManagerOGL.h"
      43                 : #include "gfxASurface.h"
      44                 : #if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
      45                 : #include "GLXLibrary.h"
      46                 : #include "mozilla/X11Util.h"
      47                 : #endif
      48                 : 
      49                 : namespace mozilla {
      50                 : namespace layers {
      51                 : 
      52                 : class THEBES_API CanvasLayerOGL :
      53                 :   public CanvasLayer,
      54                 :   public LayerOGL
      55                 : {
      56                 : public:
      57               0 :   CanvasLayerOGL(LayerManagerOGL *aManager)
      58                 :     : CanvasLayer(aManager, NULL),
      59                 :       LayerOGL(aManager),
      60                 :       mTexture(0),
      61                 :       mDelayedUpdates(false)
      62                 : #if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
      63               0 :       ,mPixmap(0)
      64                 : #endif
      65                 :   { 
      66               0 :       mImplData = static_cast<LayerOGL*>(this);
      67               0 :   }
      68               0 :   ~CanvasLayerOGL() { Destroy(); }
      69                 : 
      70                 :   // CanvasLayer implementation
      71                 :   virtual void Initialize(const Data& aData);
      72                 : 
      73                 :   // LayerOGL implementation
      74                 :   virtual void Destroy();
      75               0 :   virtual Layer* GetLayer() { return this; }
      76                 :   virtual void RenderLayer(int aPreviousFrameBuffer,
      77                 :                            const nsIntPoint& aOffset);
      78                 :   virtual void CleanupResources();
      79                 : 
      80                 : protected:
      81                 :   void UpdateSurface();
      82                 : 
      83                 :   nsRefPtr<gfxASurface> mCanvasSurface;
      84                 :   nsRefPtr<GLContext> mCanvasGLContext;
      85                 :   gl::ShaderProgramType mLayerProgram;
      86                 :   RefPtr<gfx::DrawTarget> mDrawTarget;
      87                 : 
      88                 :   void MakeTexture();
      89                 :   GLuint mTexture;
      90                 : 
      91                 :   bool mDelayedUpdates;
      92                 :   bool mGLBufferIsPremultiplied;
      93                 :   bool mNeedsYFlip;
      94                 : #if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
      95                 :   GLXPixmap mPixmap;
      96                 : #endif
      97                 : };
      98                 : 
      99                 : // NB: eventually we'll have separate shadow canvas2d and shadow
     100                 : // canvas3d layers, but currently they look the same from the
     101                 : // perspective of the compositor process
     102                 : class ShadowCanvasLayerOGL : public ShadowCanvasLayer,
     103                 :                              public LayerOGL
     104                 : {
     105                 :   typedef gl::TextureImage TextureImage;
     106                 : 
     107                 : public:
     108                 :   ShadowCanvasLayerOGL(LayerManagerOGL* aManager);
     109                 :   virtual ~ShadowCanvasLayerOGL();
     110                 : 
     111                 :   // CanvasLayer impl
     112                 :   virtual void Initialize(const Data& aData);
     113                 :   virtual void Init(const CanvasSurface& aNewFront, bool needYFlip);
     114                 : 
     115                 :   // This isn't meaningful for shadow canvas.
     116               0 :   virtual void Updated(const nsIntRect&) {}
     117                 : 
     118                 :   // ShadowCanvasLayer impl
     119                 :   virtual void Swap(const CanvasSurface& aNewFront,
     120                 :                     bool needYFlip,
     121                 :                     CanvasSurface* aNewBack);
     122                 : 
     123                 :   virtual void DestroyFrontBuffer();
     124                 : 
     125                 :   virtual void Disconnect();
     126                 : 
     127                 :   // LayerOGL impl
     128                 :   void Destroy();
     129                 :   Layer* GetLayer();
     130                 :   virtual void RenderLayer(int aPreviousFrameBuffer,
     131                 :                            const nsIntPoint& aOffset);
     132                 :   virtual void CleanupResources();
     133                 : 
     134                 : private:
     135                 :   nsRefPtr<TextureImage> mTexImage;
     136                 : 
     137                 :   bool mNeedsYFlip;
     138                 : };
     139                 : 
     140                 : } /* layers */
     141                 : } /* mozilla */
     142                 : #endif /* GFX_IMAGELAYEROGL_H */

Generated by: LCOV version 1.7