99 |
|
|
100 |
class MemoryConsumer "interface" |
class MemoryConsumer "interface" |
101 |
methods |
methods |
102 |
|
boolean getScalable() |
103 |
int getMaxBytes() |
int getMaxBytes() |
|
enum getScaling() |
|
104 |
void setReservation(int bytes, Obs o) |
void setReservation(int bytes, Obs o) |
105 |
int getReservation() |
int getReservation() |
106 |
|
|
119 |
horizontally(50, foo, client, CacheFacade, ImageLoader); |
horizontally(50, foo, client, CacheFacade, ImageLoader); |
120 |
vertically(100, bar, MemoryConsumer, foo); |
vertically(100, bar, MemoryConsumer, foo); |
121 |
|
|
122 |
The class ``MemoryConsumer`` abstracts a single memoryconsumer, where the |
The class ``MemoryConsumer`` abstracts a single memoryconsumer, where |
123 |
system may query it for the maximum number of bytes needed, the way the |
the system may query it for the maximum number of bytes needed, the way |
124 |
number of bytes can be scaled, and set the current memory consumption |
the number of bytes can be scaled, and set the current memory consumption |
125 |
to a particular amount. |
to a particular amount. |
126 |
|
|
127 |
As an example of how this system will be tied to the rest of Gzz, |
As an example of how this system will be tied to the rest of Gzz, |
128 |
consider PageSpans and OpenGL. The basic operation is: "get a texture |
consider PageSpans and OpenGL. The basic operation is: "get a texture |
129 |
rectangle for the given pagespan". In order to have the information |
rectangle for the given pagespan". In order to have the information about |
130 |
about the relative importances of the textures come through, |
the relative importances of the textures come through, we need to give |
131 |
we need to give another parameter, the importance, when getting |
another parameter, the importance, when getting the texture rectangle. |
|
the texture rectangle. |
|
132 |
|
|
133 |
.. UML:: memorytexAPI |
.. UML:: memorytexAPI |
134 |
|
|
154 |
horizontally(60, bbb, pagequal, TextureImageMemoryConsumer); |
horizontally(60, bbb, pagequal, TextureImageMemoryConsumer); |
155 |
|
|
156 |
|
|
157 |
Defining the importance function is not simple; this represents |
Defining the importance function is not simple; this represents the |
158 |
the tradeoffs between memory use for the focus and context. |
tradeoffs between memory use for the focus and context. The first, |
159 |
The first, obvious quality is that the most immediate focus has priority: |
obvious quality is that the most immediate focus has priority: it must |
160 |
it must never be blurred to make the context sharper. |
never be blurred to make the context sharper. In the other end of the |
161 |
In the other end of the scale are the spans that are not really |
scale are the spans that are not really visible but might become visible |
162 |
visible but might become visible when the user moves; these should |
when the user moves; these should only be loaded if there's extra memory |
163 |
only be loaded if there's extra memory available. |
available. |
164 |
|
|
165 |
The cases between the two extremes are the difficult ones. |
The cases between the two extremes are the difficult ones. |
166 |
|
|