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

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

Issue 818233002: Remove coordchanges from drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@coord-change-off-paint
Patch Set: adding test to ignore Created 5 years, 11 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
« no previous file with comments | « src/gpu/GrSoftwarePathRenderer.cpp ('k') | src/gpu/effects/GrBezierEffect.h » ('j') | 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 0xffff, 114 0xffff,
115 0x0000, 115 0x0000,
116 0xffff); 116 0xffff);
117 117
118 drawState->setStencil(kInvertedStencilPass); 118 drawState->setStencil(kInvertedStencilPass);
119 119
120 // fake inverse with a stencil and cover 120 // fake inverse with a stencil and cover
121 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(GrColor_WHITE)) ; 121 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(GrColor_WHITE)) ;
122 target->stencilPath(drawState, pp, p, convert_skpath_filltype(path.getFi llType())); 122 target->stencilPath(drawState, pp, p, convert_skpath_filltype(path.getFi llType()));
123 123
124 SkMatrix invert = SkMatrix::I();
124 GrDrawState::AutoViewMatrixRestore avmr; 125 GrDrawState::AutoViewMatrixRestore avmr;
125 SkRect bounds = SkRect::MakeLTRB(0, 0, 126 SkRect bounds = SkRect::MakeLTRB(0, 0,
126 SkIntToScalar(drawState->getRenderTarge t()->width()), 127 SkIntToScalar(drawState->getRenderTarge t()->width()),
127 SkIntToScalar(drawState->getRenderTarge t()->height())); 128 SkIntToScalar(drawState->getRenderTarge t()->height()));
128 SkMatrix vmi; 129 SkMatrix vmi;
129 // mapRect through persp matrix may not be correct 130 // mapRect through persp matrix may not be correct
130 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn verse(&vmi)) { 131 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn verse(&vmi)) {
131 vmi.mapRect(&bounds); 132 vmi.mapRect(&bounds);
132 // theoretically could set bloat = 0, instead leave it because of ma trix inversion 133 // theoretically could set bloat = 0, instead leave it because of ma trix inversion
133 // precision. 134 // precision.
134 SkScalar bloat = drawState->getViewMatrix().getMaxScale() * SK_Scala rHalf; 135 SkScalar bloat = drawState->getViewMatrix().getMaxScale() * SK_Scala rHalf;
135 bounds.outset(bloat, bloat); 136 bounds.outset(bloat, bloat);
136 } else { 137 } else {
138 if (!drawState->getViewMatrix().invert(&invert)) {
139 return false;
140 }
137 avmr.setIdentity(drawState); 141 avmr.setIdentity(drawState);
138 } 142 }
139 target->drawSimpleRect(drawState, color, bounds); 143 target->drawRect(drawState, color, bounds, NULL, &invert);
140 } else { 144 } else {
141 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, 145 GR_STATIC_CONST_SAME_STENCIL(kStencilPass,
142 kZero_StencilOp, 146 kZero_StencilOp,
143 kZero_StencilOp, 147 kZero_StencilOp,
144 kNotEqual_StencilFunc, 148 kNotEqual_StencilFunc,
145 0xffff, 149 0xffff,
146 0x0000, 150 0x0000,
147 0xffff); 151 0xffff);
148 152
149 drawState->setStencil(kStencilPass); 153 drawState->setStencil(kStencilPass);
150 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color)); 154 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color));
151 target->drawPath(drawState, pp, p, convert_skpath_filltype(path.getFillT ype())); 155 target->drawPath(drawState, pp, p, convert_skpath_filltype(path.getFillT ype()));
152 } 156 }
153 157
154 drawState->stencil()->setDisabled(); 158 drawState->stencil()->setDisabled();
155 return true; 159 return true;
156 } 160 }
OLDNEW
« no previous file with comments | « src/gpu/GrSoftwarePathRenderer.cpp ('k') | src/gpu/effects/GrBezierEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698