Index: src/gpu/GrOvalRenderer.cpp |
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp |
index f5dcfcb0f5ad51c10b81ddfa5e52254b8e5627d7..464a315a626308dfae15b18216cc5a47613a5b25 100644 |
--- a/src/gpu/GrOvalRenderer.cpp |
+++ b/src/gpu/GrOvalRenderer.cpp |
@@ -572,7 +572,10 @@ public: |
SkRect::MakeLTRB(center.fX - outerRadius, center.fY - outerRadius, |
center.fX + outerRadius, center.fY + outerRadius) |
}); |
robertphillips
2016/07/07 20:26:42
Isn't this wrong for stroked circles ?
bsalomon
2016/07/07 23:40:57
Ah, yes. Fixed.
|
- this->setBounds(fGeoData.back().fDevBounds); |
+ // Use the original radius for the bounds so that it does not include the AA bloat |
+ this->setBounds({center.fX - radius, center.fY - radius, |
+ center.fX + radius, center.fY + radius}, |
+ HasAABloat::kYes, IsZeroArea::kNo); |
fStroked = isStrokeOnly && innerRadius > 0; |
} |
@@ -685,7 +688,7 @@ private: |
} |
fGeoData.push_back_n(that->fGeoData.count(), that->fGeoData.begin()); |
- this->joinBounds(that->bounds()); |
+ this->joinBounds(*that); |
return true; |
} |
@@ -777,12 +780,13 @@ public: |
center.fX + xRadius, center.fY + yRadius) |
}); |
+ batch->setBounds(batch->fGeoData.back().fDevBounds, HasAABloat::kYes, IsZeroArea::kNo); |
+ |
// Outset bounds to include half-pixel width antialiasing. |
batch->fGeoData[0].fDevBounds.outset(SK_ScalarHalf, SK_ScalarHalf); |
batch->fStroked = isStrokeOnly && innerXRadius > 0 && innerYRadius > 0; |
batch->fViewMatrixIfUsingLocalCoords = viewMatrix; |
- batch->setBounds(batch->fGeoData.back().fDevBounds); |
return batch; |
} |
@@ -894,7 +898,7 @@ private: |
} |
fGeoData.push_back_n(that->fGeoData.count(), that->fGeoData.begin()); |
- this->joinBounds(that->bounds()); |
+ this->joinBounds(*that); |
return true; |
} |
@@ -993,9 +997,8 @@ public: |
SkRect::MakeLTRB(center.fX - xRadius - geoDx, center.fY - yRadius - geoDy, |
center.fX + xRadius + geoDx, center.fY + yRadius + geoDy) |
}); |
- SkRect devBounds = batch->fGeoData.back().fBounds; |
- viewMatrix.mapRect(&devBounds); |
- batch->setBounds(devBounds); |
+ batch->setTransformedBounds(batch->fGeoData[0].fBounds, viewMatrix, HasAABloat::kYes, |
+ IsZeroArea::kNo); |
return batch; |
} |
@@ -1092,7 +1095,7 @@ private: |
} |
fGeoData.push_back_n(that->fGeoData.count(), that->fGeoData.begin()); |
- this->joinBounds(that->bounds()); |
+ this->joinBounds(*that); |
return true; |
} |
@@ -1202,11 +1205,12 @@ public: |
outerRadius += SK_ScalarHalf; |
innerRadius -= SK_ScalarHalf; |
- // Expand the rect so all the pixels will be captured. |
+ this->setBounds(bounds, HasAABloat::kYes, IsZeroArea::kNo); |
+ |
+ // Expand the rect for aa to generate correct vertices. |
bounds.outset(SK_ScalarHalf, SK_ScalarHalf); |
fGeoData.emplace_back(Geometry { color, innerRadius, outerRadius, bounds }); |
- this->setBounds(bounds); |
} |
const char* name() const override { return "RRectCircleBatch"; } |
@@ -1324,7 +1328,7 @@ private: |
} |
fGeoData.push_back_n(that->fGeoData.count(), that->fGeoData.begin()); |
- this->joinBounds(that->bounds()); |
+ this->joinBounds(*that); |
return true; |
} |
@@ -1394,15 +1398,14 @@ public: |
bounds.outset(devStrokeWidths.fX, devStrokeWidths.fY); |
} |
- // Expand the rect so all the pixels will be captured. |
- bounds.outset(SK_ScalarHalf, SK_ScalarHalf); |
- |
RRectEllipseRendererBatch* batch = new RRectEllipseRendererBatch(); |
batch->fStroked = stroked; |
batch->fViewMatrixIfUsingLocalCoords = viewMatrix; |
+ batch->setBounds(bounds, HasAABloat::kYes, IsZeroArea::kNo); |
+ // Expand the rect for aa in order to generate the correct vertices. |
+ bounds.outset(SK_ScalarHalf, SK_ScalarHalf); |
batch->fGeoData.emplace_back( |
Geometry {color, devXRadius, devYRadius, innerXRadius, innerYRadius, bounds}); |
- batch->setBounds(bounds); |
return batch; |
} |
@@ -1534,7 +1537,7 @@ private: |
} |
fGeoData.push_back_n(that->fGeoData.count(), that->fGeoData.begin()); |
- this->joinBounds(that->bounds()); |
+ this->joinBounds(*that); |
return true; |
} |