| 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 #ifndef GrContext_DEFINED | 10 #ifndef GrContext_DEFINED |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 * @param matrix Optional matrix applied to the rect. Applied before | 377 * @param matrix Optional matrix applied to the rect. Applied before |
| 378 * context's matrix or the paint's matrix. | 378 * context's matrix or the paint's matrix. |
| 379 * The rects coords are used to access the paint (through texture matrix) | 379 * The rects coords are used to access the paint (through texture matrix) |
| 380 */ | 380 */ |
| 381 void drawRect(const GrPaint& paint, | 381 void drawRect(const GrPaint& paint, |
| 382 const GrRect&, | 382 const GrRect&, |
| 383 SkScalar strokeWidth = -1, | 383 SkScalar strokeWidth = -1, |
| 384 const SkMatrix* matrix = NULL); | 384 const SkMatrix* matrix = NULL); |
| 385 | 385 |
| 386 /** | 386 /** |
| 387 * Maps a rect of paint coordinates onto the a rect of destination | 387 * Maps a rect of local coordinates onto the a rect of destination |
| 388 * coordinates. Each rect can optionally be transformed. The srcRect | 388 * coordinates. Each rect can optionally be transformed. The localRect |
| 389 * is stretched over the dstRect. The dstRect is transformed by the | 389 * is stretched over the dstRect. The dstRect is transformed by the |
| 390 * context's matrix and the srcRect is transformed by the paint's matrix. | 390 * context's matrix. Additional optional matrices for both rects can be |
| 391 * Additional optional matrices can be provided by parameters. | 391 * provided by parameters. |
| 392 * | 392 * |
| 393 * @param paint describes how to color pixels. | 393 * @param paint describes how to color pixels. |
| 394 * @param dstRect the destination rect to draw. | 394 * @param dstRect the destination rect to draw. |
| 395 * @param srcRect rect of paint coordinates to be mapped onto dstRect | 395 * @param localRect rect of local coordinates to be mapped onto dstRect |
| 396 * @param dstMatrix Optional matrix to transform dstRect. Applied before | 396 * @param dstMatrix Optional matrix to transform dstRect. Applied before
context's matrix. |
| 397 * context's matrix. | 397 * @param localMatrix Optional matrix to transform localRect. |
| 398 * @param srcMatrix Optional matrix to transform srcRect Applied before | |
| 399 * paint's matrix. | |
| 400 */ | 398 */ |
| 401 void drawRectToRect(const GrPaint& paint, | 399 void drawRectToRect(const GrPaint& paint, |
| 402 const GrRect& dstRect, | 400 const GrRect& dstRect, |
| 403 const GrRect& srcRect, | 401 const GrRect& localRect, |
| 404 const SkMatrix* dstMatrix = NULL, | 402 const SkMatrix* dstMatrix = NULL, |
| 405 const SkMatrix* srcMatrix = NULL); | 403 const SkMatrix* localMatrix = NULL); |
| 406 | 404 |
| 407 /** | 405 /** |
| 408 * Draws a path. | 406 * Draws a path. |
| 409 * | 407 * |
| 410 * @param paint describes how to color pixels. | 408 * @param paint describes how to color pixels. |
| 411 * @param path the path to draw | 409 * @param path the path to draw |
| 412 * @param stroke the stroke information (width, join, cap) | 410 * @param stroke the stroke information (width, join, cap) |
| 413 */ | 411 */ |
| 414 void drawPath(const GrPaint& paint, const SkPath& path, const SkStrokeRec& s
troke); | 412 void drawPath(const GrPaint& paint, const SkPath& path, const SkStrokeRec& s
troke); |
| 415 | 413 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 /** | 684 /** |
| 687 * Sets the context's matrix to identity. Returns false if the inverse m
atrix is required to | 685 * Sets the context's matrix to identity. Returns false if the inverse m
atrix is required to |
| 688 * update a paint but the matrix cannot be inverted. | 686 * update a paint but the matrix cannot be inverted. |
| 689 */ | 687 */ |
| 690 bool setIdentity(GrContext* context, GrPaint* paint = NULL) { | 688 bool setIdentity(GrContext* context, GrPaint* paint = NULL) { |
| 691 GrAssert(NULL != context); | 689 GrAssert(NULL != context); |
| 692 | 690 |
| 693 this->restore(); | 691 this->restore(); |
| 694 | 692 |
| 695 if (NULL != paint) { | 693 if (NULL != paint) { |
| 696 if (!paint->sourceCoordChangeByInverse(context->getMatrix())) { | 694 if (!paint->localCoordChangeInverse(context->getMatrix())) { |
| 697 return false; | 695 return false; |
| 698 } | 696 } |
| 699 } | 697 } |
| 700 fMatrix = context->getMatrix(); | 698 fMatrix = context->getMatrix(); |
| 701 fContext = context; | 699 fContext = context; |
| 702 context->setIdentityMatrix(); | 700 context->setIdentityMatrix(); |
| 703 return true; | 701 return true; |
| 704 } | 702 } |
| 705 | 703 |
| 706 /** | 704 /** |
| (...skipping 17 matching lines...) Expand all Loading... |
| 724 | 722 |
| 725 /** | 723 /** |
| 726 * If this has been initialized then the context's matrix will be furthe
r updated by | 724 * If this has been initialized then the context's matrix will be furthe
r updated by |
| 727 * pre-concat'ing the preConcat param. The matrix that will be restored
remains unchanged. | 725 * pre-concat'ing the preConcat param. The matrix that will be restored
remains unchanged. |
| 728 * The paint is assumed to be relative to the context's matrix at the ti
me this call is | 726 * The paint is assumed to be relative to the context's matrix at the ti
me this call is |
| 729 * made, not the matrix at the time AutoMatrix was first initialized. In
other words, this | 727 * made, not the matrix at the time AutoMatrix was first initialized. In
other words, this |
| 730 * performs an incremental update of the paint. | 728 * performs an incremental update of the paint. |
| 731 */ | 729 */ |
| 732 void preConcat(const SkMatrix& preConcat, GrPaint* paint = NULL) { | 730 void preConcat(const SkMatrix& preConcat, GrPaint* paint = NULL) { |
| 733 if (NULL != paint) { | 731 if (NULL != paint) { |
| 734 paint->sourceCoordChange(preConcat); | 732 paint->localCoordChange(preConcat); |
| 735 } | 733 } |
| 736 fContext->concatMatrix(preConcat); | 734 fContext->concatMatrix(preConcat); |
| 737 } | 735 } |
| 738 | 736 |
| 739 /** | 737 /** |
| 740 * Returns false if never initialized or the inverse matrix was required
to update a paint | 738 * Returns false if never initialized or the inverse matrix was required
to update a paint |
| 741 * but the matrix could not be inverted. | 739 * but the matrix could not be inverted. |
| 742 */ | 740 */ |
| 743 bool succeeded() const { return NULL != fContext; } | 741 bool succeeded() const { return NULL != fContext; } |
| 744 | 742 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 } | 994 } |
| 997 | 995 |
| 998 GrTexture* texture() { return fTexture; } | 996 GrTexture* texture() { return fTexture; } |
| 999 | 997 |
| 1000 private: | 998 private: |
| 1001 GrContext* fContext; | 999 GrContext* fContext; |
| 1002 GrTexture* fTexture; | 1000 GrTexture* fTexture; |
| 1003 }; | 1001 }; |
| 1004 | 1002 |
| 1005 #endif | 1003 #endif |
| OLD | NEW |