OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrContext_DEFINED | 8 #ifndef GrContext_DEFINED |
9 #define GrContext_DEFINED | 9 #define GrContext_DEFINED |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... | |
32 class GrOvalRenderer; | 32 class GrOvalRenderer; |
33 class GrPath; | 33 class GrPath; |
34 class GrPathRenderer; | 34 class GrPathRenderer; |
35 class GrResourceEntry; | 35 class GrResourceEntry; |
36 class GrResourceCache; | 36 class GrResourceCache; |
37 class GrStencilBuffer; | 37 class GrStencilBuffer; |
38 class GrTestTarget; | 38 class GrTestTarget; |
39 class GrTextureParams; | 39 class GrTextureParams; |
40 class GrVertexBuffer; | 40 class GrVertexBuffer; |
41 class GrVertexBufferAllocPool; | 41 class GrVertexBufferAllocPool; |
42 class GrStrokeInfo; | |
42 class GrSoftwarePathRenderer; | 43 class GrSoftwarePathRenderer; |
43 class SkStrokeRec; | 44 class SkStrokeRec; |
44 | 45 |
45 class SK_API GrContext : public SkRefCnt { | 46 class SK_API GrContext : public SkRefCnt { |
46 public: | 47 public: |
47 SK_DECLARE_INST_COUNT(GrContext) | 48 SK_DECLARE_INST_COUNT(GrContext) |
48 | 49 |
49 /** | 50 /** |
50 * Creates a GrContext for a backend context. | 51 * Creates a GrContext for a backend context. |
51 */ | 52 */ |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
444 void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect, | 445 void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect, |
445 GrRenderTarget* target = NULL); | 446 GrRenderTarget* target = NULL); |
446 | 447 |
447 /** | 448 /** |
448 * Draw everywhere (respecting the clip) with the paint. | 449 * Draw everywhere (respecting the clip) with the paint. |
449 */ | 450 */ |
450 void drawPaint(const GrPaint& paint); | 451 void drawPaint(const GrPaint& paint); |
451 | 452 |
452 /** | 453 /** |
453 * Draw the rect using a paint. | 454 * Draw the rect using a paint. |
454 * @param paint describes how to color pixels. | 455 * @param paint describes how to color pixels. |
robertphillips
2014/06/05 18:28:00
strokeInfo ? Does the text need changing ?
egdaniel
2014/06/05 19:07:22
Ah yes. Same with all others pointed out below
| |
455 * @param stroke the stroke information (width, join, cap). | 456 * @param stroke the stroke information (width, join, cap). |
456 * If stroke == NULL, then the rect is filled. | 457 * If stroke == NULL, then the rect is filled. |
457 * Otherwise, if stroke width == 0, then the stroke | 458 * Otherwise, if stroke width == 0, then the stroke |
458 * is always a single pixel thick, else the rect is | 459 * is always a single pixel thick, else the rect is |
459 * mitered/beveled stroked based on stroke width. | 460 * mitered/beveled stroked based on stroke width. |
460 * @param matrix Optional matrix applied to the rect. Applied before | 461 * @param matrix Optional matrix applied to the rect. Applied before |
461 * context's matrix or the paint's matrix. | 462 * context's matrix or the paint's matrix. |
462 * The rects coords are used to access the paint (through texture matrix) | 463 * The rects coords are used to access the paint (through texture matrix) |
463 */ | 464 */ |
464 void drawRect(const GrPaint& paint, | 465 void drawRect(const GrPaint& paint, |
465 const SkRect&, | 466 const SkRect&, |
466 const SkStrokeRec* stroke = NULL, | 467 const GrStrokeInfo* strokeInfo = NULL, |
467 const SkMatrix* matrix = NULL); | 468 const SkMatrix* matrix = NULL); |
468 | 469 |
469 /** | 470 /** |
470 * Maps a rect of local coordinates onto the a rect of destination | 471 * Maps a rect of local coordinates onto the a rect of destination |
471 * coordinates. Each rect can optionally be transformed. The localRect | 472 * coordinates. Each rect can optionally be transformed. The localRect |
472 * is stretched over the dstRect. The dstRect is transformed by the | 473 * is stretched over the dstRect. The dstRect is transformed by the |
473 * context's matrix. Additional optional matrices for both rects can be | 474 * context's matrix. Additional optional matrices for both rects can be |
474 * provided by parameters. | 475 * provided by parameters. |
475 * | 476 * |
476 * @param paint describes how to color pixels. | 477 * @param paint describes how to color pixels. |
477 * @param dstRect the destination rect to draw. | 478 * @param dstRect the destination rect to draw. |
478 * @param localRect rect of local coordinates to be mapped onto dstRect | 479 * @param localRect rect of local coordinates to be mapped onto dstRect |
479 * @param dstMatrix Optional matrix to transform dstRect. Applied before context's matrix. | 480 * @param dstMatrix Optional matrix to transform dstRect. Applied before context's matrix. |
480 * @param localMatrix Optional matrix to transform localRect. | 481 * @param localMatrix Optional matrix to transform localRect. |
481 */ | 482 */ |
482 void drawRectToRect(const GrPaint& paint, | 483 void drawRectToRect(const GrPaint& paint, |
483 const SkRect& dstRect, | 484 const SkRect& dstRect, |
484 const SkRect& localRect, | 485 const SkRect& localRect, |
485 const SkMatrix* dstMatrix = NULL, | 486 const SkMatrix* dstMatrix = NULL, |
486 const SkMatrix* localMatrix = NULL); | 487 const SkMatrix* localMatrix = NULL); |
487 | 488 |
488 /** | 489 /** |
489 * Draw a roundrect using a paint. | 490 * Draw a roundrect using a paint. |
490 * | 491 * |
491 * @param paint describes how to color pixels. | 492 * @param paint describes how to color pixels. |
492 * @param rrect the roundrect to draw | 493 * @param rrect the roundrect to draw |
robertphillips
2014/06/05 18:27:59
strokeInfo ?
| |
493 * @param stroke the stroke information (width, join, cap) | 494 * @param stroke the stroke information (width, join, cap) |
494 */ | 495 */ |
495 void drawRRect(const GrPaint& paint, const SkRRect& rrect, const SkStrokeRec & stroke); | 496 void drawRRect(const GrPaint& paint, const SkRRect& rrect, const GrStrokeInf o& strokeInfo); |
496 | 497 |
497 /** | 498 /** |
498 * Shortcut for drawing an SkPath consisting of nested rrects using a paint . | 499 * Shortcut for drawing an SkPath consisting of nested rrects using a paint . |
499 * Does not support stroking. The result is undefined if outer does not con tain | 500 * Does not support stroking. The result is undefined if outer does not con tain |
500 * inner. | 501 * inner. |
501 * | 502 * |
502 * @param paint describes how to color pixels. | 503 * @param paint describes how to color pixels. |
503 * @param outer the outer roundrect | 504 * @param outer the outer roundrect |
504 * @param inner the inner roundrect | 505 * @param inner the inner roundrect |
505 */ | 506 */ |
506 void drawDRRect(const GrPaint& paint, const SkRRect& outer, const SkRRect& i nner); | 507 void drawDRRect(const GrPaint& paint, const SkRRect& outer, const SkRRect& i nner); |
507 | 508 |
508 | 509 |
509 /** | 510 /** |
510 * Draws a path. | 511 * Draws a path. |
511 * | 512 * |
512 * @param paint describes how to color pixels. | 513 * @param paint describes how to color pixels. |
513 * @param path the path to draw | 514 * @param path the path to draw |
robertphillips
2014/06/05 18:28:00
strokeInfo ?
| |
514 * @param stroke the stroke information (width, join, cap) | 515 * @param stroke the stroke information (width, join, cap) |
515 */ | 516 */ |
516 void drawPath(const GrPaint& paint, const SkPath& path, const SkStrokeRec& s troke); | 517 void drawPath(const GrPaint& paint, const SkPath& path, const GrStrokeInfo& strokeInfo); |
517 | 518 |
518 /** | 519 /** |
519 * Draws vertices with a paint. | 520 * Draws vertices with a paint. |
520 * | 521 * |
521 * @param paint describes how to color pixels. | 522 * @param paint describes how to color pixels. |
522 * @param primitiveType primitives type to draw. | 523 * @param primitiveType primitives type to draw. |
523 * @param vertexCount number of vertices. | 524 * @param vertexCount number of vertices. |
524 * @param positions array of vertex positions, required. | 525 * @param positions array of vertex positions, required. |
525 * @param texCoords optional array of texture coordinates used | 526 * @param texCoords optional array of texture coordinates used |
526 * to access the paint. | 527 * to access the paint. |
(...skipping 10 matching lines...) Expand all Loading... | |
537 const SkPoint positions[], | 538 const SkPoint positions[], |
538 const SkPoint texs[], | 539 const SkPoint texs[], |
539 const GrColor colors[], | 540 const GrColor colors[], |
540 const uint16_t indices[], | 541 const uint16_t indices[], |
541 int indexCount); | 542 int indexCount); |
542 | 543 |
543 /** | 544 /** |
544 * Draws an oval. | 545 * Draws an oval. |
545 * | 546 * |
546 * @param paint describes how to color pixels. | 547 * @param paint describes how to color pixels. |
547 * @param oval the bounding rect of the oval. | 548 * @param oval the bounding rect of the oval. |
robertphillips
2014/06/05 18:28:00
strokeInfo ?
| |
548 * @param stroke the stroke information (width, style) | 549 * @param stroke the stroke information (width, style) |
549 */ | 550 */ |
550 void drawOval(const GrPaint& paint, | 551 void drawOval(const GrPaint& paint, |
551 const SkRect& oval, | 552 const SkRect& oval, |
552 const SkStrokeRec& stroke); | 553 const GrStrokeInfo& strokeInfo); |
553 | 554 |
554 /////////////////////////////////////////////////////////////////////////// | 555 /////////////////////////////////////////////////////////////////////////// |
555 // Misc. | 556 // Misc. |
556 | 557 |
557 /** | 558 /** |
558 * Flags that affect flush() behavior. | 559 * Flags that affect flush() behavior. |
559 */ | 560 */ |
560 enum FlushBits { | 561 enum FlushBits { |
561 /** | 562 /** |
562 * A client may reach a point where it has partially rendered a frame | 563 * A client may reach a point where it has partially rendered a frame |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
988 | 989 |
989 void setupDrawBuffer(); | 990 void setupDrawBuffer(); |
990 | 991 |
991 class AutoRestoreEffects; | 992 class AutoRestoreEffects; |
992 class AutoCheckFlush; | 993 class AutoCheckFlush; |
993 /// Sets the paint and returns the target to draw into. The paint can be NUL L in which case the | 994 /// Sets the paint and returns the target to draw into. The paint can be NUL L in which case the |
994 /// draw state is left unmodified. | 995 /// draw state is left unmodified. |
995 GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw, AutoRestoreEffects *, AutoCheckFlush*); | 996 GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw, AutoRestoreEffects *, AutoCheckFlush*); |
996 | 997 |
997 void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path, | 998 void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path, |
998 const SkStrokeRec& stroke); | 999 const GrStrokeInfo& stroke); |
999 | 1000 |
1000 GrTexture* createResizedTexture(const GrTextureDesc& desc, | 1001 GrTexture* createResizedTexture(const GrTextureDesc& desc, |
1001 const GrCacheID& cacheID, | 1002 const GrCacheID& cacheID, |
1002 const void* srcData, | 1003 const void* srcData, |
1003 size_t rowBytes, | 1004 size_t rowBytes, |
1004 bool filter); | 1005 bool filter); |
1005 | 1006 |
1006 // Needed so GrTexture's returnToCache helper function can call | 1007 // Needed so GrTexture's returnToCache helper function can call |
1007 // addExistingTextureToCache | 1008 // addExistingTextureToCache |
1008 friend class GrTexture; | 1009 friend class GrTexture; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1122 } | 1123 } |
1123 | 1124 |
1124 GrTexture* texture() { return fTexture; } | 1125 GrTexture* texture() { return fTexture; } |
1125 | 1126 |
1126 private: | 1127 private: |
1127 GrContext* fContext; | 1128 GrContext* fContext; |
1128 GrTexture* fTexture; | 1129 GrTexture* fTexture; |
1129 }; | 1130 }; |
1130 | 1131 |
1131 #endif | 1132 #endif |
OLD | NEW |