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

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

Issue 12462008: Add GrEllipseEdgeEffect (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: rebase again Created 7 years, 9 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/GrEffect.cpp ('k') | src/gpu/GrTextContext.cpp » ('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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrSWMaskHelper.h" 8 #include "GrSWMaskHelper.h"
9 #include "GrDrawState.h" 9 #include "GrDrawState.h"
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 GrDrawTarget* target, 186 GrDrawTarget* target,
187 const GrIRect& rect) { 187 const GrIRect& rect) {
188 GrDrawState* drawState = target->drawState(); 188 GrDrawState* drawState = target->drawState();
189 189
190 GrDrawState::AutoDeviceCoordDraw adcd(drawState); 190 GrDrawState::AutoDeviceCoordDraw adcd(drawState);
191 if (!adcd.succeeded()) { 191 if (!adcd.succeeded()) {
192 return; 192 return;
193 } 193 }
194 enum { 194 enum {
195 // the SW path renderer shares this stage with glyph 195 // the SW path renderer shares this stage with glyph
196 // rendering (kGlyphMaskStage in GrBatchedTextContext) 196 // rendering (kGlyphMaskStage in GrTextContext)
197 // && edge rendering (kEdgeEffectStage in GrContext)
197 kPathMaskStage = GrPaint::kTotalStages, 198 kPathMaskStage = GrPaint::kTotalStages,
198 }; 199 };
199 GrAssert(!drawState->isStageEnabled(kPathMaskStage)); 200 GrAssert(!drawState->isStageEnabled(kPathMaskStage));
200 drawState->createTextureEffect(kPathMaskStage, texture, SkMatrix::I()); 201 drawState->createTextureEffect(kPathMaskStage, texture, SkMatrix::I());
201 SkScalar w = SkIntToScalar(rect.width()); 202 SkScalar w = SkIntToScalar(rect.width());
202 SkScalar h = SkIntToScalar(rect.height()); 203 SkScalar h = SkIntToScalar(rect.height());
203 GrRect maskRect = GrRect::MakeWH(w / texture->width(), 204 GrRect maskRect = GrRect::MakeWH(w / texture->width(),
204 h / texture->height()); 205 h / texture->height());
205 206
206 GrRect dstRect = GrRect::MakeLTRB( 207 GrRect dstRect = GrRect::MakeLTRB(
207 SK_Scalar1 * rect.fLeft, 208 SK_Scalar1 * rect.fLeft,
208 SK_Scalar1 * rect.fTop, 209 SK_Scalar1 * rect.fTop,
209 SK_Scalar1 * rect.fRight, 210 SK_Scalar1 * rect.fRight,
210 SK_Scalar1 * rect.fBottom); 211 SK_Scalar1 * rect.fBottom);
211 target->drawRect(dstRect, NULL, &maskRect, NULL, kPathMaskStage); 212 target->drawRect(dstRect, NULL, &maskRect, NULL, kPathMaskStage);
212 drawState->disableStage(kPathMaskStage); 213 drawState->disableStage(kPathMaskStage);
213 } 214 }
OLDNEW
« no previous file with comments | « src/gpu/GrEffect.cpp ('k') | src/gpu/GrTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698