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

Unified Diff: src/gpu/GrContext.cpp

Issue 13521006: First pass at Rect Effect (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: renamed isOrthogonal to preservesRightAngles 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
« no previous file with comments | « src/gpu/GrAARectRenderer.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
===================================================================
--- src/gpu/GrContext.cpp (revision 8570)
+++ src/gpu/GrContext.cpp (working copy)
@@ -682,7 +682,7 @@
static bool apply_aa_to_rect(GrDrawTarget* target,
const GrRect& rect,
- SkScalar width,
+ SkScalar strokeWidth,
const SkMatrix* matrix,
SkMatrix* combinedMatrix,
GrRect* devRect,
@@ -711,29 +711,54 @@
return false;
}
- if (0 == width && target->willUseHWAALines()) {
+ if (0 == strokeWidth && target->willUseHWAALines()) {
return false;
}
- if (!drawState.getViewMatrix().preservesAxisAlignment()) {
- return false;
- }
+#ifdef SHADER_AA_FILL_RECT
+ if (strokeWidth >= 0) {
+#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().preservesRightAngles()) {
+ return false;
+ }
+
+ if (NULL != matrix && !matrix->preservesRightAngles()) {
+ return false;
+ }
}
+#endif
*combinedMatrix = drawState.getViewMatrix();
if (NULL != matrix) {
combinedMatrix->preConcat(*matrix);
- GrAssert(combinedMatrix->preservesAxisAlignment());
+
+#if GR_DEBUG
+#ifdef SHADER_AA_FILL_RECT
+ if (strokeWidth >= 0) {
+#endif
+ GrAssert(combinedMatrix->preservesAxisAlignment());
+#ifdef SHADER_AA_FILL_RECT
+ } else {
+ GrAssert(combinedMatrix->preservesRightAngles());
+ }
+#endif
+#endif
}
combinedMatrix->mapRect(devRect, rect);
devRect->sort();
- if (width < 0) {
+ if (strokeWidth < 0) {
return !isIRect(*devRect);
} else {
return true;
@@ -757,7 +782,6 @@
bool doAA = needAA && apply_aa_to_rect(target, rect, width, matrix,
&combinedMatrix, &devRect,
&useVertexCoverage);
-
if (doAA) {
GrDrawState::AutoDeviceCoordDraw adcd(target->drawState());
if (!adcd.succeeded()) {
@@ -773,10 +797,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 +853,7 @@
target->drawNonIndexed(primType, 0, vertCount);
} else {
+ // filled BW rect
#if GR_STATIC_RECT_VB
const GrVertexBuffer* sqVB = fGpu->getUnitSquareVertexBuffer();
if (NULL == sqVB) {
« no previous file with comments | « src/gpu/GrAARectRenderer.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698