aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2018-04-03 15:31:59 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-03 20:02:25 +0000
commita4f581a475b2f4990d0e1d0a1703107cb429bcb2 (patch)
treed1427582f9e17e83c732c46ecad692d6efc80008
parent3a494f6eb487bcbb5f732aeccab9da6d1c9b618e (diff)
fix global method indentation
Check to see if a method is inside a struct or class before increasing its indentation. Also, add missing description. Docs-Preview: https://skia.org/?cl=118381 Bug: skia:6898 Change-Id: I9402442a89dafc96d87bf69f157dcfa40cdf6e2b Reviewed-on: https://skia-review.googlesource.com/118381 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@skia.org>
-rw-r--r--docs/SkImageInfo_Reference.bmh6
-rw-r--r--site/user/api/SkImageInfo_Reference.md6
-rw-r--r--tools/bookmaker/bookmaker.h16
-rw-r--r--tools/bookmaker/includeWriter.cpp19
4 files changed, 40 insertions, 7 deletions
diff --git a/docs/SkImageInfo_Reference.bmh b/docs/SkImageInfo_Reference.bmh
index f8b3f208eb..8023847794 100644
--- a/docs/SkImageInfo_Reference.bmh
+++ b/docs/SkImageInfo_Reference.bmh
@@ -196,6 +196,12 @@ in the same order.
#In Property
#Line # returns if Alpha_Type equals kOpaque_SkAlphaType ##
+Returns true if Alpha_Type equals kOpaque_SkAlphaType. kOpaque_SkAlphaType is a
+hint that the Color_Type is opaque, or that all Color_Alpha values are set to
+their 1.0 equivalent. If Alpha_Type is kOpaque_SkAlphaType, and Color_Type is not
+opaque, then the result of drawing any pixel with a Color_Alpha value less than
+1.0 is undefined.
+
#Param at one of: #list_of_alpha_types#
##
#Return true if at equals kOpaque_SkAlphaType ##
diff --git a/site/user/api/SkImageInfo_Reference.md b/site/user/api/SkImageInfo_Reference.md
index e43d8e9e4b..12742f7bcb 100644
--- a/site/user/api/SkImageInfo_Reference.md
+++ b/site/user/api/SkImageInfo_Reference.md
@@ -144,6 +144,12 @@ in the same order.
static inline bool SkAlphaTypeIsOpaque(SkAlphaType at)
</pre>
+Returns true if <a href="#Alpha_Type">Alpha Type</a> equals <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>. <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a> is a
+hint that the <a href="#Color_Type">Color Type</a> is opaque, or that all <a href="undocumented#Alpha">Color Alpha</a> values are set to
+their 1.0 equivalent. If <a href="#Alpha_Type">Alpha Type</a> is <a href="#kOpaque_SkAlphaType">kOpaque_SkAlphaType</a>, and <a href="#Color_Type">Color Type</a> is not
+opaque, then the result of drawing any pixel with a <a href="undocumented#Alpha">Color Alpha</a> value less than
+1.0 is undefined.
+
### Parameters
<table> <tr> <td><a name="SkAlphaTypeIsOpaque_at"> <code><strong>at </strong></code> </a></td> <td>
diff --git a/tools/bookmaker/bookmaker.h b/tools/bookmaker/bookmaker.h
index a0f6bca6a7..bbec6d6266 100644
--- a/tools/bookmaker/bookmaker.h
+++ b/tools/bookmaker/bookmaker.h
@@ -1931,11 +1931,19 @@ public:
};
struct Preprocessor {
- Preprocessor()
- : fStart(nullptr)
- , fEnd(nullptr)
- , fWord(false) {
+ Preprocessor() {
+ reset();
}
+
+ void reset() {
+ fDefinition = nullptr;
+ fStart = nullptr;
+ fEnd = nullptr;
+ fWord = false;
+ }
+
+ const Definition* fDefinition;
+ const Definition* fBracket;
const char* fStart;
const char* fEnd;
bool fWord;
diff --git a/tools/bookmaker/includeWriter.cpp b/tools/bookmaker/includeWriter.cpp
index 5b2f8076bc..9fd238ac78 100644
--- a/tools/bookmaker/includeWriter.cpp
+++ b/tools/bookmaker/includeWriter.cpp
@@ -439,8 +439,7 @@ void IncludeWriter::enumMembersOut(const RootDefinition* root, Definition& child
(int) (preprocessor.fEnd - preprocessor.fStart), preprocessor.fStart);
this->lfcr();
fIndent = saveIndent;
- preprocessor.fStart = nullptr;
- preprocessor.fEnd = nullptr;
+ preprocessor.reset();
}
if (token && State::kItemValue == state) {
fStart = token->fContentStart;
@@ -547,6 +546,7 @@ bool IncludeWriter::enumPreprocessor(Definition* token, MemberPass pass,
return true; // ignore old inline comments
}
if (Bracket::kPound == token->fBracket) { // preprocessor wraps member
+ preprocessor->fDefinition = token;
preprocessor->fStart = token->fContentStart;
if (KeyWord::kIf == token->fKeyWord || KeyWord::kIfdef == token->fKeyWord) {
iterStack.emplace_back(token->fTokens.begin(), token->fTokens.end());
@@ -567,6 +567,15 @@ bool IncludeWriter::enumPreprocessor(Definition* token, MemberPass pass,
}
return true;
}
+ if (preprocessor->fDefinition) {
+ if (Bracket::kParen == token->fBracket) {
+ preprocessor->fEnd = token->fContentEnd;
+ SkASSERT(')' == *preprocessor->fEnd);
+ ++preprocessor->fEnd;
+ return true;
+ }
+ SkASSERT(0); // incomplete
+ }
return true;
}
if (token && Definition::Type::kWord != token->fType) {
@@ -674,7 +683,11 @@ void IncludeWriter::methodOut(const Definition* method, const Definition& child)
fMethodDef = &child;
fContinuation = nullptr;
fDeferComment = nullptr;
- if (0 == fIndent || fIndentNext) {
+ const Definition* csParent = method->csParent();
+ if (!csParent) {
+ SkDebugf("");
+ }
+ if (csParent && (0 == fIndent || fIndentNext)) {
fIndent += 4;
fIndentNext = false;
}