fix const order in docs
SkColor_Reference.md and SkMatrix_Reference.md generated
different contents depending on which platform bookmaker
was built. Fixed so that generated const tables keep
the same order as was defined in the includes.
TBR=reed@google.com,herb@google.com
Docs-Preview: https://skia.org/?cl=165940
Bug: skia:
Change-Id: I69543ff365c2b1d71c4bc6052ffb3acdac990ef4
Reviewed-on: https://skia-review.googlesource.com/c/165940
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
diff --git a/site/user/api/SkColor_Reference.md b/site/user/api/SkColor_Reference.md
index 8a79b54..aa86dbe 100644
--- a/site/user/api/SkColor_Reference.md
+++ b/site/user/api/SkColor_Reference.md
@@ -321,8 +321,8 @@
---
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
-constexpr <a href='#SkAlpha'>SkAlpha</a> <a href='#SK_AlphaOPAQUE'>SK_AlphaOPAQUE</a> = 0xFF;
constexpr <a href='#SkAlpha'>SkAlpha</a> <a href='#SK_AlphaTRANSPARENT'>SK_AlphaTRANSPARENT</a> = 0x00;
+constexpr <a href='#SkAlpha'>SkAlpha</a> <a href='#SK_AlphaOPAQUE'>SK_AlphaOPAQUE</a> = 0xFF;
</pre>
<a href='#Alpha'>Alpha</a> constants are conveniences to represent fully transparent and fully
@@ -371,18 +371,18 @@
---
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
-constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorGREEN'>SK_ColorGREEN</a>;
-constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorLTGRAY'>SK_ColorLTGRAY</a>;
-constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorRED'>SK_ColorRED</a>;
-constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorGRAY'>SK_ColorGRAY</a>;
-constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorYELLOW'>SK_ColorYELLOW</a>;
+constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorTRANSPARENT'>SK_ColorTRANSPARENT</a>;
constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorBLACK'>SK_ColorBLACK</a>;
constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorDKGRAY'>SK_ColorDKGRAY</a>;
-constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorTRANSPARENT'>SK_ColorTRANSPARENT</a>;
-constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorCYAN'>SK_ColorCYAN</a>;
+constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorGRAY'>SK_ColorGRAY</a>;
+constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorLTGRAY'>SK_ColorLTGRAY</a>;
constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorWHITE'>SK_ColorWHITE</a>;
-constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorMAGENTA'>SK_ColorMAGENTA</a>;
+constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorRED'>SK_ColorRED</a>;
+constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorGREEN'>SK_ColorGREEN</a>;
constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorBLUE'>SK_ColorBLUE</a>;
+constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorYELLOW'>SK_ColorYELLOW</a>;
+constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorCYAN'>SK_ColorCYAN</a>;
+constexpr <a href='#SkColor'>SkColor</a> <a href='#SK_ColorMAGENTA'>SK_ColorMAGENTA</a>;
</pre>
<a href='#Color'>Color</a> names are provided as conveniences, but are not otherwise special.
diff --git a/site/user/api/SkMatrix_Reference.md b/site/user/api/SkMatrix_Reference.md
index bb0feaf..af70d24 100644
--- a/site/user/api/SkMatrix_Reference.md
+++ b/site/user/api/SkMatrix_Reference.md
@@ -790,15 +790,15 @@
---
<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
- static constexpr int <a href='#SkMatrix_kMPersp2'>kMPersp2</a> = 8;
- static constexpr int <a href='#SkMatrix_kMPersp0'>kMPersp0</a> = 6;
- static constexpr int <a href='#SkMatrix_kMPersp1'>kMPersp1</a> = 7;
+ static constexpr int <a href='#SkMatrix_kMScaleX'>kMScaleX</a> = 0;
static constexpr int <a href='#SkMatrix_kMSkewX'>kMSkewX</a> = 1;
static constexpr int <a href='#SkMatrix_kMTransX'>kMTransX</a> = 2;
- static constexpr int <a href='#SkMatrix_kMScaleX'>kMScaleX</a> = 0;
static constexpr int <a href='#SkMatrix_kMSkewY'>kMSkewY</a> = 3;
static constexpr int <a href='#SkMatrix_kMScaleY'>kMScaleY</a> = 4;
static constexpr int <a href='#SkMatrix_kMTransY'>kMTransY</a> = 5;
+ static constexpr int <a href='#SkMatrix_kMPersp0'>kMPersp0</a> = 6;
+ static constexpr int <a href='#SkMatrix_kMPersp1'>kMPersp1</a> = 7;
+ static constexpr int <a href='#SkMatrix_kMPersp2'>kMPersp2</a> = 8;
</pre>
<a href='#Matrix'>Matrix</a> organizes its values in row order. These members correspond to
diff --git a/tools/bookmaker/includeParser.cpp b/tools/bookmaker/includeParser.cpp
index 0716bc7..0b4576c 100644
--- a/tools/bookmaker/includeParser.cpp
+++ b/tools/bookmaker/includeParser.cpp
@@ -1765,11 +1765,18 @@
} else {
SkASSERT(0); // only Constant supported for now
}
+ vector<Definition*> consts;
for (auto entry : *mapPtr) {
if (string::npos == entry.first.find(filterContents)) {
continue;
}
- result += this->writeCodeBlock(*entry.second, markType);
+ consts.push_back(entry.second);
+ }
+ std::sort(consts.begin(), consts.end(), [](Definition* def1, Definition* def2) {
+ return def1->fLineCount < def2->fLineCount;
+ } );
+ for (auto oneConst : consts) {
+ result += this->writeCodeBlock(*oneConst, markType);
}
return result;
}