OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 #include "GrClipMaskManager.h" | 9 #include "GrClipMaskManager.h" |
10 #include "GrAAConvexPathRenderer.h" | 10 #include "GrAAConvexPathRenderer.h" |
11 #include "GrAAHairLinePathRenderer.h" | 11 #include "GrAAHairLinePathRenderer.h" |
12 #include "GrAARectRenderer.h" | 12 #include "GrAARectRenderer.h" |
13 #include "GrDrawTargetCaps.h" | 13 #include "GrDrawTargetCaps.h" |
14 #include "GrGpu.h" | 14 #include "GrGpu.h" |
15 #include "GrPaint.h" | 15 #include "GrPaint.h" |
16 #include "GrPathRenderer.h" | 16 #include "GrPathRenderer.h" |
17 #include "GrRenderTarget.h" | 17 #include "GrRenderTarget.h" |
18 #include "GrStencilBuffer.h" | 18 #include "GrStencilBuffer.h" |
19 #include "GrSWMaskHelper.h" | 19 #include "GrSWMaskHelper.h" |
20 #include "effects/GrTextureDomain.h" | 20 #include "effects/GrTextureDomain.h" |
21 #include "effects/GrConvexPolyEffect.h" | 21 #include "effects/GrConvexPolyEffect.h" |
| 22 #include "effects/GrRRectEffect.h" |
22 #include "SkRasterClip.h" | 23 #include "SkRasterClip.h" |
23 #include "SkStrokeRec.h" | 24 #include "SkStrokeRec.h" |
24 #include "SkTLazy.h" | 25 #include "SkTLazy.h" |
25 | 26 |
26 #define GR_AA_CLIP 1 | 27 #define GR_AA_CLIP 1 |
27 | 28 |
28 typedef SkClipStack::Element Element; | 29 typedef SkClipStack::Element Element; |
29 | 30 |
30 using namespace GrReducedClip; | 31 using namespace GrReducedClip; |
31 | 32 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 effect.reset(GrConvexPolyEffect::Create(GrConvexPolyEffect::
kFillNoAA_EdgeType, | 183 effect.reset(GrConvexPolyEffect::Create(GrConvexPolyEffect::
kFillNoAA_EdgeType, |
183 path, &offset)); | 184 path, &offset)); |
184 } | 185 } |
185 } else { | 186 } else { |
186 SkVector offset = { SkIntToScalar(-clipDataIn->fOrigin.fX), | 187 SkVector offset = { SkIntToScalar(-clipDataIn->fOrigin.fX), |
187 SkIntToScalar(-clipDataIn->fOrigin.fY) }; | 188 SkIntToScalar(-clipDataIn->fOrigin.fY) }; |
188 GrConvexPolyEffect::EdgeType type = isAA ? GrConvexPolyEffect::k
FillAA_EdgeType : | 189 GrConvexPolyEffect::EdgeType type = isAA ? GrConvexPolyEffect::k
FillAA_EdgeType : |
189 GrConvexPolyEffect::k
FillNoAA_EdgeType; | 190 GrConvexPolyEffect::k
FillNoAA_EdgeType; |
190 effect.reset(GrConvexPolyEffect::Create(type, path, &offset)); | 191 effect.reset(GrConvexPolyEffect::Create(type, path, &offset)); |
191 } | 192 } |
| 193 } else if (isAA && SkClipStack::Element::kRRect_Type == type && !rt->isM
ultisampled()) { |
| 194 const SkRRect& rrect = elements.tail()->getRRect(); |
| 195 effect.reset(GrRRectEffect::Create(rrect)); |
192 } else if (isAA && SkClipStack::Element::kRect_Type == type && !rt->isMu
ltisampled()) { | 196 } else if (isAA && SkClipStack::Element::kRect_Type == type && !rt->isMu
ltisampled()) { |
193 // We only handle AA/non-MSAA rects here. Coverage effect AA isn't M
SAA friendly and | 197 // We only handle AA/non-MSAA rects here. Coverage effect AA isn't M
SAA friendly and |
194 // non-AA rect clips are handled by the scissor. | 198 // non-AA rect clips are handled by the scissor. |
195 SkRect rect = elements.tail()->getRect(); | 199 SkRect rect = elements.tail()->getRect(); |
196 SkVector offset = { SkIntToScalar(-clipDataIn->fOrigin.fX), | 200 SkVector offset = { SkIntToScalar(-clipDataIn->fOrigin.fX), |
197 SkIntToScalar(-clipDataIn->fOrigin.fY) }; | 201 SkIntToScalar(-clipDataIn->fOrigin.fY) }; |
198 rect.offset(offset); | 202 rect.offset(offset); |
199 effect.reset(GrConvexPolyEffect::CreateForAAFillRect(rect)); | 203 effect.reset(GrConvexPolyEffect::CreateForAAFillRect(rect)); |
200 // This should never fail. | 204 // This should never fail. |
201 SkASSERT(effect); | 205 SkASSERT(effect); |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 | 1077 |
1074 // TODO: dynamically attach a stencil buffer | 1078 // TODO: dynamically attach a stencil buffer |
1075 int stencilBits = 0; | 1079 int stencilBits = 0; |
1076 GrStencilBuffer* stencilBuffer = | 1080 GrStencilBuffer* stencilBuffer = |
1077 drawState.getRenderTarget()->getStencilBuffer(); | 1081 drawState.getRenderTarget()->getStencilBuffer(); |
1078 if (NULL != stencilBuffer) { | 1082 if (NULL != stencilBuffer) { |
1079 stencilBits = stencilBuffer->bits(); | 1083 stencilBits = stencilBuffer->bits(); |
1080 this->adjustStencilParams(settings, clipMode, stencilBits); | 1084 this->adjustStencilParams(settings, clipMode, stencilBits); |
1081 } | 1085 } |
1082 } | 1086 } |
OLD | NEW |