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 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 * - The corners shrink proportionally | 927 * - The corners shrink proportionally |
928 * - The sides (along the shrink axis) and center are not drawn | 928 * - The sides (along the shrink axis) and center are not drawn |
929 */ | 929 */ |
930 void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkR
ect& dst, | 930 void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkR
ect& dst, |
931 const SkPaint* paint = NULL); | 931 const SkPaint* paint = NULL); |
932 | 932 |
933 /** | 933 /** |
934 * Specifies coordinates to divide a bitmap into (xCount*yCount) rects. | 934 * Specifies coordinates to divide a bitmap into (xCount*yCount) rects. |
935 */ | 935 */ |
936 struct Lattice { | 936 struct Lattice { |
| 937 enum Flags : uint8_t { |
| 938 // If set, indicates that we should not draw corresponding rect. |
| 939 kTransparent_Flags = 1 << 0, |
| 940 }; |
| 941 |
937 // An array of x-coordinates that divide the bitmap vertically. | 942 // An array of x-coordinates that divide the bitmap vertically. |
938 // These must be unique, increasing, and in the set [0, width]. | 943 // These must be unique, increasing, and in the set [0, width). |
939 // Does not have ownership. | 944 // Does not have ownership. |
940 const int* fXDivs; | 945 const int* fXDivs; |
| 946 |
| 947 // An array of y-coordinates that divide the bitmap horizontally. |
| 948 // These must be unique, increasing, and in the set [0, height). |
| 949 // Does not have ownership. |
| 950 const int* fYDivs; |
| 951 |
| 952 // If non-null, the length of this array must be equal to |
| 953 // (fXCount + 1) * (fYCount + 1). Note that we allow the first rect |
| 954 // in each direction to empty (divs[0] = 0). In this case, the |
| 955 // caller still must specify a flag (as a placeholder) for these |
| 956 // empty rects. |
| 957 // The flags correspond to the rects in the lattice, first moving |
| 958 // left to right and then top to bottom. |
| 959 const Flags* fFlags; |
941 | 960 |
942 // The number of fXDivs. | 961 // The number of fXDivs. |
943 int fXCount; | 962 int fXCount; |
944 | |
945 // An array of y-coordinates that divide the bitmap horizontally. | |
946 // These must be unique, increasing, and in the set [0, height]. | |
947 // Does not have ownership. | |
948 const int* fYDivs; | |
949 | 963 |
950 // The number of fYDivs. | 964 // The number of fYDivs. |
951 int fYCount; | 965 int fYCount; |
952 }; | 966 }; |
953 | 967 |
954 /** | 968 /** |
955 * Draw the bitmap stretched or shrunk differentially to fit into dst. | 969 * Draw the bitmap stretched or shrunk differentially to fit into dst. |
956 * | 970 * |
957 * Moving horizontally across the bitmap, alternating rects will be "scalab
le" | 971 * Moving horizontally across the bitmap, alternating rects will be "scalab
le" |
958 * (in the x-dimension) to fit into dst or must be left "fixed". The first
rect | 972 * (in the x-dimension) to fit into dst or must be left "fixed". The first
rect |
959 * is treated as "fixed", but it's possible to specify an empty first rect
by | 973 * is treated as "fixed", but it's possible to specify an empty first rect
by |
960 * making lattice.fXDivs[0] = 0. | 974 * making lattice.fXDivs[0] = 0. |
961 * | 975 * |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 | 1731 |
1718 class SkCanvasClipVisitor { | 1732 class SkCanvasClipVisitor { |
1719 public: | 1733 public: |
1720 virtual ~SkCanvasClipVisitor(); | 1734 virtual ~SkCanvasClipVisitor(); |
1721 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1735 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1722 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1736 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1723 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1737 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1724 }; | 1738 }; |
1725 | 1739 |
1726 #endif | 1740 #endif |
OLD | NEW |