Chromium Code Reviews| 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 * that are not also textures (e.g. FBO 0 in OpenGL, or an MSAA buffer that | 380 * that are not also textures (e.g. FBO 0 in OpenGL, or an MSAA buffer that |
| 381 * the client will resolve to a texture). | 381 * the client will resolve to a texture). |
| 382 * | 382 * |
| 383 * @param desc description of the object to create. | 383 * @param desc description of the object to create. |
| 384 * | 384 * |
| 385 * @return GrTexture object or NULL on failure. | 385 * @return GrTexture object or NULL on failure. |
| 386 */ | 386 */ |
| 387 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc& de sc); | 387 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc& de sc); |
| 388 | 388 |
| 389 /////////////////////////////////////////////////////////////////////////// | 389 /////////////////////////////////////////////////////////////////////////// |
| 390 // Matrix state | |
| 391 | |
| 392 /** | |
| 393 * Gets the current transformation matrix. | |
| 394 * @return the current matrix. | |
| 395 */ | |
| 396 const SkMatrix& getMatrix() const { return fViewMatrix; } | |
| 397 | |
| 398 /** | |
| 399 * Sets the transformation matrix. | |
| 400 * @param m the matrix to set. | |
| 401 */ | |
| 402 void setMatrix(const SkMatrix& m) { fViewMatrix = m; } | |
| 403 | |
| 404 /** | |
| 405 * Sets the current transformation matrix to identity. | |
| 406 */ | |
| 407 void setIdentityMatrix() { fViewMatrix.reset(); } | |
| 408 | |
| 409 /** | |
| 410 * Concats the current matrix. The passed matrix is applied before the | |
| 411 * current matrix. | |
| 412 * @param m the matrix to concat. | |
| 413 */ | |
| 414 void concatMatrix(const SkMatrix& m) { fViewMatrix.preConcat(m); } | |
| 415 | |
| 416 | |
| 417 /////////////////////////////////////////////////////////////////////////// | |
| 418 // Clip state | 390 // Clip state |
| 419 /** | 391 /** |
| 420 * Gets the current clip. | 392 * Gets the current clip. |
| 421 * @return the current clip. | 393 * @return the current clip. |
| 422 */ | 394 */ |
| 423 const GrClipData* getClip() const { return fClip; } | 395 const GrClipData* getClip() const { return fClip; } |
| 424 | 396 |
| 425 /** | 397 /** |
| 426 * Sets the clip. | 398 * Sets the clip. |
| 427 * @param clipData the clip to set. | 399 * @param clipData the clip to set. |
| 428 */ | 400 */ |
| 429 void setClip(const GrClipData* clipData) { fClip = clipData; } | 401 void setClip(const GrClipData* clipData) { fClip = clipData; } |
| 430 | 402 |
| 431 /////////////////////////////////////////////////////////////////////////// | 403 /////////////////////////////////////////////////////////////////////////// |
| 432 // Draws | 404 // Draws |
| 433 | 405 |
| 434 /** | 406 /** |
| 435 * Clear the entire or rect of the render target, ignoring any clips. | 407 * Clear the entire or rect of the render target, ignoring any clips. |
| 436 * @param rect the rect to clear or the whole thing if rect is NULL. | 408 * @param rect the rect to clear or the whole thing if rect is NULL. |
| 437 * @param color the color to clear to. | 409 * @param color the color to clear to. |
| 438 * @param canIgnoreRect allows partial clears to be converted to whole | 410 * @param canIgnoreRect allows partial clears to be converted to whole |
| 439 * clears on platforms for which that is cheap | 411 * clears on platforms for which that is cheap |
| 440 * @param target The render target to clear. | 412 * @param target The render target to clear. |
| 441 */ | 413 */ |
| 442 void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect, GrRenderT arget* target); | 414 void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect, GrRenderT arget* target); |
| 443 | 415 |
| 444 /** | 416 /** |
| 445 * Draw everywhere (respecting the clip) with the paint. | 417 * Draw everywhere (respecting the clip) with the paint. |
| 446 */ | 418 */ |
| 447 void drawPaint(const GrPaint& paint); | 419 void drawPaint(const GrPaint&, const SkMatrix& viewMatrix); |
| 448 | 420 |
| 449 /** | 421 /** |
| 450 * Draw the rect using a paint. | 422 * Draw the rect using a paint. |
| 451 * @param paint describes how to color pixels. | 423 * @param paint describes how to color pixels. |
| 424 * @param viewMatrix transformation matrix | |
| 452 * @param strokeInfo the stroke information (width, join, cap), and. | 425 * @param strokeInfo the stroke information (width, join, cap), and. |
| 453 * the dash information (intervals, count, phase). | 426 * the dash information (intervals, count, phase). |
| 454 * If strokeInfo == NULL, then the rect is filled. | 427 * If strokeInfo == NULL, then the rect is filled. |
| 455 * Otherwise, if stroke width == 0, then the stroke | 428 * Otherwise, if stroke width == 0, then the stroke |
| 456 * is always a single pixel thick, else the rect is | 429 * is always a single pixel thick, else the rect is |
| 457 * mitered/beveled stroked based on stroke width. | 430 * mitered/beveled stroked based on stroke width. |
| 458 * The rects coords are used to access the paint (through texture matrix) | 431 * The rects coords are used to access the paint (through texture matrix) |
| 459 */ | 432 */ |
| 460 void drawRect(const GrPaint& paint, | 433 void drawRect(const GrPaint& paint, |
| 434 const SkMatrix& viewMatrix, | |
| 461 const SkRect&, | 435 const SkRect&, |
| 462 const GrStrokeInfo* strokeInfo = NULL); | 436 const GrStrokeInfo* strokeInfo = NULL); |
| 463 | 437 |
| 464 /** | 438 /** |
| 465 * Maps a rect of local coordinates onto the a rect of destination | 439 * Maps a rect of local coordinates onto the a rect of destination |
| 466 * coordinates. The localRect is stretched over the dstRect. The dstRect is | 440 * coordinates. The localRect is stretched over the dstRect. The dstRect is |
| 467 * transformed by the context's matrix. An additional optional matrix can be | 441 * transformed by the context's matrix. An additional optional matrix can be |
| 468 * provided to transform the local rect. | 442 * provided to transform the local rect. |
| 469 * | 443 * |
| 470 * @param paint describes how to color pixels. | 444 * @param paint describes how to color pixels. |
| 445 * @param viewMatrix transformation matrix | |
| 471 * @param dstRect the destination rect to draw. | 446 * @param dstRect the destination rect to draw. |
| 472 * @param localRect rect of local coordinates to be mapped onto dstRect | 447 * @param localRect rect of local coordinates to be mapped onto dstRect |
| 473 * @param localMatrix Optional matrix to transform localRect. | 448 * @param localMatrix Optional matrix to transform localRect. |
| 474 */ | 449 */ |
| 475 void drawRectToRect(const GrPaint& paint, | 450 void drawRectToRect(const GrPaint& paint, |
| 451 const SkMatrix& viewMatrix, | |
|
bsalomon
2014/12/17 17:12:33
I'm wondering whether the viewMatrix is needed her
| |
| 476 const SkRect& dstRect, | 452 const SkRect& dstRect, |
| 477 const SkRect& localRect, | 453 const SkRect& localRect, |
| 478 const SkMatrix* localMatrix = NULL); | 454 const SkMatrix* localMatrix = NULL); |
| 479 | 455 |
| 480 /** | 456 /** |
| 481 * Draw a roundrect using a paint. | 457 * Draw a roundrect using a paint. |
| 482 * | 458 * |
| 483 * @param paint describes how to color pixels. | 459 * @param paint describes how to color pixels. |
| 460 * @param viewMatrix transformation matrix | |
| 484 * @param rrect the roundrect to draw | 461 * @param rrect the roundrect to draw |
| 485 * @param strokeInfo the stroke information (width, join, cap) and | 462 * @param strokeInfo the stroke information (width, join, cap) and |
| 486 * the dash information (intervals, count, phase). | 463 * the dash information (intervals, count, phase). |
| 487 */ | 464 */ |
| 488 void drawRRect(const GrPaint& paint, const SkRRect& rrect, const GrStrokeInf o& strokeInfo); | 465 void drawRRect(const GrPaint&, const SkMatrix& viewMatrix, const SkRRect& rr ect, |
| 466 const GrStrokeInfo&); | |
| 489 | 467 |
| 490 /** | 468 /** |
| 491 * Shortcut for drawing an SkPath consisting of nested rrects using a paint . | 469 * Shortcut for drawing an SkPath consisting of nested rrects using a paint . |
| 492 * Does not support stroking. The result is undefined if outer does not con tain | 470 * Does not support stroking. The result is undefined if outer does not con tain |
| 493 * inner. | 471 * inner. |
| 494 * | 472 * |
| 495 * @param paint describes how to color pixels. | 473 * @param paint describes how to color pixels. |
| 474 * @param viewMatrix transformation matrix | |
| 496 * @param outer the outer roundrect | 475 * @param outer the outer roundrect |
| 497 * @param inner the inner roundrect | 476 * @param inner the inner roundrect |
| 498 */ | 477 */ |
| 499 void drawDRRect(const GrPaint& paint, const SkRRect& outer, const SkRRect& i nner); | 478 void drawDRRect(const GrPaint&, const SkMatrix& viewMatrix, const SkRRect& o uter, |
| 479 const SkRRect& inner); | |
| 500 | 480 |
| 501 | 481 |
| 502 /** | 482 /** |
| 503 * Draws a path. | 483 * Draws a path. |
| 504 * | 484 * |
| 505 * @param paint describes how to color pixels. | 485 * @param paint describes how to color pixels. |
| 486 * @param viewMatrix transformation matrix | |
|
bsalomon
2014/12/17 17:12:33
ex space
| |
| 506 * @param path the path to draw | 487 * @param path the path to draw |
| 507 * @param strokeInfo the stroke information (width, join, cap) and | 488 * @param strokeInfo the stroke information (width, join, cap) and |
| 508 * the dash information (intervals, count, phase). | 489 * the dash information (intervals, count, phase). |
| 509 */ | 490 */ |
| 510 void drawPath(const GrPaint& paint, const SkPath& path, const GrStrokeInfo& strokeInfo); | 491 void drawPath(const GrPaint&, const SkMatrix& viewMatrix, const SkPath&, con st GrStrokeInfo&); |
| 511 | 492 |
| 512 /** | 493 /** |
| 513 * Draws vertices with a paint. | 494 * Draws vertices with a paint. |
| 514 * | 495 * |
| 515 * @param paint describes how to color pixels. | 496 * @param paint describes how to color pixels. |
| 497 * @param viewMatrix transformation matrix | |
| 516 * @param primitiveType primitives type to draw. | 498 * @param primitiveType primitives type to draw. |
| 517 * @param vertexCount number of vertices. | 499 * @param vertexCount number of vertices. |
| 518 * @param positions array of vertex positions, required. | 500 * @param positions array of vertex positions, required. |
| 519 * @param texCoords optional array of texture coordinates used | 501 * @param texCoords optional array of texture coordinates used |
| 520 * to access the paint. | 502 * to access the paint. |
| 521 * @param colors optional array of per-vertex colors, supercedes | 503 * @param colors optional array of per-vertex colors, supercedes |
| 522 * the paint's color field. | 504 * the paint's color field. |
| 523 * @param indices optional array of indices. If NULL vertices | 505 * @param indices optional array of indices. If NULL vertices |
| 524 * are drawn non-indexed. | 506 * are drawn non-indexed. |
| 525 * @param indexCount if indices is non-null then this is the | 507 * @param indexCount if indices is non-null then this is the |
| 526 * number of indices. | 508 * number of indices. |
| 527 */ | 509 */ |
| 528 void drawVertices(const GrPaint& paint, | 510 void drawVertices(const GrPaint& paint, |
| 511 const SkMatrix& viewMatrix, | |
| 529 GrPrimitiveType primitiveType, | 512 GrPrimitiveType primitiveType, |
| 530 int vertexCount, | 513 int vertexCount, |
| 531 const SkPoint positions[], | 514 const SkPoint positions[], |
| 532 const SkPoint texs[], | 515 const SkPoint texs[], |
| 533 const GrColor colors[], | 516 const GrColor colors[], |
| 534 const uint16_t indices[], | 517 const uint16_t indices[], |
| 535 int indexCount); | 518 int indexCount); |
| 536 | 519 |
| 537 /** | 520 /** |
| 538 * Draws an oval. | 521 * Draws an oval. |
| 539 * | 522 * |
| 540 * @param paint describes how to color pixels. | 523 * @param paint describes how to color pixels. |
| 524 * @param viewMatrix transformation matrix | |
| 541 * @param oval the bounding rect of the oval. | 525 * @param oval the bounding rect of the oval. |
| 542 * @param strokeInfo the stroke information (width, join, cap) and | 526 * @param strokeInfo the stroke information (width, join, cap) and |
| 543 * the dash information (intervals, count, phase). | 527 * the dash information (intervals, count, phase). |
| 544 */ | 528 */ |
| 545 void drawOval(const GrPaint& paint, | 529 void drawOval(const GrPaint& paint, |
| 530 const SkMatrix& viewMatrix, | |
| 546 const SkRect& oval, | 531 const SkRect& oval, |
| 547 const GrStrokeInfo& strokeInfo); | 532 const GrStrokeInfo& strokeInfo); |
| 548 | 533 |
| 549 /////////////////////////////////////////////////////////////////////////// | 534 /////////////////////////////////////////////////////////////////////////// |
| 550 // Misc. | 535 // Misc. |
| 551 | 536 |
| 552 /** | 537 /** |
| 553 * Flags that affect flush() behavior. | 538 * Flags that affect flush() behavior. |
| 554 */ | 539 */ |
| 555 enum FlushBits { | 540 enum FlushBits { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 702 if (fContext) { | 687 if (fContext) { |
| 703 fContext->setRenderTarget(fPrevTarget); | 688 fContext->setRenderTarget(fPrevTarget); |
| 704 } | 689 } |
| 705 SkSafeUnref(fPrevTarget); | 690 SkSafeUnref(fPrevTarget); |
| 706 } | 691 } |
| 707 private: | 692 private: |
| 708 GrContext* fContext; | 693 GrContext* fContext; |
| 709 GrRenderTarget* fPrevTarget; | 694 GrRenderTarget* fPrevTarget; |
| 710 }; | 695 }; |
| 711 | 696 |
| 712 /** | |
|
bsalomon
2014/12/17 17:12:33
w00t
| |
| 713 * Save/restore the view-matrix in the context. It can optionally adjust a p aint to account | |
| 714 * for a coordinate system change. Here is an example of how the paint param can be used: | |
| 715 * | |
| 716 * A GrPaint is setup with GrProcessors. The stages will have access to the pre-matrix source | |
| 717 * geometry positions when the draw is executed. Later on a decision is made to transform the | |
| 718 * geometry to device space on the CPU. The effects now need to know that th e space in which | |
| 719 * the geometry will be specified has changed. | |
| 720 * | |
| 721 * Note that when restore is called (or in the destructor) the context's mat rix will be | |
| 722 * restored. However, the paint will not be restored. The caller must make a copy of the | |
| 723 * paint if necessary. Hint: use SkTCopyOnFirstWrite if the AutoMatrix is co nditionally | |
| 724 * initialized. | |
| 725 */ | |
| 726 class AutoMatrix : public ::SkNoncopyable { | |
| 727 public: | |
| 728 AutoMatrix() : fContext(NULL) {} | |
| 729 | |
| 730 ~AutoMatrix() { this->restore(); } | |
| 731 | |
| 732 /** | |
| 733 * Initializes by pre-concat'ing the context's current matrix with the p reConcat param. | |
| 734 */ | |
| 735 void setPreConcat(GrContext* context, const SkMatrix& preConcat, GrPaint * paint = NULL) { | |
| 736 SkASSERT(context); | |
| 737 | |
| 738 this->restore(); | |
| 739 | |
| 740 fContext = context; | |
| 741 fMatrix = context->getMatrix(); | |
| 742 this->preConcat(preConcat, paint); | |
| 743 } | |
| 744 | |
| 745 /** | |
| 746 * Sets the context's matrix to identity. Returns false if the inverse m atrix is required to | |
| 747 * update a paint but the matrix cannot be inverted. | |
| 748 */ | |
| 749 bool setIdentity(GrContext* context, GrPaint* paint = NULL) { | |
| 750 SkASSERT(context); | |
| 751 | |
| 752 this->restore(); | |
| 753 | |
| 754 if (paint) { | |
| 755 if (!paint->localCoordChangeInverse(context->getMatrix())) { | |
| 756 return false; | |
| 757 } | |
| 758 } | |
| 759 fMatrix = context->getMatrix(); | |
| 760 fContext = context; | |
| 761 context->setIdentityMatrix(); | |
| 762 return true; | |
| 763 } | |
| 764 | |
| 765 /** | |
| 766 * Replaces the context's matrix with a new matrix. Returns false if the inverse matrix is | |
| 767 * required to update a paint but the matrix cannot be inverted. | |
| 768 */ | |
| 769 bool set(GrContext* context, const SkMatrix& newMatrix, GrPaint* paint = NULL) { | |
| 770 if (paint) { | |
| 771 if (!this->setIdentity(context, paint)) { | |
| 772 return false; | |
| 773 } | |
| 774 this->preConcat(newMatrix, paint); | |
| 775 } else { | |
| 776 this->restore(); | |
| 777 fContext = context; | |
| 778 fMatrix = context->getMatrix(); | |
| 779 context->setMatrix(newMatrix); | |
| 780 } | |
| 781 return true; | |
| 782 } | |
| 783 | |
| 784 /** | |
| 785 * If this has been initialized then the context's matrix will be furthe r updated by | |
| 786 * pre-concat'ing the preConcat param. The matrix that will be restored remains unchanged. | |
| 787 * The paint is assumed to be relative to the context's matrix at the ti me this call is | |
| 788 * made, not the matrix at the time AutoMatrix was first initialized. In other words, this | |
| 789 * performs an incremental update of the paint. | |
| 790 */ | |
| 791 void preConcat(const SkMatrix& preConcat, GrPaint* paint = NULL) { | |
| 792 if (paint) { | |
| 793 paint->localCoordChange(preConcat); | |
| 794 } | |
| 795 fContext->concatMatrix(preConcat); | |
| 796 } | |
| 797 | |
| 798 /** | |
| 799 * Returns false if never initialized or the inverse matrix was required to update a paint | |
| 800 * but the matrix could not be inverted. | |
| 801 */ | |
| 802 bool succeeded() const { return SkToBool(fContext); } | |
| 803 | |
| 804 /** | |
| 805 * If this has been initialized then the context's original matrix is re stored. | |
| 806 */ | |
| 807 void restore() { | |
| 808 if (fContext) { | |
| 809 fContext->setMatrix(fMatrix); | |
| 810 fContext = NULL; | |
| 811 } | |
| 812 } | |
| 813 | |
| 814 private: | |
| 815 GrContext* fContext; | |
| 816 SkMatrix fMatrix; | |
| 817 }; | |
| 818 | |
| 819 class AutoClip : public ::SkNoncopyable { | 697 class AutoClip : public ::SkNoncopyable { |
| 820 public: | 698 public: |
| 821 // This enum exists to require a caller of the constructor to acknowledg e that the clip will | 699 // This enum exists to require a caller of the constructor to acknowledg e that the clip will |
| 822 // initially be wide open. It also could be extended if there are other desirable initial | 700 // initially be wide open. It also could be extended if there are other desirable initial |
| 823 // clip states. | 701 // clip states. |
| 824 enum InitialClip { | 702 enum InitialClip { |
| 825 kWideOpen_InitialClip, | 703 kWideOpen_InitialClip, |
| 826 }; | 704 }; |
| 827 | 705 |
| 828 AutoClip(GrContext* context, InitialClip SkDEBUGCODE(initialState)) | 706 AutoClip(GrContext* context, InitialClip SkDEBUGCODE(initialState)) |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 854 | 732 |
| 855 SkClipStack fNewClipStack; | 733 SkClipStack fNewClipStack; |
| 856 GrClipData fNewClipData; | 734 GrClipData fNewClipData; |
| 857 }; | 735 }; |
| 858 | 736 |
| 859 class AutoWideOpenIdentityDraw { | 737 class AutoWideOpenIdentityDraw { |
| 860 public: | 738 public: |
| 861 AutoWideOpenIdentityDraw(GrContext* ctx, GrRenderTarget* rt) | 739 AutoWideOpenIdentityDraw(GrContext* ctx, GrRenderTarget* rt) |
| 862 : fAutoClip(ctx, AutoClip::kWideOpen_InitialClip) | 740 : fAutoClip(ctx, AutoClip::kWideOpen_InitialClip) |
| 863 , fAutoRT(ctx, rt) { | 741 , fAutoRT(ctx, rt) { |
| 864 fAutoMatrix.setIdentity(ctx); | |
| 865 // should never fail with no paint param. | |
| 866 SkASSERT(fAutoMatrix.succeeded()); | |
| 867 } | 742 } |
| 868 | 743 |
| 869 private: | 744 private: |
| 870 AutoClip fAutoClip; | 745 AutoClip fAutoClip; |
| 871 AutoRenderTarget fAutoRT; | 746 AutoRenderTarget fAutoRT; |
| 872 AutoMatrix fAutoMatrix; | |
| 873 }; | 747 }; |
| 874 | 748 |
| 875 /////////////////////////////////////////////////////////////////////////// | 749 /////////////////////////////////////////////////////////////////////////// |
| 876 // Functions intended for internal use only. | 750 // Functions intended for internal use only. |
| 877 GrGpu* getGpu() { return fGpu; } | 751 GrGpu* getGpu() { return fGpu; } |
| 878 const GrGpu* getGpu() const { return fGpu; } | 752 const GrGpu* getGpu() const { return fGpu; } |
| 879 GrFontCache* getFontCache() { return fFontCache; } | 753 GrFontCache* getFontCache() { return fFontCache; } |
| 880 GrLayerCache* getLayerCache() { return fLayerCache.get(); } | 754 GrLayerCache* getLayerCache() { return fLayerCache.get(); } |
| 881 GrDrawTarget* getTextTarget(); | 755 GrDrawTarget* getTextTarget(); |
| 882 const GrIndexBuffer* getQuadIndexBuffer() const; | 756 const GrIndexBuffer* getQuadIndexBuffer() const; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 927 void incShaderCompilations() {} | 801 void incShaderCompilations() {} |
| 928 #endif | 802 #endif |
| 929 }; | 803 }; |
| 930 | 804 |
| 931 #if GR_GPU_STATS | 805 #if GR_GPU_STATS |
| 932 const GPUStats* gpuStats() const; | 806 const GPUStats* gpuStats() const; |
| 933 #endif | 807 #endif |
| 934 | 808 |
| 935 private: | 809 private: |
| 936 GrGpu* fGpu; | 810 GrGpu* fGpu; |
| 937 SkMatrix fViewMatrix; | |
| 938 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 811 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
| 939 const GrClipData* fClip; // TODO: make this ref counted | 812 const GrClipData* fClip; // TODO: make this ref counted |
| 940 | 813 |
| 941 GrResourceCache2* fResourceCache2; | 814 GrResourceCache2* fResourceCache2; |
| 942 GrFontCache* fFontCache; | 815 GrFontCache* fFontCache; |
| 943 SkAutoTDelete<GrLayerCache> fLayerCache; | 816 SkAutoTDelete<GrLayerCache> fLayerCache; |
| 944 | 817 |
| 945 GrPathRendererChain* fPathRendererChain; | 818 GrPathRendererChain* fPathRendererChain; |
| 946 GrSoftwarePathRenderer* fSoftwarePathRenderer; | 819 GrSoftwarePathRenderer* fSoftwarePathRenderer; |
| 947 | 820 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 972 GrContext(const Options&); // init must be called after the constructor. | 845 GrContext(const Options&); // init must be called after the constructor. |
| 973 bool init(GrBackend, GrBackendContext); | 846 bool init(GrBackend, GrBackendContext); |
| 974 void initMockContext(); | 847 void initMockContext(); |
| 975 void initCommon(); | 848 void initCommon(); |
| 976 | 849 |
| 977 void setupDrawBuffer(); | 850 void setupDrawBuffer(); |
| 978 | 851 |
| 979 class AutoCheckFlush; | 852 class AutoCheckFlush; |
| 980 /// Sets the paint and returns the target to draw into. The paint can be NUL L in which case the | 853 /// Sets the paint and returns the target to draw into. The paint can be NUL L in which case the |
| 981 /// draw state is left unmodified. | 854 /// draw state is left unmodified. |
| 982 GrDrawTarget* prepareToDraw(GrDrawState* ds, const GrPaint* paint, const Aut oCheckFlush*); | 855 GrDrawTarget* prepareToDraw(GrDrawState* ds, |
| 856 const GrPaint* paint, | |
| 857 const SkMatrix* viewMatrix, | |
| 858 const AutoCheckFlush*); | |
| 983 | 859 |
| 984 void internalDrawPath(GrDrawTarget*, | 860 void internalDrawPath(GrDrawTarget*, |
| 985 GrDrawState*, | 861 GrDrawState*, |
| 862 const SkMatrix& viewMatrix, | |
| 986 GrColor, | 863 GrColor, |
| 987 bool useAA, | 864 bool useAA, |
| 988 const SkPath&, | 865 const SkPath&, |
| 989 const GrStrokeInfo&); | 866 const GrStrokeInfo&); |
| 990 | 867 |
| 991 GrTexture* createResizedTexture(const GrSurfaceDesc& desc, | 868 GrTexture* createResizedTexture(const GrSurfaceDesc& desc, |
| 992 const GrCacheID& cacheID, | 869 const GrCacheID& cacheID, |
| 993 const void* srcData, | 870 const void* srcData, |
| 994 size_t rowBytes, | 871 size_t rowBytes, |
| 995 bool filter); | 872 bool filter); |
| 996 | 873 |
| 997 /** | 874 /** |
| 998 * These functions create premul <-> unpremul effects if it is possible to g enerate a pair | 875 * These functions create premul <-> unpremul effects if it is possible to g enerate a pair |
| 999 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O therwise, they | 876 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O therwise, they |
| 1000 * return NULL. | 877 * return NULL. |
| 1001 */ | 878 */ |
| 1002 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&); | 879 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&); |
| 1003 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&); | 880 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&); |
| 1004 | 881 |
| 1005 /** | 882 /** |
| 1006 * This callback allows the resource cache to callback into the GrContext | 883 * This callback allows the resource cache to callback into the GrContext |
| 1007 * when the cache is still over budget after a purge. | 884 * when the cache is still over budget after a purge. |
| 1008 */ | 885 */ |
| 1009 static void OverBudgetCB(void* data); | 886 static void OverBudgetCB(void* data); |
| 1010 | 887 |
| 1011 typedef SkRefCnt INHERITED; | 888 typedef SkRefCnt INHERITED; |
| 1012 }; | 889 }; |
| 1013 | 890 |
| 1014 #endif | 891 #endif |
| OLD | NEW |