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

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

Issue 15780002: Replace GrDrawState::AutoDeviceCoordDraw with GrDrawState::AutoViewMatrixRestore::setIdentity(). s (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: update based on comments Created 7 years, 6 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
« no previous file with comments | « src/gpu/GrSoftwarePathRenderer.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9
10 #include "GrStencilAndCoverPathRenderer.h" 10 #include "GrStencilAndCoverPathRenderer.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 SkPath::FillType nonInvertedFill = SkPath::ConvertToNonInverseFillType(path. getFillType()); 73 SkPath::FillType nonInvertedFill = SkPath::ConvertToNonInverseFillType(path. getFillType());
74 target->stencilPath(p, stroke, nonInvertedFill); 74 target->stencilPath(p, stroke, nonInvertedFill);
75 75
76 // TODO: Use built in cover operation rather than a rect draw. This will req uire making our 76 // TODO: Use built in cover operation rather than a rect draw. This will req uire making our
77 // fragment shaders be able to eat varyings generated by a matrix. 77 // fragment shaders be able to eat varyings generated by a matrix.
78 78
79 // fill the path, zero out the stencil 79 // fill the path, zero out the stencil
80 GrRect bounds = p->getBounds(); 80 GrRect bounds = p->getBounds();
81 SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_ScalarHalf; 81 SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_ScalarHalf;
82 GrDrawState::AutoDeviceCoordDraw adcd; 82 GrDrawState::AutoViewMatrixRestore avmr;
83 83
84 if (nonInvertedFill == path.getFillType()) { 84 if (nonInvertedFill == path.getFillType()) {
85 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, 85 GR_STATIC_CONST_SAME_STENCIL(kStencilPass,
86 kZero_StencilOp, 86 kZero_StencilOp,
87 kZero_StencilOp, 87 kZero_StencilOp,
88 kNotEqual_StencilFunc, 88 kNotEqual_StencilFunc,
89 0xffff, 89 0xffff,
90 0x0000, 90 0x0000,
91 0xffff); 91 0xffff);
92 *drawState->stencil() = kStencilPass; 92 *drawState->stencil() = kStencilPass;
(...skipping 11 matching lines...) Expand all
104 SkMatrix vmi; 104 SkMatrix vmi;
105 bounds.setLTRB(0, 0, 105 bounds.setLTRB(0, 0,
106 SkIntToScalar(drawState->getRenderTarget()->width()), 106 SkIntToScalar(drawState->getRenderTarget()->width()),
107 SkIntToScalar(drawState->getRenderTarget()->height())); 107 SkIntToScalar(drawState->getRenderTarget()->height()));
108 // mapRect through persp matrix may not be correct 108 // mapRect through persp matrix may not be correct
109 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn verse(&vmi)) { 109 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn verse(&vmi)) {
110 vmi.mapRect(&bounds); 110 vmi.mapRect(&bounds);
111 // theoretically could set bloat = 0, instead leave it because of ma trix inversion 111 // theoretically could set bloat = 0, instead leave it because of ma trix inversion
112 // precision. 112 // precision.
113 } else { 113 } else {
114 adcd.set(drawState); 114 avmr.setIdentity(drawState);
115 bloat = 0; 115 bloat = 0;
116 } 116 }
117 *drawState->stencil() = kInvertedStencilPass; 117 *drawState->stencil() = kInvertedStencilPass;
118 } 118 }
119 bounds.outset(bloat, bloat); 119 bounds.outset(bloat, bloat);
120 target->drawSimpleRect(bounds, NULL); 120 target->drawSimpleRect(bounds, NULL);
121 target->drawState()->stencil()->setDisabled(); 121 target->drawState()->stencil()->setDisabled();
122 return true; 122 return true;
123 } 123 }
OLDNEW
« no previous file with comments | « src/gpu/GrSoftwarePathRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698