~3v1n0/unity/input-monitor-menus-scrubbing-triangolation

1233.2.11 by Jason Smith
add switcher test and IconRenderer.h
1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2
/*
1233.2.27 by Jason Smith
migrate tooltip to using a nux::Property
3
 * Copyright (C) 2011 Canonical Ltd
1233.2.11 by Jason Smith
add switcher test and IconRenderer.h
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License version 3 as
7
 * published by the Free Software Foundation.
8
 *
9
 * This program 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
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
 *
17
 * Authored by: Jason Smith <jason.smith@canonical.com>
18
 */
19
20
#ifndef ICONRENDERER_H
21
#define ICONRENDERER_H
22
23
#include <Nux/Nux.h>
24
#include <Nux/BaseWindow.h>
25
#include <Nux/View.h>
26
1233.2.12 by Jason Smith
start moving rendering of icons into own class
27
#include "AbstractIconRenderer.h"
1233.2.11 by Jason Smith
add switcher test and IconRenderer.h
28
1307 by Neil Jagdish Patel
Update formatting to match style (as close as possible)
29
namespace unity
30
{
31
namespace ui
32
{
1233.2.11 by Jason Smith
add switcher test and IconRenderer.h
33
1885.3.3 by Jason Smith
forward declare class in IconRenderer
34
class IconTextureSource;
35
1233.2.12 by Jason Smith
start moving rendering of icons into own class
36
class IconRenderer : public AbstractIconRenderer
1233.2.11 by Jason Smith
add switcher test and IconRenderer.h
37
{
38
public:
1233.2.15 by Jason Smith
almost finished building icon renderer
39
  IconRenderer();
1233.2.11 by Jason Smith
add switcher test and IconRenderer.h
40
1307 by Neil Jagdish Patel
Update formatting to match style (as close as possible)
41
  void PreprocessIcons(std::list<RenderArg>& args, nux::Geometry const& target_window);
42
43
  void RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const& arg, nux::Geometry const& anchor_geo, nux::Geometry const& owner_geo);
44
45
  void SetTargetSize(int tile_size, int image_size, int spacing);
1233.2.14 by Jason Smith
more progress porting the IconRenderer
46
1233.2.11 by Jason Smith
add switcher test and IconRenderer.h
47
protected:
1307 by Neil Jagdish Patel
Update formatting to match style (as close as possible)
48
  void RenderElement(nux::GraphicsEngine& GfxContext,
49
                     RenderArg const& arg,
2827.3.2 by Marco Trevisan (Treviño)
Launcher: avoid copies in launcher rendering code-path
50
                     nux::ObjectPtr<nux::IOpenGLBaseTexture> const& icon,
51
                     nux::Color const& bkg_color,
52
                     nux::Color const& colorify,
1307 by Neil Jagdish Patel
Update formatting to match style (as close as possible)
53
                     float alpha,
1885.1.1 by Jason Smith
fix square icons at non-default sizes
54
                     bool force_filter,
2827.3.2 by Marco Trevisan (Treviño)
Launcher: avoid copies in launcher rendering code-path
55
                     std::vector<nux::Vector4> const& xform_coords);
1307 by Neil Jagdish Patel
Update formatting to match style (as close as possible)
56
57
  void RenderIndicators(nux::GraphicsEngine& GfxContext,
58
                        RenderArg const& arg,
59
                        int running,
60
                        int active,
61
                        float alpha,
62
                        nux::Geometry const& geo);
63
64
  void RenderProgressToTexture(nux::GraphicsEngine& GfxContext,
2827.3.2 by Marco Trevisan (Treviño)
Launcher: avoid copies in launcher rendering code-path
65
                               nux::ObjectPtr<nux::IOpenGLBaseTexture> const& texture,
1307 by Neil Jagdish Patel
Update formatting to match style (as close as possible)
66
                               float progress_fill,
67
                               float bias);
68
2827.3.2 by Marco Trevisan (Treviño)
Launcher: avoid copies in launcher rendering code-path
69
  void UpdateIconTransform(ui::IconTextureSource* icon, nux::Matrix4 const& ViewProjectionMatrix, nux::Geometry const& geo,
1885.3.1 by Jason Smith
Make AbstractIconRenderer inherit from IconTextureSource
70
                           float x, float y, float w, float h, float z, ui::IconTextureSource::TransformIndex index);
1307 by Neil Jagdish Patel
Update formatting to match style (as close as possible)
71
2827.3.2 by Marco Trevisan (Treviño)
Launcher: avoid copies in launcher rendering code-path
72
  void UpdateIconSectionTransform(ui::IconTextureSource* icon, nux::Matrix4 const& ViewProjectionMatrix, nux::Geometry const& geo,
1885.3.1 by Jason Smith
Make AbstractIconRenderer inherit from IconTextureSource
73
                                  float x, float y, float w, float h, float z, float xx, float yy, float ww, float hh, ui::IconTextureSource::TransformIndex index);
1233.2.15 by Jason Smith
almost finished building icon renderer
74
75
  void GetInverseScreenPerspectiveMatrix(nux::Matrix4& ViewMatrix, nux::Matrix4& PerspectiveMatrix,
76
                                         int ViewportWidth,
77
                                         int ViewportHeight,
78
                                         float NearClipPlane,
79
                                         float FarClipPlane,
80
                                         float Fovy);
1233.2.16 by Jason Smith
theoretical completion of IconRenderer
81
1292.3.2 by Jason Smith
Share texture memory in IconRenderer
82
private:
1233.2.14 by Jason Smith
more progress porting the IconRenderer
83
  int icon_size;
1233.2.15 by Jason Smith
almost finished building icon renderer
84
  int image_size;
85
  int spacing;
1570.1.1 by Jason Smith
Optimize unity to minimize number of calls to get projection matrix (math reduction)
86
2919.5.1 by Marco Trevisan (Treviño)
IconRenderer: add TexturePool static class used to cache all the icons textures using smart pointers
87
  struct TexturesPool;
2919.5.4 by Marco Trevisan (Treviño)
IconRenderer::TexturesPool: add a static getter, and use ref_counted instance
88
  std::shared_ptr<TexturesPool> textures_;
3680.1.71 by Marco Trevisan (Treviño)
IconRenderer: add support for local textures, depending on Icon size
89
  struct LocalTextures;
90
  std::shared_ptr<LocalTextures> local_textures_;
2919.5.5 by Marco Trevisan (Treviño)
IconRenderer: adjust variable name to style rules
91
  nux::Matrix4 stored_projection_matrix_;
1233.2.11 by Jason Smith
add switcher test and IconRenderer.h
92
};
93
94
}
95
}
96
97
#endif // ICONRENDERER_H
98