aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGpuGL.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-21 17:11:44 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-21 17:11:44 +0000
commit4d5f3fe581a50ed5d57121d09faa8e613e47b16d (patch)
tree86ee3e6768af8c822a71b60c8bdfc88c6ce802e5 /src/gpu/gl/GrGpuGL.cpp
parentde1837bb96b0f72dad7482786d6e577013d4a85b (diff)
Use tristate in HW AA tracking, fix msaa disabled for non-smoothed lines bug
Review URL: http://codereview.appspot.com/6222051/ git-svn-id: http://skia.googlecode.com/svn/trunk@4015 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/gl/GrGpuGL.cpp')
-rw-r--r--src/gpu/gl/GrGpuGL.cpp60
1 files changed, 33 insertions, 27 deletions
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index bc35f50041..341675bc18 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -464,13 +464,11 @@ void GrGpuGL::onResetContext() {
fHWDitherEnabled = kUnknown_TriState;
if (kDesktop_GrGLBinding == this->glBinding()) {
- GL_CALL(Disable(GR_GL_LINE_SMOOTH));
+ // we never use point or polygon smoothing
+ // should we also disable polygon smoothing?
GL_CALL(Disable(GR_GL_POINT_SMOOTH));
- GL_CALL(Disable(GR_GL_MULTISAMPLE));
- fHWAAState.fMSAAEnabled = false;
- fHWAAState.fSmoothLineEnabled = false;
}
-
+ fHWAAState.invalidate();
fHWWriteToColor = kUnknown_TriState;
fHWDrawState.resetStateFlags();
@@ -1927,32 +1925,40 @@ void GrGpuGL::flushAAState(GrPrimitiveType type) {
if (kDesktop_GrGLBinding == this->glBinding()) {
// ES doesn't support toggling GL_MULTISAMPLE and doesn't have
// smooth lines.
-
// we prefer smooth lines over multisampled lines
- // msaa should be disabled if drawing smooth lines.
+ bool smoothLines = false;
+
if (GrIsPrimTypeLines(type)) {
- bool smooth = this->willUseHWAALines();
- if (!fHWAAState.fSmoothLineEnabled && smooth) {
- GL_CALL(Enable(GR_GL_LINE_SMOOTH));
- fHWAAState.fSmoothLineEnabled = true;
- } else if (fHWAAState.fSmoothLineEnabled && !smooth) {
- GL_CALL(Disable(GR_GL_LINE_SMOOTH));
- fHWAAState.fSmoothLineEnabled = false;
- }
- if (rt->isMultisampled() &&
- fHWAAState.fMSAAEnabled) {
- GL_CALL(Disable(GR_GL_MULTISAMPLE));
- fHWAAState.fMSAAEnabled = false;
+ smoothLines = this->willUseHWAALines();
+ if (smoothLines) {
+ if (kYes_TriState != fHWAAState.fSmoothLineEnabled) {
+ GL_CALL(Enable(GR_GL_LINE_SMOOTH));
+ fHWAAState.fSmoothLineEnabled = kYes_TriState;
+ // must disable msaa to use line smoothing
+ if (rt->isMultisampled() &&
+ kNo_TriState != fHWAAState.fMSAAEnabled) {
+ GL_CALL(Disable(GR_GL_MULTISAMPLE));
+ fHWAAState.fMSAAEnabled = kNo_TriState;
+ }
+ }
+ } else {
+ if (kNo_TriState != fHWAAState.fSmoothLineEnabled) {
+ GL_CALL(Disable(GR_GL_LINE_SMOOTH));
+ fHWAAState.fSmoothLineEnabled = kNo_TriState;
+ }
}
- } else if (rt->isMultisampled() &&
- this->getDrawState().isHWAntialiasState() !=
- fHWAAState.fMSAAEnabled) {
- if (fHWAAState.fMSAAEnabled) {
- GL_CALL(Disable(GR_GL_MULTISAMPLE));
- fHWAAState.fMSAAEnabled = false;
+ }
+ if (!smoothLines && rt->isMultisampled()) {
+ if (this->getDrawState().isHWAntialiasState()) {
+ if (kYes_TriState != fHWAAState.fMSAAEnabled) {
+ GL_CALL(Enable(GR_GL_MULTISAMPLE));
+ fHWAAState.fMSAAEnabled = kYes_TriState;
+ }
} else {
- GL_CALL(Enable(GR_GL_MULTISAMPLE));
- fHWAAState.fMSAAEnabled = true;
+ if (kNo_TriState != fHWAAState.fMSAAEnabled) {
+ GL_CALL(Disable(GR_GL_MULTISAMPLE));
+ fHWAAState.fMSAAEnabled = kNo_TriState;
+ }
}
}
}