Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Unified Diff: src/gpu/GrContext.cpp

Issue 13521006: First pass at Rect Effect (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: fixed overlength lines Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrContext.cpp
===================================================================
--- src/gpu/GrContext.cpp (revision 8539)
+++ src/gpu/GrContext.cpp (working copy)
@@ -686,7 +686,8 @@
const SkMatrix* matrix,
SkMatrix* combinedMatrix,
GrRect* devRect,
- bool* useVertexCoverage) {
+ bool* useVertexCoverage,
+ bool stroked) {
bsalomon 2013/04/08 15:48:39 I think the width param already tells you if its s
robertphillips 2013/04/08 19:33:20 Done.
// we use a simple coverage ramp to do aa on axis-aligned rects
// we check if the rect will be axis-aligned, and the rect won't land on
// integer coords.
@@ -715,19 +716,44 @@
return false;
}
- if (!drawState.getViewMatrix().preservesAxisAlignment()) {
- return false;
- }
+#ifdef SHADER_AA_FILL_RECT
+ if (stroked) {
+#endif
+ if (!drawState.getViewMatrix().preservesAxisAlignment()) {
+ return false;
+ }
- if (NULL != matrix &&
- !matrix->preservesAxisAlignment()) {
- return false;
+ if (NULL != matrix && !matrix->preservesAxisAlignment()) {
+ return false;
+ }
+#ifdef SHADER_AA_FILL_RECT
+ } else {
+ if (!drawState.getViewMatrix().preservesAxisAlignment() &&
+ !drawState.getViewMatrix().notSkewOrPersp()) {
+ return false;
+ }
+
+ if (NULL != matrix && !matrix->notSkewOrPersp()) {
+ return false;
+ }
}
+#endif
*combinedMatrix = drawState.getViewMatrix();
if (NULL != matrix) {
combinedMatrix->preConcat(*matrix);
- GrAssert(combinedMatrix->preservesAxisAlignment());
+
+#if GR_DEBUG
+#ifdef SHADER_AA_FILL_RECT
+ if (stroked) {
+#endif
+ GrAssert(combinedMatrix->preservesAxisAlignment());
+#ifdef SHADER_AA_FILL_RECT
+ } else {
+ GrAssert(combinedMatrix->notSkewOrPersp());
+ }
+#endif
+#endif
}
combinedMatrix->mapRect(devRect, rect);
@@ -756,7 +782,8 @@
!this->getRenderTarget()->isMultisampled();
bool doAA = needAA && apply_aa_to_rect(target, rect, width, matrix,
&combinedMatrix, &devRect,
- &useVertexCoverage);
+ &useVertexCoverage,
+ width >= 0);
if (doAA) {
GrDrawState::AutoDeviceCoordDraw adcd(target->drawState());
@@ -773,10 +800,17 @@
strokeSize.set(SK_Scalar1, SK_Scalar1);
}
fAARectRenderer->strokeAARect(this->getGpu(), target, devRect,
- strokeSize, useVertexCoverage);
+ strokeSize, useVertexCoverage);
} else {
+ // filled AA rect
+#ifdef SHADER_AA_FILL_RECT
+ fAARectRenderer->shaderFillAARect(this->getGpu(), target,
+ rect, combinedMatrix, devRect,
+ useVertexCoverage);
+#else
fAARectRenderer->fillAARect(this->getGpu(), target,
- devRect, useVertexCoverage);
+ devRect, useVertexCoverage);
+#endif
}
return;
}
@@ -822,6 +856,7 @@
target->drawNonIndexed(primType, 0, vertCount);
} else {
+ // filled BW rect
#if GR_STATIC_RECT_VB
const GrVertexBuffer* sqVB = fGpu->getUnitSquareVertexBuffer();
if (NULL == sqVB) {

Powered by Google App Engine
This is Rietveld 408576698