Move alpha-ramp AA to GrContext, detect cases when AA is applied via other methods (smooth lines, MSAA) or rect falls on integer coords and skip the alpha ramp path. Use pre-fab index buffer for alpha-ramped fill rects and stroke rects.
Review URL: http://codereview.appspot.com/4449047/
git-svn-id: http://skia.googlecode.com/svn/trunk@1169 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrMatrix.cpp b/gpu/src/GrMatrix.cpp
index 0a2d1b2..92a38ee 100644
--- a/gpu/src/GrMatrix.cpp
+++ b/gpu/src/GrMatrix.cpp
@@ -259,6 +259,26 @@
}
+bool GrMatrix::preservesAxisAlignment() const {
+
+ // check if matrix is trans and scale only
+ static const int gAllowedMask1 = kScale_TypeBit | kTranslate_TypeBit;
+
+ if (!(~gAllowedMask1 & fTypeMask)) {
+ return true;
+ }
+
+ // check matrix is trans and skew only (0 scale)
+ static const int gAllowedMask2 = kScale_TypeBit | kSkew_TypeBit |
+ kTranslate_TypeBit | kZeroScale_TypeBit;
+
+ if (!(~gAllowedMask2 & fTypeMask) && (kZeroScale_TypeBit & fTypeMask)) {
+ return true;
+ }
+
+ return false;
+}
+
GrScalar GrMatrix::getMaxStretch() const {
if (fTypeMask & kPerspective_TypeBit) {