| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 SkCanvas_DEFINED | 8 #ifndef SkCanvas_DEFINED |
| 9 #define SkCanvas_DEFINED | 9 #define SkCanvas_DEFINED |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 class SkPicture; | 29 class SkPicture; |
| 30 class SkRRect; | 30 class SkRRect; |
| 31 class SkSurface; | 31 class SkSurface; |
| 32 class SkSurface_Base; | 32 class SkSurface_Base; |
| 33 class SkTextBlob; | 33 class SkTextBlob; |
| 34 class GrContext; | 34 class GrContext; |
| 35 class GrRenderTarget; | 35 class GrRenderTarget; |
| 36 | 36 |
| 37 class SkCanvasState; | 37 class SkCanvasState; |
| 38 | 38 |
| 39 #ifdef SK_SUPPORT_LEGACY_CANVAS_VIRTUAL | |
| 40 #define SK_LEGACY_CANVAS_VIRTUAL virtual | |
| 41 #else | |
| 42 #define SK_LEGACY_CANVAS_VIRTUAL | |
| 43 #endif | |
| 44 | |
| 45 /** \class SkCanvas | 39 /** \class SkCanvas |
| 46 | 40 |
| 47 A Canvas encapsulates all of the state about drawing into a device (bitmap). | 41 A Canvas encapsulates all of the state about drawing into a device (bitmap). |
| 48 This includes a reference to the device itself, and a stack of matrix/clip | 42 This includes a reference to the device itself, and a stack of matrix/clip |
| 49 values. For any given draw call (e.g. drawRect), the geometry of the object | 43 values. For any given draw call (e.g. drawRect), the geometry of the object |
| 50 being drawn is transformed by the concatenation of all the matrices in the | 44 being drawn is transformed by the concatenation of all the matrices in the |
| 51 stack. The transformed geometry is clipped by the intersection of all of | 45 stack. The transformed geometry is clipped by the intersection of all of |
| 52 the clips in the stack. | 46 the clips in the stack. |
| 53 | 47 |
| 54 While the Canvas holds the state of the drawing device, the state (style) | 48 While the Canvas holds the state of the drawing device, the state (style) |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 * to optimize performance on subsequent draws. Thus, if you call this and t
hen | 601 * to optimize performance on subsequent draws. Thus, if you call this and t
hen |
| 608 * never draw to the canvas subsequently you may pay a perfomance penalty. | 602 * never draw to the canvas subsequently you may pay a perfomance penalty. |
| 609 */ | 603 */ |
| 610 void discard() { this->onDiscard(); } | 604 void discard() { this->onDiscard(); } |
| 611 | 605 |
| 612 /** | 606 /** |
| 613 * Fill the entire canvas' bitmap (restricted to the current clip) with the | 607 * Fill the entire canvas' bitmap (restricted to the current clip) with the |
| 614 * specified paint. | 608 * specified paint. |
| 615 * @param paint The paint used to fill the canvas | 609 * @param paint The paint used to fill the canvas |
| 616 */ | 610 */ |
| 617 SK_LEGACY_CANVAS_VIRTUAL void drawPaint(const SkPaint& paint); | 611 virtual void drawPaint(const SkPaint& paint); |
| 618 | 612 |
| 619 enum PointMode { | 613 enum PointMode { |
| 620 /** drawPoints draws each point separately */ | 614 /** drawPoints draws each point separately */ |
| 621 kPoints_PointMode, | 615 kPoints_PointMode, |
| 622 /** drawPoints draws each pair of points as a line segment */ | 616 /** drawPoints draws each pair of points as a line segment */ |
| 623 kLines_PointMode, | 617 kLines_PointMode, |
| 624 /** drawPoints draws the array of points as a polygon */ | 618 /** drawPoints draws the array of points as a polygon */ |
| 625 kPolygon_PointMode | 619 kPolygon_PointMode |
| 626 }; | 620 }; |
| 627 | 621 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 639 Note that, while similar, kLine and kPolygon modes draw slightly | 633 Note that, while similar, kLine and kPolygon modes draw slightly |
| 640 differently than the equivalent path built with a series of moveto, | 634 differently than the equivalent path built with a series of moveto, |
| 641 lineto calls, in that the path will draw all of its contours at once, | 635 lineto calls, in that the path will draw all of its contours at once, |
| 642 with no interactions if contours intersect each other (think XOR | 636 with no interactions if contours intersect each other (think XOR |
| 643 xfermode). drawPoints always draws each element one at a time. | 637 xfermode). drawPoints always draws each element one at a time. |
| 644 @param mode PointMode specifying how to draw the array of points. | 638 @param mode PointMode specifying how to draw the array of points. |
| 645 @param count The number of points in the array | 639 @param count The number of points in the array |
| 646 @param pts Array of points to draw | 640 @param pts Array of points to draw |
| 647 @param paint The paint used to draw the points | 641 @param paint The paint used to draw the points |
| 648 */ | 642 */ |
| 649 SK_LEGACY_CANVAS_VIRTUAL void drawPoints(PointMode mode, size_t count, const
SkPoint pts[], | 643 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], |
| 650 const SkPaint& paint); | 644 const SkPaint& paint); |
| 651 | 645 |
| 652 /** Helper method for drawing a single point. See drawPoints() for a more | 646 /** Helper method for drawing a single point. See drawPoints() for a more |
| 653 details. | 647 details. |
| 654 */ | 648 */ |
| 655 void drawPoint(SkScalar x, SkScalar y, const SkPaint& paint); | 649 void drawPoint(SkScalar x, SkScalar y, const SkPaint& paint); |
| 656 | 650 |
| 657 /** Draws a single pixel in the specified color. | 651 /** Draws a single pixel in the specified color. |
| 658 @param x The X coordinate of which pixel to draw | 652 @param x The X coordinate of which pixel to draw |
| 659 @param y The Y coordiante of which pixel to draw | 653 @param y The Y coordiante of which pixel to draw |
| 660 @param color The color to draw | 654 @param color The color to draw |
| (...skipping 10 matching lines...) Expand all Loading... |
| 671 @param paint The paint used to draw the line | 665 @param paint The paint used to draw the line |
| 672 */ | 666 */ |
| 673 void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, | 667 void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, |
| 674 const SkPaint& paint); | 668 const SkPaint& paint); |
| 675 | 669 |
| 676 /** Draw the specified rectangle using the specified paint. The rectangle | 670 /** Draw the specified rectangle using the specified paint. The rectangle |
| 677 will be filled or stroked based on the Style in the paint. | 671 will be filled or stroked based on the Style in the paint. |
| 678 @param rect The rect to be drawn | 672 @param rect The rect to be drawn |
| 679 @param paint The paint used to draw the rect | 673 @param paint The paint used to draw the rect |
| 680 */ | 674 */ |
| 681 SK_LEGACY_CANVAS_VIRTUAL void drawRect(const SkRect& rect, const SkPaint& pa
int); | 675 virtual void drawRect(const SkRect& rect, const SkPaint& paint); |
| 682 | 676 |
| 683 /** Draw the specified rectangle using the specified paint. The rectangle | 677 /** Draw the specified rectangle using the specified paint. The rectangle |
| 684 will be filled or framed based on the Style in the paint. | 678 will be filled or framed based on the Style in the paint. |
| 685 @param rect The rect to be drawn | 679 @param rect The rect to be drawn |
| 686 @param paint The paint used to draw the rect | 680 @param paint The paint used to draw the rect |
| 687 */ | 681 */ |
| 688 void drawIRect(const SkIRect& rect, const SkPaint& paint) { | 682 void drawIRect(const SkIRect& rect, const SkPaint& paint) { |
| 689 SkRect r; | 683 SkRect r; |
| 690 r.set(rect); // promotes the ints to scalars | 684 r.set(rect); // promotes the ints to scalars |
| 691 this->drawRect(r, paint); | 685 this->drawRect(r, paint); |
| 692 } | 686 } |
| 693 | 687 |
| 694 /** Draw the specified rectangle using the specified paint. The rectangle | 688 /** Draw the specified rectangle using the specified paint. The rectangle |
| 695 will be filled or framed based on the Style in the paint. | 689 will be filled or framed based on the Style in the paint. |
| 696 @param left The left side of the rectangle to be drawn | 690 @param left The left side of the rectangle to be drawn |
| 697 @param top The top side of the rectangle to be drawn | 691 @param top The top side of the rectangle to be drawn |
| 698 @param right The right side of the rectangle to be drawn | 692 @param right The right side of the rectangle to be drawn |
| 699 @param bottom The bottom side of the rectangle to be drawn | 693 @param bottom The bottom side of the rectangle to be drawn |
| 700 @param paint The paint used to draw the rect | 694 @param paint The paint used to draw the rect |
| 701 */ | 695 */ |
| 702 void drawRectCoords(SkScalar left, SkScalar top, SkScalar right, | 696 void drawRectCoords(SkScalar left, SkScalar top, SkScalar right, |
| 703 SkScalar bottom, const SkPaint& paint); | 697 SkScalar bottom, const SkPaint& paint); |
| 704 | 698 |
| 705 /** Draw the specified oval using the specified paint. The oval will be | 699 /** Draw the specified oval using the specified paint. The oval will be |
| 706 filled or framed based on the Style in the paint. | 700 filled or framed based on the Style in the paint. |
| 707 @param oval The rectangle bounds of the oval to be drawn | 701 @param oval The rectangle bounds of the oval to be drawn |
| 708 @param paint The paint used to draw the oval | 702 @param paint The paint used to draw the oval |
| 709 */ | 703 */ |
| 710 SK_LEGACY_CANVAS_VIRTUAL void drawOval(const SkRect& oval, const SkPaint&); | 704 virtual void drawOval(const SkRect& oval, const SkPaint&); |
| 711 | 705 |
| 712 /** | 706 /** |
| 713 * Draw the specified RRect using the specified paint The rrect will be fil
led or stroked | 707 * Draw the specified RRect using the specified paint The rrect will be fil
led or stroked |
| 714 * based on the Style in the paint. | 708 * based on the Style in the paint. |
| 715 * | 709 * |
| 716 * @param rrect The round-rect to draw | 710 * @param rrect The round-rect to draw |
| 717 * @param paint The paint used to draw the round-rect | 711 * @param paint The paint used to draw the round-rect |
| 718 */ | 712 */ |
| 719 SK_LEGACY_CANVAS_VIRTUAL void drawRRect(const SkRRect& rrect, const SkPaint&
paint); | 713 virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint); |
| 720 | 714 |
| 721 /** | 715 /** |
| 722 * Draw the annulus formed by the outer and inner rrects. The results | 716 * Draw the annulus formed by the outer and inner rrects. The results |
| 723 * are undefined if the outer does not contain the inner. | 717 * are undefined if the outer does not contain the inner. |
| 724 */ | 718 */ |
| 725 void drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint&); | 719 void drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint&); |
| 726 | 720 |
| 727 /** Draw the specified circle using the specified paint. If radius is <= 0, | 721 /** Draw the specified circle using the specified paint. If radius is <= 0, |
| 728 then nothing will be drawn. The circle will be filled | 722 then nothing will be drawn. The circle will be filled |
| 729 or framed based on the Style in the paint. | 723 or framed based on the Style in the paint. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 757 @param paint The paint used to draw the roundRect | 751 @param paint The paint used to draw the roundRect |
| 758 */ | 752 */ |
| 759 void drawRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, | 753 void drawRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, |
| 760 const SkPaint& paint); | 754 const SkPaint& paint); |
| 761 | 755 |
| 762 /** Draw the specified path using the specified paint. The path will be | 756 /** Draw the specified path using the specified paint. The path will be |
| 763 filled or framed based on the Style in the paint. | 757 filled or framed based on the Style in the paint. |
| 764 @param path The path to be drawn | 758 @param path The path to be drawn |
| 765 @param paint The paint used to draw the path | 759 @param paint The paint used to draw the path |
| 766 */ | 760 */ |
| 767 SK_LEGACY_CANVAS_VIRTUAL void drawPath(const SkPath& path, const SkPaint& pa
int); | 761 virtual void drawPath(const SkPath& path, const SkPaint& paint); |
| 768 | 762 |
| 769 /** Draw the specified image, with its top/left corner at (x,y), using the | 763 /** Draw the specified image, with its top/left corner at (x,y), using the |
| 770 specified paint, transformed by the current matrix. | 764 specified paint, transformed by the current matrix. |
| 771 | 765 |
| 772 @param image The image to be drawn | 766 @param image The image to be drawn |
| 773 @param left The position of the left side of the image being drawn | 767 @param left The position of the left side of the image being drawn |
| 774 @param top The position of the top side of the image being drawn | 768 @param top The position of the top side of the image being drawn |
| 775 @param paint The paint used to draw the image, or NULL | 769 @param paint The paint used to draw the image, or NULL |
| 776 */ | 770 */ |
| 777 SK_LEGACY_CANVAS_VIRTUAL void drawImage(const SkImage* image, SkScalar left,
SkScalar top, | 771 virtual void drawImage(const SkImage* image, SkScalar left, SkScalar top, |
| 778 const SkPaint* paint = NULL); | 772 const SkPaint* paint = NULL); |
| 779 /** Draw the specified image, with the specified matrix applied (before the | 773 /** Draw the specified image, with the specified matrix applied (before the |
| 780 canvas' matrix is applied). | 774 canvas' matrix is applied). |
| 781 | 775 |
| 782 @param image The image to be drawn | 776 @param image The image to be drawn |
| 783 @param src Optional: specify the subset of the image to be drawn | 777 @param src Optional: specify the subset of the image to be drawn |
| 784 @param dst The destination rectangle where the scaled/translated | 778 @param dst The destination rectangle where the scaled/translated |
| 785 image will be drawn | 779 image will be drawn |
| 786 @param paint The paint used to draw the image, or NULL | 780 @param paint The paint used to draw the image, or NULL |
| 787 */ | 781 */ |
| 788 SK_LEGACY_CANVAS_VIRTUAL void drawImageRect(const SkImage* image, const SkRe
ct* src, | 782 virtual void drawImageRect(const SkImage* image, const SkRect* src, |
| 789 const SkRect& dst, | 783 const SkRect& dst, |
| 790 const SkPaint* paint = NULL); | 784 const SkPaint* paint = NULL); |
| 791 | 785 |
| 792 /** Draw the specified bitmap, with its top/left corner at (x,y), using the | 786 /** Draw the specified bitmap, with its top/left corner at (x,y), using the |
| 793 specified paint, transformed by the current matrix. Note: if the paint | 787 specified paint, transformed by the current matrix. Note: if the paint |
| 794 contains a maskfilter that generates a mask which extends beyond the | 788 contains a maskfilter that generates a mask which extends beyond the |
| 795 bitmap's original width/height, then the bitmap will be drawn as if it | 789 bitmap's original width/height, then the bitmap will be drawn as if it |
| 796 were in a Shader with CLAMP mode. Thus the color outside of the original | 790 were in a Shader with CLAMP mode. Thus the color outside of the original |
| 797 width/height will be the edge color replicated. | 791 width/height will be the edge color replicated. |
| 798 | 792 |
| 799 If a shader is present on the paint it will be ignored, except in the | 793 If a shader is present on the paint it will be ignored, except in the |
| 800 case where the bitmap is kAlpha_8_SkColorType. In that case, the color i
s | 794 case where the bitmap is kAlpha_8_SkColorType. In that case, the color i
s |
| 801 generated by the shader. | 795 generated by the shader. |
| 802 | 796 |
| 803 @param bitmap The bitmap to be drawn | 797 @param bitmap The bitmap to be drawn |
| 804 @param left The position of the left side of the bitmap being drawn | 798 @param left The position of the left side of the bitmap being drawn |
| 805 @param top The position of the top side of the bitmap being drawn | 799 @param top The position of the top side of the bitmap being drawn |
| 806 @param paint The paint used to draw the bitmap, or NULL | 800 @param paint The paint used to draw the bitmap, or NULL |
| 807 */ | 801 */ |
| 808 SK_LEGACY_CANVAS_VIRTUAL void drawBitmap(const SkBitmap& bitmap, SkScalar le
ft, SkScalar top, | 802 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, |
| 809 const SkPaint* paint = NULL); | 803 const SkPaint* paint = NULL); |
| 810 | 804 |
| 811 enum DrawBitmapRectFlags { | 805 enum DrawBitmapRectFlags { |
| 812 kNone_DrawBitmapRectFlag = 0x0, | 806 kNone_DrawBitmapRectFlag = 0x0, |
| 813 /** | 807 /** |
| 814 * When filtering is enabled, allow the color samples outside of | 808 * When filtering is enabled, allow the color samples outside of |
| 815 * the src rect (but still in the src bitmap) to bleed into the | 809 * the src rect (but still in the src bitmap) to bleed into the |
| 816 * drawn portion | 810 * drawn portion |
| 817 */ | 811 */ |
| 818 kBleed_DrawBitmapRectFlag = 0x1, | 812 kBleed_DrawBitmapRectFlag = 0x1, |
| 819 }; | 813 }; |
| 820 | 814 |
| 821 /** Draw the specified bitmap, with the specified matrix applied (before the | 815 /** Draw the specified bitmap, with the specified matrix applied (before the |
| 822 canvas' matrix is applied). | 816 canvas' matrix is applied). |
| 823 @param bitmap The bitmap to be drawn | 817 @param bitmap The bitmap to be drawn |
| 824 @param src Optional: specify the subset of the bitmap to be drawn | 818 @param src Optional: specify the subset of the bitmap to be drawn |
| 825 @param dst The destination rectangle where the scaled/translated | 819 @param dst The destination rectangle where the scaled/translated |
| 826 image will be drawn | 820 image will be drawn |
| 827 @param paint The paint used to draw the bitmap, or NULL | 821 @param paint The paint used to draw the bitmap, or NULL |
| 828 */ | 822 */ |
| 829 SK_LEGACY_CANVAS_VIRTUAL void drawBitmapRectToRect(const SkBitmap& bitmap, c
onst SkRect* src, | 823 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, |
| 830 const SkRect& dst, | 824 const SkRect& dst, |
| 831 const SkPaint* paint = NULL, | 825 const SkPaint* paint = NULL, |
| 832 DrawBitmapRectFlags flags = kNone_DrawBitm
apRectFlag); | 826 DrawBitmapRectFlags flags = kNone_DrawBitm
apRectFlag); |
| 833 | 827 |
| 834 void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, | 828 void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, |
| 835 const SkPaint* paint = NULL) { | 829 const SkPaint* paint = NULL) { |
| 836 this->drawBitmapRectToRect(bitmap, NULL, dst, paint, kNone_DrawBitmapRec
tFlag); | 830 this->drawBitmapRectToRect(bitmap, NULL, dst, paint, kNone_DrawBitmapRec
tFlag); |
| 837 } | 831 } |
| 838 | 832 |
| 839 void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* isrc, | 833 void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* isrc, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 855 * bitmap is the "center", then the center-rect should be [2, 2, 3, 3]. | 849 * bitmap is the "center", then the center-rect should be [2, 2, 3, 3]. |
| 856 * | 850 * |
| 857 * If the dst is >= the bitmap size, then... | 851 * If the dst is >= the bitmap size, then... |
| 858 * - The 4 corners are not stretched at all. | 852 * - The 4 corners are not stretched at all. |
| 859 * - The sides are stretched in only one axis. | 853 * - The sides are stretched in only one axis. |
| 860 * - The center is stretched in both axes. | 854 * - The center is stretched in both axes. |
| 861 * Else, for each axis where dst < bitmap, | 855 * Else, for each axis where dst < bitmap, |
| 862 * - The corners shrink proportionally | 856 * - The corners shrink proportionally |
| 863 * - The sides (along the shrink axis) and center are not drawn | 857 * - The sides (along the shrink axis) and center are not drawn |
| 864 */ | 858 */ |
| 865 SK_LEGACY_CANVAS_VIRTUAL void drawBitmapNine(const SkBitmap& bitmap, const S
kIRect& center, | 859 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
| 866 const SkRect& dst, const SkPaint* paint = NULL); | 860 const SkRect& dst, const SkPaint* paint = NULL); |
| 867 | 861 |
| 868 /** Draw the specified bitmap, with its top/left corner at (x,y), | 862 /** Draw the specified bitmap, with its top/left corner at (x,y), |
| 869 NOT transformed by the current matrix. Note: if the paint | 863 NOT transformed by the current matrix. Note: if the paint |
| 870 contains a maskfilter that generates a mask which extends beyond the | 864 contains a maskfilter that generates a mask which extends beyond the |
| 871 bitmap's original width/height, then the bitmap will be drawn as if it | 865 bitmap's original width/height, then the bitmap will be drawn as if it |
| 872 were in a Shader with CLAMP mode. Thus the color outside of the original | 866 were in a Shader with CLAMP mode. Thus the color outside of the original |
| 873 width/height will be the edge color replicated. | 867 width/height will be the edge color replicated. |
| 874 @param bitmap The bitmap to be drawn | 868 @param bitmap The bitmap to be drawn |
| 875 @param left The position of the left side of the bitmap being drawn | 869 @param left The position of the left side of the bitmap being drawn |
| 876 @param top The position of the top side of the bitmap being drawn | 870 @param top The position of the top side of the bitmap being drawn |
| 877 @param paint The paint used to draw the bitmap, or NULL | 871 @param paint The paint used to draw the bitmap, or NULL |
| 878 */ | 872 */ |
| 879 SK_LEGACY_CANVAS_VIRTUAL void drawSprite(const SkBitmap& bitmap, int left, i
nt top, | 873 virtual void drawSprite(const SkBitmap& bitmap, int left, int top, |
| 880 const SkPaint* paint = NULL); | 874 const SkPaint* paint = NULL); |
| 881 | 875 |
| 882 /** Draw the text, with origin at (x,y), using the specified paint. | 876 /** Draw the text, with origin at (x,y), using the specified paint. |
| 883 The origin is interpreted based on the Align setting in the paint. | 877 The origin is interpreted based on the Align setting in the paint. |
| 884 @param text The text to be drawn | 878 @param text The text to be drawn |
| 885 @param byteLength The number of bytes to read from the text parameter | 879 @param byteLength The number of bytes to read from the text parameter |
| 886 @param x The x-coordinate of the origin of the text being drawn | 880 @param x The x-coordinate of the origin of the text being drawn |
| 887 @param y The y-coordinate of the origin of the text being drawn | 881 @param y The y-coordinate of the origin of the text being drawn |
| 888 @param paint The paint used for the text (e.g. color, size, style) | 882 @param paint The paint used for the text (e.g. color, size, style) |
| 889 */ | 883 */ |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 vertex, to be interpolated across the triangle. | 986 vertex, to be interpolated across the triangle. |
| 993 @param xmode Used if both texs and colors are present. In this | 987 @param xmode Used if both texs and colors are present. In this |
| 994 case the colors are combined with the texture using mode, | 988 case the colors are combined with the texture using mode, |
| 995 before being drawn using the paint. If mode is null, then | 989 before being drawn using the paint. If mode is null, then |
| 996 kModulate_Mode is used. | 990 kModulate_Mode is used. |
| 997 @param indices If not null, array of indices to reference into the | 991 @param indices If not null, array of indices to reference into the |
| 998 vertex (texs, colors) array. | 992 vertex (texs, colors) array. |
| 999 @param indexCount number of entries in the indices array (if not null) | 993 @param indexCount number of entries in the indices array (if not null) |
| 1000 @param paint Specifies the shader/texture if present. | 994 @param paint Specifies the shader/texture if present. |
| 1001 */ | 995 */ |
| 1002 SK_LEGACY_CANVAS_VIRTUAL void drawVertices(VertexMode vmode, int vertexCount
, | 996 virtual void drawVertices(VertexMode vmode, int vertexCount, |
| 1003 const SkPoint vertices[], const SkPoint texs[], | 997 const SkPoint vertices[], const SkPoint texs[], |
| 1004 const SkColor colors[], SkXfermode* xmode, | 998 const SkColor colors[], SkXfermode* xmode, |
| 1005 const uint16_t indices[], int indexCount, | 999 const uint16_t indices[], int indexCount, |
| 1006 const SkPaint& paint); | 1000 const SkPaint& paint); |
| 1007 | 1001 |
| 1008 /** | 1002 /** |
| 1009 Draw a cubic coons patch | 1003 Draw a cubic coons patch |
| 1010 | 1004 |
| 1011 @param cubic specifies the 4 bounding cubic bezier curves of a patch with c
lockwise order | 1005 @param cubic specifies the 4 bounding cubic bezier curves of a patch with c
lockwise order |
| 1012 starting at the top left corner. | 1006 starting at the top left corner. |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 const SkPaint& paint); | 1190 const SkPaint& paint); |
| 1197 | 1191 |
| 1198 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 1192 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
| 1199 const SkPaint& paint); | 1193 const SkPaint& paint); |
| 1200 | 1194 |
| 1201 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], | 1195 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], |
| 1202 const SkPoint texCoords[4], SkXfermode* xmode, const
SkPaint& paint); | 1196 const SkPoint texCoords[4], SkXfermode* xmode, const
SkPaint& paint); |
| 1203 | 1197 |
| 1204 virtual void onDrawDrawable(SkCanvasDrawable*); | 1198 virtual void onDrawDrawable(SkCanvasDrawable*); |
| 1205 | 1199 |
| 1206 virtual void onDrawPaint(const SkPaint&); | |
| 1207 virtual void onDrawRect(const SkRect&, const SkPaint&); | |
| 1208 virtual void onDrawOval(const SkRect&, const SkPaint&); | |
| 1209 virtual void onDrawRRect(const SkRRect&, const SkPaint&); | |
| 1210 virtual void onDrawPoints(PointMode, size_t count, const SkPoint pts[], cons
t SkPaint&); | |
| 1211 virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint verti
ces[], | |
| 1212 const SkPoint texs[], const SkColor colors[], Sk
Xfermode*, | |
| 1213 const uint16_t indices[], int indexCount, const
SkPaint&); | |
| 1214 virtual void onDrawPath(const SkPath&, const SkPaint&); | |
| 1215 virtual void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkP
aint*); | |
| 1216 virtual void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, c
onst SkPaint*); | |
| 1217 virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const S
kPaint*); | |
| 1218 virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&,
const SkPaint*, | |
| 1219 DrawBitmapRectFlags); | |
| 1220 virtual void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const
SkRect& dst, | |
| 1221 const SkPaint*); | |
| 1222 virtual void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*
); | |
| 1223 | |
| 1224 enum ClipEdgeStyle { | 1200 enum ClipEdgeStyle { |
| 1225 kHard_ClipEdgeStyle, | 1201 kHard_ClipEdgeStyle, |
| 1226 kSoft_ClipEdgeStyle | 1202 kSoft_ClipEdgeStyle |
| 1227 }; | 1203 }; |
| 1228 | 1204 |
| 1229 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e
dgeStyle); | 1205 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e
dgeStyle); |
| 1230 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e edgeStyle); | 1206 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e edgeStyle); |
| 1231 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e
dgeStyle); | 1207 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e
dgeStyle); |
| 1232 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op); | 1208 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op); |
| 1233 | 1209 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 | 1482 |
| 1507 class SkCanvasClipVisitor { | 1483 class SkCanvasClipVisitor { |
| 1508 public: | 1484 public: |
| 1509 virtual ~SkCanvasClipVisitor(); | 1485 virtual ~SkCanvasClipVisitor(); |
| 1510 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1486 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
| 1511 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1487 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
| 1512 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1488 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
| 1513 }; | 1489 }; |
| 1514 | 1490 |
| 1515 #endif | 1491 #endif |
| OLD | NEW |