converted overdraw effect to new FP system
Bug: skia:
Change-Id: I4cff0ecdf3fc61f584012af519730f08bfd78264
Reviewed-on: https://skia-review.googlesource.com/150484
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLParser.cpp b/src/sksl/SkSLParser.cpp
index 6bd0b81..412a09e 100644
--- a/src/sksl/SkSLParser.cpp
+++ b/src/sksl/SkSLParser.cpp
@@ -119,8 +119,12 @@
TOKEN(INVOCATIONS, "invocations");
TOKEN(WHEN, "when");
TOKEN(KEY, "key");
- TOKEN(CTYPE, "ctype");
TOKEN(TRACKED, "tracked");
+ TOKEN(CTYPE, "ctype");
+ TOKEN(GRCOLOR4F, "GrColor4f");
+ TOKEN(SKRECT, "SkRect");
+ TOKEN(SKIRECT, "SkIRect");
+ TOKEN(SKPMCOLOR, "SkPMColor");
#undef TOKEN
}
@@ -717,6 +721,30 @@
return Layout::kKey_Key;
}
+Layout::CType Parser::layoutCType() {
+ if (this->expect(Token::EQ, "'='")) {
+ Token t = this->nextToken();
+ String text = this->text(t);
+ auto found = layoutTokens->find(text);
+ if (found != layoutTokens->end()) {
+ switch (found->second) {
+ case LayoutToken::GRCOLOR4F:
+ return Layout::CType::kGrColor4f;
+ case LayoutToken::SKRECT:
+ return Layout::CType::kSkRect;
+ case LayoutToken::SKIRECT:
+ return Layout::CType::kSkIRect;
+ case LayoutToken::SKPMCOLOR:
+ return Layout::CType::kSkPMColor;
+ default:
+ break;
+ }
+ }
+ this->error(t, "unsupported ctype");
+ }
+ return Layout::CType::kDefault;
+}
+
/* LAYOUT LPAREN IDENTIFIER (EQ INT_LITERAL)? (COMMA IDENTIFIER (EQ INT_LITERAL)?)* RPAREN */
Layout Parser::layout() {
int flags = 0;
@@ -732,8 +760,8 @@
int maxVertices = -1;
int invocations = -1;
String when;
- StringFragment ctype;
Layout::Key key = Layout::kNo_Key;
+ Layout::CType ctype = Layout::CType::kDefault;
if (this->checkNext(Token::LAYOUT)) {
if (!this->expect(Token::LPAREN, "'('")) {
return Layout(flags, location, offset, binding, index, set, builtin,
@@ -861,7 +889,10 @@
key = this->layoutKey();
break;
case LayoutToken::CTYPE:
- ctype = this->layoutIdentifier();
+ ctype = this->layoutCType();
+ break;
+ default:
+ this->error(t, ("'" + text + "' is not a valid layout qualifier").c_str());
break;
}
} else if (Layout::ReadFormat(text, &format)) {