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