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

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 687563008: Beginning to refactor nvpr code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 6 years, 2 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
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 11abb57691ea7ccb0a27117605d035ff61676133..2f25272e31c356e935bce4e9b9784bcfb061a34f 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -527,28 +527,20 @@ void GrDrawTarget::drawNonIndexed(GrPrimitiveType type,
}
}
-void GrDrawTarget::stencilPath(const GrPath* path, SkPath::FillType fill) {
+void GrDrawTarget::stencilPath(const GrPath* path, GrPathRendering::FillType fill) {
// TODO: extract portions of checkDraw that are relevant to path stenciling.
SkASSERT(path);
SkASSERT(this->caps()->pathRenderingSupport());
- SkASSERT(!SkPath::IsInverseFillType(fill));
this->onStencilPath(path, fill);
}
-void GrDrawTarget::drawPath(const GrPath* path, SkPath::FillType fill) {
+void GrDrawTarget::drawPath(const GrPath* path, GrPathRendering::FillType fill) {
// TODO: extract portions of checkDraw that are relevant to path rendering.
SkASSERT(path);
SkASSERT(this->caps()->pathRenderingSupport());
- const GrDrawState* drawState = &getDrawState();
- SkRect devBounds;
- if (SkPath::IsInverseFillType(fill)) {
- devBounds = SkRect::MakeWH(SkIntToScalar(drawState->getRenderTarget()->width()),
- SkIntToScalar(drawState->getRenderTarget()->height()));
- } else {
- devBounds = path->getBounds();
- }
- SkMatrix viewM = drawState->getViewMatrix();
+ SkRect devBounds = path->getBounds();
+ SkMatrix viewM = this->drawState()->getViewMatrix();
viewM.mapRect(&devBounds);
GrDeviceCoordTexture dstCopy;
@@ -562,7 +554,7 @@ void GrDrawTarget::drawPath(const GrPath* path, SkPath::FillType fill) {
void GrDrawTarget::drawPaths(const GrPathRange* pathRange,
const uint32_t indices[], int count,
const float transforms[], PathTransformType transformsType,
- SkPath::FillType fill) {
+ GrPathRendering::FillType fill) {
SkASSERT(this->caps()->pathRenderingSupport());
SkASSERT(pathRange);
SkASSERT(indices);
@@ -724,43 +716,6 @@ void GrDrawTarget::onDrawRect(const SkRect& rect,
void GrDrawTarget::clipWillBeSet(const GrClipData* clipData) {
}
-static const GrStencilSettings& winding_path_stencil_settings() {
- GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings,
- kIncClamp_StencilOp,
- kIncClamp_StencilOp,
- kAlwaysIfInClip_StencilFunc,
- 0xFFFF, 0xFFFF, 0xFFFF);
- return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings);
-}
-
-static const GrStencilSettings& even_odd_path_stencil_settings() {
- GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings,
- kInvert_StencilOp,
- kInvert_StencilOp,
- kAlwaysIfInClip_StencilFunc,
- 0xFFFF, 0xFFFF, 0xFFFF);
- return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings);
-}
-
-void GrDrawTarget::getPathStencilSettingsForFillType(SkPath::FillType fill,
- GrStencilSettings* outStencilSettings) {
-
- switch (fill) {
- default:
- SkFAIL("Unexpected path fill.");
- /* fallthrough */;
- case SkPath::kWinding_FillType:
- case SkPath::kInverseWinding_FillType:
- *outStencilSettings = winding_path_stencil_settings();
- break;
- case SkPath::kEvenOdd_FillType:
- case SkPath::kInverseEvenOdd_FillType:
- *outStencilSettings = even_odd_path_stencil_settings();
- break;
- }
- this->getClipMaskManager()->adjustPathStencilParams(outStencilSettings);
-}
-
////////////////////////////////////////////////////////////////////////////////
GrDrawTarget::AutoStateRestore::AutoStateRestore() {

Powered by Google App Engine
This is Rietveld 408576698