ganeswidgets/inc/hgtransformedquadrenderer.h
changeset 2 49c70dcc3f17
child 5 4fa04caf0f43
equal deleted inserted replaced
1:e48454f237ca 2:49c70dcc3f17
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef HGTRANSFORMEDQUADRENDERER_H
       
    19 #define HGTRANSFORMEDQUADRENDERER_H
       
    20 
       
    21 #include "hgquadrenderer.h"
       
    22 #include <qlist>
       
    23 #include <qimage>
       
    24 
       
    25 class QPoint;
       
    26 class QPainter;
       
    27 class QRectF;
       
    28 class QMatrix4x4;
       
    29 class QSize;
       
    30 class HgTransformedQuad;
       
    31 
       
    32 /**
       
    33  * Abstract base class for quad renderers, that need to tranform quads manually. (using CPU)
       
    34  */
       
    35 class HgTransformedQuadRenderer: public HgQuadRenderer
       
    36 {
       
    37 public:
       
    38     
       
    39     HgTransformedQuadRenderer(int maxQuads);
       
    40     virtual ~HgTransformedQuadRenderer();    
       
    41     
       
    42     virtual HgQuad* getQuadAt(const QPointF& point) const;
       
    43     virtual bool getQuadTranformedPointsByUserData(QPolygonF& points, const QVariant& userData) const;
       
    44     virtual QList<HgQuad*> getVisibleQuads(const QRectF& rect) const;
       
    45             
       
    46 protected:
       
    47 
       
    48     // this must be called from inheriting class
       
    49     void init(int maxQuads);
       
    50     
       
    51     virtual void transformQuads(const QMatrix4x4& view, const QMatrix4x4& proj, 
       
    52         const QPointF& center, const QSizeF& windowSize);
       
    53 
       
    54     virtual void drawTransformedQuads(QPainter* painter, const QRectF& rect);
       
    55     
       
    56     virtual HgTransformedQuad* createNativeQuad()=0;
       
    57         
       
    58 private:
       
    59     QList<HgTransformedQuad*> mTransformedQuads;    
       
    60     QList<HgTransformedQuad*> mSortedQuads;    
       
    61 };
       
    62 
       
    63 #endif