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

Side by Side Diff: src/gpu/GrContext.cpp

Issue 14109033: Disable AA for ovals and roundrects if MSAA is enabled (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fix roundrects Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 973
974 /////////////////////////////////////////////////////////////////////////////// 974 ///////////////////////////////////////////////////////////////////////////////
975 975
976 void GrContext::drawRRect(const GrPaint& paint, 976 void GrContext::drawRRect(const GrPaint& paint,
977 const SkRRect& rect, 977 const SkRRect& rect,
978 const SkStrokeRec& stroke) { 978 const SkStrokeRec& stroke) {
979 979
980 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW); 980 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW);
981 GrDrawState::AutoStageDisable atr(fDrawState); 981 GrDrawState::AutoStageDisable atr(fDrawState);
982 982
983 if (!fOvalRenderer->drawSimpleRRect(target, this, paint, rect, stroke)) { 983 bool prAA = paint.isAntiAlias() && !this->getRenderTarget()->isMultisampled( );
bsalomon 2013/04/29 21:17:08 prAA meant "path renderer aa". Not so obvious, I r
984
985 if (!fOvalRenderer->drawSimpleRRect(target, this, prAA, rect, stroke)) {
984 SkPath path; 986 SkPath path;
985 path.addRRect(rect); 987 path.addRRect(rect);
986 this->internalDrawPath(target, paint, path, stroke); 988 this->internalDrawPath(target, prAA, path, stroke);
987 } 989 }
988 } 990 }
989 991
990 /////////////////////////////////////////////////////////////////////////////// 992 ///////////////////////////////////////////////////////////////////////////////
991 993
992 void GrContext::drawOval(const GrPaint& paint, 994 void GrContext::drawOval(const GrPaint& paint,
993 const GrRect& oval, 995 const GrRect& oval,
994 const SkStrokeRec& stroke) { 996 const SkStrokeRec& stroke) {
995 997
996 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW); 998 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW);
997 GrDrawState::AutoStageDisable atr(fDrawState); 999 GrDrawState::AutoStageDisable atr(fDrawState);
998 1000
999 if (!fOvalRenderer->drawOval(target, this, paint, oval, stroke)) { 1001 bool prAA = paint.isAntiAlias() && !this->getRenderTarget()->isMultisampled( );
1002
1003 if (!fOvalRenderer->drawOval(target, this, prAA, oval, stroke)) {
1000 SkPath path; 1004 SkPath path;
1001 path.addOval(oval); 1005 path.addOval(oval);
1002 this->internalDrawPath(target, paint, path, stroke); 1006 this->internalDrawPath(target, prAA, path, stroke);
1003 } 1007 }
1004 } 1008 }
1005 1009
1006 void GrContext::drawPath(const GrPaint& paint, const SkPath& path, const SkStrok eRec& stroke) { 1010 void GrContext::drawPath(const GrPaint& paint, const SkPath& path, const SkStrok eRec& stroke) {
1007 1011
1008 if (path.isEmpty()) { 1012 if (path.isEmpty()) {
1009 if (path.isInverseFillType()) { 1013 if (path.isInverseFillType()) {
1010 this->drawPaint(paint); 1014 this->drawPaint(paint);
1011 } 1015 }
1012 return; 1016 return;
1013 } 1017 }
1014 1018
1015 // Note that internalDrawPath may sw-rasterize the path into a scratch textu re. 1019 // Note that internalDrawPath may sw-rasterize the path into a scratch textu re.
1016 // Scratch textures can be recycled after they are returned to the texture 1020 // Scratch textures can be recycled after they are returned to the texture
1017 // cache. This presents a potential hazard for buffered drawing. However, 1021 // cache. This presents a potential hazard for buffered drawing. However,
1018 // the writePixels that uploads to the scratch will perform a flush so we're 1022 // the writePixels that uploads to the scratch will perform a flush so we're
1019 // OK. 1023 // OK.
1020 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW); 1024 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW);
1021 GrDrawState::AutoStageDisable atr(fDrawState); 1025 GrDrawState::AutoStageDisable atr(fDrawState);
1022 1026
1023 SkRect ovalRect; 1027 SkRect ovalRect;
1024 bool isOval = path.isOval(&ovalRect); 1028 bool isOval = path.isOval(&ovalRect);
1029 bool prAA = paint.isAntiAlias() && !this->getRenderTarget()->isMultisampled( );
1025 1030
1026 if (!isOval || path.isInverseFillType() 1031 if (!isOval || path.isInverseFillType()
1027 || !fOvalRenderer->drawOval(target, this, paint, ovalRect, stroke)) { 1032 || !fOvalRenderer->drawOval(target, this, prAA, ovalRect, stroke)) {
1028 this->internalDrawPath(target, paint, path, stroke); 1033 this->internalDrawPath(target, prAA, path, stroke);
1029 } 1034 }
1030 } 1035 }
1031 1036
1032 void GrContext::internalDrawPath(GrDrawTarget* target, const GrPaint& paint, con st SkPath& path, 1037 void GrContext::internalDrawPath(GrDrawTarget* target, bool prAA, const SkPath& path,
1033 const SkStrokeRec& stroke) { 1038 const SkStrokeRec& stroke) {
1034 1039
1035 bool prAA = paint.isAntiAlias() && !this->getRenderTarget()->isMultisampled( );
1036
1037 // An Assumption here is that path renderer would use some form of tweaking 1040 // An Assumption here is that path renderer would use some form of tweaking
1038 // the src color (either the input alpha or in the frag shader) to implement 1041 // the src color (either the input alpha or in the frag shader) to implement
1039 // aa. If we have some future driver-mojo path AA that can do the right 1042 // aa. If we have some future driver-mojo path AA that can do the right
1040 // thing WRT to the blend then we'll need some query on the PR. 1043 // thing WRT to the blend then we'll need some query on the PR.
1041 if (disable_coverage_aa_for_blend(target)) { 1044 if (disable_coverage_aa_for_blend(target)) {
1042 #if GR_DEBUG 1045 #if GR_DEBUG
1043 //GrPrintf("Turning off AA to correctly apply blend.\n"); 1046 //GrPrintf("Turning off AA to correctly apply blend.\n");
1044 #endif 1047 #endif
1045 prAA = false; 1048 prAA = false;
1046 } 1049 }
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 return srcTexture; 1807 return srcTexture;
1805 } 1808 }
1806 } 1809 }
1807 1810
1808 /////////////////////////////////////////////////////////////////////////////// 1811 ///////////////////////////////////////////////////////////////////////////////
1809 #if GR_CACHE_STATS 1812 #if GR_CACHE_STATS
1810 void GrContext::printCacheStats() const { 1813 void GrContext::printCacheStats() const {
1811 fTextureCache->printStats(); 1814 fTextureCache->printStats();
1812 } 1815 }
1813 #endif 1816 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698