OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 | 10 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 /** | 377 /** |
378 * Draws path into the stencil buffer. The fill must be either even/odd or | 378 * Draws path into the stencil buffer. The fill must be either even/odd or |
379 * winding (not inverse or hairline). It will respect the HW antialias flag | 379 * winding (not inverse or hairline). It will respect the HW antialias flag |
380 * on the draw state (if possible in the 3D API). | 380 * on the draw state (if possible in the 3D API). |
381 */ | 381 */ |
382 void stencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath::FillType
fill); | 382 void stencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath::FillType
fill); |
383 | 383 |
384 /** | 384 /** |
385 * Helper function for drawing rects. This does not use the current index | 385 * Helper function for drawing rects. This does not use the current index |
386 * and vertex sources. After returning, the vertex and index sources may | 386 * and vertex sources. After returning, the vertex and index sources may |
387 * have changed. They should be reestablished before the next drawIndexed | 387 * have changed. They should be reestablished before the next draw call. |
388 * or drawNonIndexed. This cannot be called between reserving and releasing | 388 * This cannot be called between reserving and releasing |
389 * geometry. | 389 * geometry. |
390 * | 390 * |
391 * A subclass may override this to perform more optimal rect rendering. Its | 391 * A subclass may override this to perform more optimal rect rendering. Its |
392 * draws should be funneled through one of the public GrDrawTarget draw meth
ods | 392 * draws should be funneled through one of the public GrDrawTarget draw meth
ods |
393 * (e.g. drawNonIndexed, drawIndexedInstances, ...). The base class draws a
two | 393 * (e.g. drawNonIndexed, drawIndexedInstances, ...). The base class draws a
two |
394 * triangle fan using drawNonIndexed from reserved vertex space. | 394 * triangle fan using drawNonIndexed from reserved vertex space. |
395 * | 395 * |
396 * @param rect the rect to draw | 396 * @param rect the rect to draw |
397 * @param matrix optional matrix applied to rect (before viewMatrix) | 397 * @param matrix optional matrix applied to rect (before viewMatrix) |
398 * @param srcRects specifies rect for explicit texture coordinates. | 398 * @param localRect optional rect that specifies local coords to map onto |
399 * if srcRect is non-NULL then that rect will be used | 399 * rect. If NULL then rect serves as the local coords. |
400 * as the coordinates for the given stage. | 400 * @param localMatrix optional matrix applied to localRect. If |
401 * @param srcMatrix optional matrix applied to srcRect. If | |
402 * srcRect is non-NULL and srcMatrix is non-NULL | 401 * srcRect is non-NULL and srcMatrix is non-NULL |
403 * then srcRect will be transformed by srcMatrix. | 402 * then srcRect will be transformed by srcMatrix. |
404 * srcMatrix can be NULL when no srcMatrix is desired. | 403 * srcMatrix can be NULL when no srcMatrix is desired. |
405 * @param stage the stage to be given explicit texture coordinates. | |
406 * Ignored if srcRect is NULL. | |
407 */ | 404 */ |
408 virtual void drawRect(const GrRect& rect, | 405 virtual void drawRect(const GrRect& rect, |
409 const SkMatrix* matrix, | 406 const SkMatrix* matrix, |
410 const GrRect* srcRect, | 407 const GrRect* localRect, |
411 const SkMatrix* srcMatrix, | 408 const SkMatrix* localMatrix); |
412 int stage); | |
413 | 409 |
414 /** | 410 /** |
415 * Helper for drawRect when the caller doesn't need separate src rects or | 411 * Helper for drawRect when the caller doesn't need separate local rects or
matrices. |
416 * matrices. | |
417 */ | 412 */ |
418 void drawSimpleRect(const GrRect& rect, const SkMatrix* matrix = NULL) { | 413 void drawSimpleRect(const GrRect& rect, const SkMatrix* matrix = NULL) { |
419 drawRect(rect, matrix, NULL, NULL, 0); | 414 drawRect(rect, matrix, NULL, NULL); |
420 } | 415 } |
421 void drawSimpleRect(const GrIRect& irect, const SkMatrix* matrix = NULL) { | 416 void drawSimpleRect(const GrIRect& irect, const SkMatrix* matrix = NULL) { |
422 SkRect rect = SkRect::MakeFromIRect(irect); | 417 SkRect rect = SkRect::MakeFromIRect(irect); |
423 this->drawRect(rect, matrix, NULL, NULL, 0); | 418 this->drawRect(rect, matrix, NULL, NULL); |
424 } | 419 } |
425 | 420 |
426 /** | 421 /** |
427 * This call is used to draw multiple instances of some geometry with a | 422 * This call is used to draw multiple instances of some geometry with a |
428 * given number of vertices (V) and indices (I) per-instance. The indices in | 423 * given number of vertices (V) and indices (I) per-instance. The indices in |
429 * the index source must have the form i[k+I] == i[k] + V. Also, all indices | 424 * the index source must have the form i[k+I] == i[k] + V. Also, all indices |
430 * i[kI] ... i[(k+1)I-1] must be elements of the range kV ... (k+1)V-1. As a | 425 * i[kI] ... i[(k+1)I-1] must be elements of the range kV ... (k+1)V-1. As a |
431 * concrete example, the following index buffer for drawing a series of | 426 * concrete example, the following index buffer for drawing a series of |
432 * quads each as two triangles each satisfies these conditions with V=4 and | 427 * quads each as two triangles each satisfies these conditions with V=4 and |
433 * I=6: | 428 * I=6: |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 const GrClipData* fClip; | 774 const GrClipData* fClip; |
780 GrDrawState* fDrawState; | 775 GrDrawState* fDrawState; |
781 GrDrawState fDefaultDraw
State; | 776 GrDrawState fDefaultDraw
State; |
782 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar
get. | 777 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar
get. |
783 GrContext* fContext; | 778 GrContext* fContext; |
784 | 779 |
785 typedef GrRefCnt INHERITED; | 780 typedef GrRefCnt INHERITED; |
786 }; | 781 }; |
787 | 782 |
788 #endif | 783 #endif |
OLD | NEW |