Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: include/core/SkCanvas.h

Issue 2305433002: Add option to skip rects to drawImageLattice() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: numRectsToDraw() Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/lattice.cpp ('k') | include/private/SkRecords.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 kSkip_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;
941 946
942 // The number of fXDivs. 947 // The number of fXDivs.
943 int fXCount; 948 int fXCount;
944 949
945 // An array of y-coordinates that divide the bitmap horizontally. 950 // An array of y-coordinates that divide the bitmap horizontally.
946 // These must be unique, increasing, and in the set [0, height]. 951 // These must be unique, increasing, and in the set [0, height].
947 // Does not have ownership. 952 // Does not have ownership.
948 const int* fYDivs; 953 const int* fYDivs;
949 954
950 // The number of fYDivs. 955 // The number of fYDivs.
951 int fYCount; 956 int fYCount;
957
958 // If non-null, the length of this array must be equal to the total
959 // number of rects specified in the lattice. The flags correspond
960 // to the rects in the lattice, first moving left to right and then
961 // top to bottom.
962 const Flags* fFlags;
963
964 // The number of fFlags. Must be equal to the total number of rects
965 // specified in the lattice, or flags will be ignored. If fFlags is
966 // null, this should be set to zero.
967 int fFlagCount;
reed1 2016/09/01 14:15:23 Lets try not having this, and just documenting tha
msarett 2016/09/01 16:27:24 SGTM
952 }; 968 };
953 969
954 /** 970 /**
955 * Draw the bitmap stretched or shrunk differentially to fit into dst. 971 * Draw the bitmap stretched or shrunk differentially to fit into dst.
956 * 972 *
957 * Moving horizontally across the bitmap, alternating rects will be "scalab le" 973 * 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 974 * (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 975 * is treated as "fixed", but it's possible to specify an empty first rect by
960 * making lattice.fXDivs[0] = 0. 976 * making lattice.fXDivs[0] = 0.
961 * 977 *
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 1733
1718 class SkCanvasClipVisitor { 1734 class SkCanvasClipVisitor {
1719 public: 1735 public:
1720 virtual ~SkCanvasClipVisitor(); 1736 virtual ~SkCanvasClipVisitor();
1721 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1737 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1722 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1738 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1723 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1739 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1724 }; 1740 };
1725 1741
1726 #endif 1742 #endif
OLDNEW
« no previous file with comments | « gm/lattice.cpp ('k') | include/private/SkRecords.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698