@@ -63,17 +63,54 @@ class OpenGLRenderer {
6363 ANDROID_API OpenGLRenderer ();
6464 virtual ~OpenGLRenderer ();
6565
66+ /* *
67+ * Indicates whether this renderer executes drawing commands immediately.
68+ * If this method returns true, the drawing commands will be executed
69+ * later.
70+ */
6671 virtual bool isDeferred ();
6772
73+ /* *
74+ * Sets the dimension of the underlying drawing surface. This method must
75+ * be called at least once every time the drawing surface changes size.
76+ *
77+ * @param width The width in pixels of the underlysing surface
78+ * @param height The height in pixels of the underlysing surface
79+ */
6880 virtual void setViewport (int width, int height);
6981
82+ /* *
83+ * Prepares the renderer to draw a frame. This method must be invoked
84+ * at the beginning of each frame. When this method is invoked, the
85+ * entire drawing surface is assumed to be redrawn.
86+ *
87+ * @param opaque If true, the target surface is considered opaque
88+ * and will not be cleared. If false, the target surface
89+ * will be cleared
90+ */
7091 ANDROID_API int prepare (bool opaque);
92+
93+ /* *
94+ * Prepares the renderer to draw a frame. This method must be invoked
95+ * at the beginning of each frame. Only the specified rectangle of the
96+ * frame is assumed to be dirty. A clip will automatically be set to
97+ * the specified rectangle.
98+ *
99+ * @param left The left coordinate of the dirty rectangle
100+ * @param top The top coordinate of the dirty rectangle
101+ * @param right The right coordinate of the dirty rectangle
102+ * @param bottom The bottom coordinate of the dirty rectangle
103+ * @param opaque If true, the target surface is considered opaque
104+ * and will not be cleared. If false, the target surface
105+ * will be cleared in the specified dirty rectangle
106+ */
71107 virtual int prepareDirty (float left, float top, float right, float bottom, bool opaque);
72- virtual void finish ();
73108
74- // These two calls must not be recorded in display lists
75- virtual void interrupt ();
76- virtual void resume ();
109+ /* *
110+ * Indicates the end of a frame. This method must be invoked whenever
111+ * the caller is done rendering a frame.
112+ */
113+ virtual void finish ();
77114
78115 ANDROID_API status_t invokeFunctors (Rect& dirty);
79116 ANDROID_API void detachFunctor (Functor* functor);
@@ -90,10 +127,6 @@ class OpenGLRenderer {
90127 virtual int saveLayerAlpha (float left, float top, float right, float bottom,
91128 int alpha, int flags);
92129
93- void setAlpha (float alpha) {
94- mSnapshot ->alpha = alpha;
95- }
96-
97130 virtual void translate (float dx, float dy);
98131 virtual void rotate (float degrees);
99132 virtual void scale (float sx, float sy);
@@ -159,12 +192,49 @@ class OpenGLRenderer {
159192
160193 SkPaint* filterPaint (SkPaint* paint);
161194
195+ /* *
196+ * Returns the desired size for the stencil buffer. If the returned value
197+ * is 0, then no stencil buffer is required.
198+ */
162199 ANDROID_API static uint32_t getStencilSize ();
163200
201+ /* *
202+ * Sets the alpha on the current snapshot. This alpha value will be modulated
203+ * with other alpha values when drawing primitives.
204+ */
205+ void setAlpha (float alpha) {
206+ mSnapshot ->alpha = alpha;
207+ }
208+
209+ /* *
210+ * Inserts a named group marker in the stream of GL commands. This marker
211+ * can be used by tools to group commands into logical groups. A call to
212+ * this method must always be followed later on by a call to endMark().
213+ */
164214 void startMark (const char * name) const ;
215+
216+ /* *
217+ * Closes the last group marker opened by startMark().
218+ */
165219 void endMark () const ;
166220
167221protected:
222+
223+ /* *
224+ * This method must be invoked before handing control over to a draw functor.
225+ * See callDrawGLFunction() for instance.
226+ *
227+ * This command must not be recorded inside display lists.
228+ */
229+ void interrupt ();
230+
231+ /* *
232+ * This method must be invoked after getting control back from a draw functor.
233+ *
234+ * This command must not be recorded inside display lists.
235+ */
236+ void resume ();
237+
168238 /* *
169239 * Compose the layer defined in the current snapshot with the layer
170240 * defined by the previous snapshot.
@@ -579,6 +649,7 @@ class OpenGLRenderer {
579649 * Invoked before any drawing operation. This sets required state.
580650 */
581651 void setupDraw (bool clear = true );
652+
582653 /* *
583654 * Various methods to setup OpenGL rendering.
584655 */
@@ -626,6 +697,10 @@ class OpenGLRenderer {
626697 void finishDrawTexture ();
627698 void accountForClear (SkXfermode::Mode mode);
628699
700+ /* *
701+ * Renders the specified region as a series of rectangles. This method
702+ * is used for debugging only.
703+ */
629704 void drawRegionRects (const Region& region);
630705
631706 /* *
0 commit comments