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