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

Unified Diff: src/gpu/effects/GrRRectEffect.cpp

Issue 214153002: Add clip effect for circles (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix test Created 6 years, 9 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/effects/GrOvalEffect.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrRRectEffect.cpp
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index eff4aa86496c93e360eca443ad6df39df333dd98..1e93eb1bdf583967dc2a2b59bb8431d606bfb061 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -10,6 +10,7 @@
#include "gl/GrGLEffect.h"
#include "gl/GrGLSL.h"
#include "GrConvexPolyEffect.h"
+#include "GrOvalEffect.h"
#include "GrTBackendEffectFactory.h"
#include "SkRRect.h"
@@ -77,7 +78,9 @@ private:
GrEffectRef* CircularRRectEffect::Create(GrEffectEdgeType edgeType,
uint32_t circularCornerFlags,
const SkRRect& rrect) {
- SkASSERT(kFillAA_GrEffectEdgeType == edgeType || kInverseFillAA_GrEffectEdgeType == edgeType);
+ if (kFillAA_GrEffectEdgeType != edgeType && kInverseFillAA_GrEffectEdgeType != edgeType) {
+ return NULL;
+ }
return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(CircularRRectEffect,
(edgeType, circularCornerFlags, rrect))));
}
@@ -410,7 +413,9 @@ private:
};
GrEffectRef* EllipticalRRectEffect::Create(GrEffectEdgeType edgeType, const SkRRect& rrect) {
- SkASSERT(kFillAA_GrEffectEdgeType == edgeType || kInverseFillAA_GrEffectEdgeType == edgeType);
+ if (kFillAA_GrEffectEdgeType != edgeType && kInverseFillAA_GrEffectEdgeType != edgeType) {
+ return NULL;
+ }
return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(EllipticalRRectEffect, (edgeType, rrect))));
}
@@ -627,14 +632,14 @@ void GLEllipticalRRectEffect::setData(const GrGLUniformManager& uman,
//////////////////////////////////////////////////////////////////////////////
GrEffectRef* GrRRectEffect::Create(GrEffectEdgeType edgeType, const SkRRect& rrect) {
- if (kFillAA_GrEffectEdgeType != edgeType && kInverseFillAA_GrEffectEdgeType != edgeType) {
- return NULL;
- }
-
if (rrect.isRect()) {
return GrConvexPolyEffect::Create(edgeType, rrect.getBounds());
}
+ if (rrect.isOval()) {
+ return GrOvalEffect::Create(edgeType, rrect.getBounds());
+ }
+
if (rrect.isSimple()) {
if (rrect.getSimpleRadii().fX < kRadiusMin || rrect.getSimpleRadii().fY < kRadiusMin) {
// In this case the corners are extremely close to rectangular and we collapse the
« no previous file with comments | « src/gpu/effects/GrOvalEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698