Home | History | Annotate | Download | only in texmap
      1 /*
      2     Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
      3 
      4     This library is free software; you can redistribute it and/or
      5     modify it under the terms of the GNU Library General Public
      6     License as published by the Free Software Foundation; either
      7     version 2 of the License, or (at your option) any later version.
      8 
      9     This library is distributed in the hope that it will be useful,
     10     but WITHOUT ANY WARRANTY; without even the implied warranty of
     11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12     Library General Public License for more details.
     13 
     14     You should have received a copy of the GNU Library General Public License
     15     along with this library; see the file COPYING.LIB.  If not, write to
     16     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     17     Boston, MA 02110-1301, USA.
     18 */
     19 
     20 #ifndef TextureMapperPlatformLayer_h
     21 #define TextureMapperPlatformLayer_h
     22 
     23 namespace WebCore {
     24 
     25 class GraphicsContext;
     26 class IntRect;
     27 class IntSize;
     28 class TextureMapper;
     29 class TransformationMatrix;
     30 
     31 
     32 // Glue layer to connect the texmap layer to the platform specific container.
     33 class TextureMapperLayerClient {
     34 public:
     35     virtual ~TextureMapperLayerClient() {}
     36     virtual void setNeedsDisplay() = 0;
     37     virtual void setNeedsDisplayInRect(const IntRect& rect) = 0;
     38     virtual void setSizeChanged(const IntSize&) = 0;
     39     virtual TextureMapper* textureMapper() = 0;
     40 };
     41 
     42 class TextureMapperPlatformLayer {
     43 public:
     44     enum Type {
     45         ContentLayer,
     46         MediaLayer
     47     };
     48 
     49     virtual Type layerType() const = 0;
     50     virtual ~TextureMapperPlatformLayer() {}
     51 };
     52 
     53 class TextureMapperContentLayer : public TextureMapperPlatformLayer {
     54 public:
     55     struct PaintOptions {
     56         IntRect visibleRect;
     57         IntRect targetRect;
     58         IntSize viewportSize;
     59         TransformationMatrix transform;
     60         float opacity;
     61     };
     62 
     63     virtual void setPlatformLayerClient(TextureMapperLayerClient*) = 0;
     64     virtual void paint(TextureMapper*, const PaintOptions&) {}
     65     virtual IntSize size() const = 0;
     66     virtual Type layerType() const { return ContentLayer; }
     67 };
     68 
     69 class TextureMapperMediaLayer : public TextureMapperPlatformLayer {
     70 public:
     71     virtual void paint(GraphicsContext*) = 0;
     72     virtual Type layerType() const { return MediaLayer; }
     73 };
     74 
     75 }
     76 
     77 #endif // TextureMapperPlatformLayer_h
     78