aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrRRectEffect.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-28 15:58:31 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-28 15:58:31 +0000
commit3eedb801e35001df4b7e154edf4fd8da942296a0 (patch)
tree5f65640d99da509c35fbda634bce6dff54474f68 /src/gpu/effects/GrRRectEffect.cpp
parentb556422de723ba176f6b453818c49bd85b836957 (diff)
Add clip effect for circles
BUG=skia:2181 R=jvanverth@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/214153002 git-svn-id: http://skia.googlecode.com/svn/trunk@13974 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/effects/GrRRectEffect.cpp')
-rw-r--r--src/gpu/effects/GrRRectEffect.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index eff4aa8649..1e93eb1bdf 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