src/hbcore/image/hbnvgiconimpl_p.h
changeset 5 627c4a0fd0e7
parent 2 06ff229162e9
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
    33 class HbPooledNVGEngine;
    33 class HbPooledNVGEngine;
    34 class HbEglStates;
    34 class HbEglStates;
    35 class HbVgImageIconRenderer;
    35 class HbVgImageIconRenderer;
    36 class HbPixmapIconRenderer;
    36 class HbPixmapIconRenderer;
    37 
    37 
    38 struct NvgAspectRatioSettings
    38 struct NvgAspectRatioSettings {
    39 {
       
    40     HbNvgEngine::HbNvgAlignType nvgAlignStatusAndAspectRatio;
    39     HbNvgEngine::HbNvgAlignType nvgAlignStatusAndAspectRatio;
    41     HbNvgEngine::HbNvgMeetType type;
    40     HbNvgEngine::HbNvgMeetType type;
    42 };
    41 };
    43 
    42 
    44 class HB_AUTOTEST_EXPORT HbNvgIconImpl : public HbIconImpl
    43 class HB_AUTOTEST_EXPORT HbNvgIconImpl : public HbIconImpl
    45 {
    44 {
    46 public :
    45 public :
    47     HbNvgIconImpl(const HbSharedIconInfo &iconData,
    46     HbNvgIconImpl(const HbSharedIconInfo &iconData,
    48                   const QString& name,
    47                   const QString &name,
    49                   const QSizeF& keySize,
    48                   const QSizeF &keySize,
    50                   Qt::AspectRatioMode aspectRatioMode,
    49                   Qt::AspectRatioMode aspectRatioMode,
    51                   QIcon::Mode mode,
    50                   QIcon::Mode mode,
    52                   bool mirrored,
    51                   bool mirrored,
    53                   HbRenderingMode renderMode);
    52                   HbRenderingMode renderMode);
    54 
    53 
    55     ~HbNvgIconImpl();
    54     ~HbNvgIconImpl();
    56     QPixmap pixmap();
    55     QPixmap pixmap();
    57     void paint(QPainter* painter,
    56     void paint(QPainter *painter,
    58                const QRectF &rect,
    57                const QRectF &rect,
    59                Qt::Alignment alignment,
    58                Qt::Alignment alignment,
    60                const QPainterPath &clipPath = QPainterPath(),
    59                const QPainterPath &clipPath = QPainterPath(),
    61                HbMaskableIconImpl * maskIconData = 0);
    60                HbMaskableIconImpl *maskIconData = 0);
    62 
    61 
    63     QSize defaultSize() const;
    62     QSize defaultSize() const;
    64 
    63 
    65     QSize size();
    64     QSize size();
    66 
    65 
    67     void destroyMaskedData(HbIconMaskedData *data);
    66     void destroyMaskedData(HbIconMaskedData *data);
    68 
    67 
    69 private :
    68 private :
    70     void retrieveNvgData();
    69     void retrieveNvgData();
    71     QPointF setAlignment(const QRectF& rect,
    70     QPointF setAlignment(const QRectF &rect,
    72                          QSizeF& renderSize,
    71                          QSizeF &renderSize,
    73                          Qt::Alignment alignment);
    72                          Qt::Alignment alignment);
    74     NvgAspectRatioSettings mapKeyAspectRatioToNvgAspectRatio(Qt::AspectRatioMode aspectRatio);
    73     NvgAspectRatioSettings mapKeyAspectRatioToNvgAspectRatio(Qt::AspectRatioMode aspectRatio);
    75 
    74 
    76     HbNvgEngine::HbNvgErrorType drawNVGIcon(const QSize & size, HbNvgEngine &engine);
    75     HbNvgEngine::HbNvgErrorType drawNVGIcon(const QSize &size, HbNvgEngine &engine);
    77     int createContextAndSurface(EGLDisplay display,
    76     int createContextAndSurface(EGLDisplay display,
    78                                 int width,
    77                                 int width,
    79                                 int height,
    78                                 int height,
    80                                 EGLContext & newContext,
    79                                 EGLContext &newContext,
    81                                 EGLSurface & newSurface,
    80                                 EGLSurface &newSurface,
    82                                 EGLConfig & config);
    81                                 EGLConfig &config);
    83 
    82 
    84     VGImage createVGImageFromNVG(EGLDisplay display,
    83     VGImage createVGImageFromNVG(EGLDisplay display,
    85                                  EGLSurface currentReadSurface,
    84                                  EGLSurface currentReadSurface,
    86                                  EGLSurface currentWriteSurface,
    85                                  EGLSurface currentWriteSurface,
    87                                  EGLContext eglContext,
    86                                  EGLContext eglContext,
    88                                  int width,
    87                                  int width,
    89                                  int height,
    88                                  int height,
    90                                  bool useGivenContext = true,
    89                                  bool useGivenContext = true,
    91                                  HbNvgEngine * nvgEngine = 0);
    90                                  HbNvgEngine *nvgEngine = 0);
    92 
    91 
    93     bool drawRasterizedIcon(QPainter * painter,
    92     bool drawRasterizedIcon(QPainter *painter,
    94                             const QPointF & topLeft,
    93                             const QPointF &topLeft,
    95                             const QSizeF & renderSize,
    94                             const QSizeF &renderSize,
    96                             const QPainterPath &clipPath);
    95                             const QPainterPath &clipPath);
    97 
    96 
    98     void drawNVGIcon(QPainter * painter,
    97     void drawNVGIcon(QPainter *painter,
    99                      const QPointF & topLeft,
    98                      const QPointF &topLeft,
   100                      const QSizeF & renderSize,
    99                      const QSizeF &renderSize,
   101                      NvgAspectRatioSettings settings);
   100                      NvgAspectRatioSettings settings);
   102 
   101 
   103     static VGImage getVgImage(HbIconImpl * impl, QPainter * painter);
   102     static VGImage getVgImage(HbIconImpl *impl, QPainter *painter);
   104 
   103 
   105 private:
   104 private:
   106     QByteArray          nvgData;
   105     QByteArray          nvgData;
   107     QPixmap             currentPixmap;
   106     QPixmap             currentPixmap;
   108     bool                readyToRender;
   107     bool                readyToRender;
   109     bool                specialCaseApplied;
   108     bool                specialCaseApplied;
   110     QSize               contentSize;
   109     QSize               contentSize;
   111     HbPooledNVGEngine  *nvgEngine;
   110     HbPooledNVGEngine  *nvgEngine;
   112     HbEglStates        *eglStates;
   111     HbEglStates        *eglStates;
   113     HbVgImageIconRenderer *vgImageRenderer;
   112     HbVgImageIconRenderer *vgImageRenderer;
   114     HbPixmapIconRenderer * pixmapIconRenderer;
   113     HbPixmapIconRenderer *pixmapIconRenderer;
   115 };
   114 };
   116 
   115 
   117 #endif // end of HBNVGICONIMPL_P_H
   116 #endif // end of HBNVGICONIMPL_P_H
   118 
   117