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

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

Issue 274673004: Add Dashing gpu effect for simple dashed lines (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Move DrawDashLine into namespace Created 6 years, 7 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 | « samplecode/SampleApp.cpp ('k') | src/gpu/effects/GrDashingEffect.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 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "effects/GrBicubicEffect.h" 10 #include "effects/GrBicubicEffect.h"
11 #include "effects/GrDashingEffect.h"
11 #include "effects/GrTextureDomain.h" 12 #include "effects/GrTextureDomain.h"
12 #include "effects/GrSimpleTextureEffect.h" 13 #include "effects/GrSimpleTextureEffect.h"
13 14
14 #include "GrContext.h" 15 #include "GrContext.h"
15 #include "GrBitmapTextContext.h" 16 #include "GrBitmapTextContext.h"
16 #include "GrDistanceFieldTextContext.h" 17 #include "GrDistanceFieldTextContext.h"
17 #include "GrLayerCache.h" 18 #include "GrLayerCache.h"
18 #include "GrPictureUtils.h" 19 #include "GrPictureUtils.h"
19 20
20 #include "SkGrTexturePixelRef.h" 21 #include "SkGrTexturePixelRef.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, 413 void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
413 size_t count, const SkPoint pts[], const SkPaint& p aint) { 414 size_t count, const SkPoint pts[], const SkPaint& p aint) {
414 CHECK_FOR_ANNOTATION(paint); 415 CHECK_FOR_ANNOTATION(paint);
415 CHECK_SHOULD_DRAW(draw, false); 416 CHECK_SHOULD_DRAW(draw, false);
416 417
417 SkScalar width = paint.getStrokeWidth(); 418 SkScalar width = paint.getStrokeWidth();
418 if (width < 0) { 419 if (width < 0) {
419 return; 420 return;
420 } 421 }
421 422
423 if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mod e) {
424 if (GrDashingEffect::DrawDashLine(pts, paint, this)) {
425 return;
426 }
427 }
428
422 // we only handle hairlines and paints without path effects or mask filters, 429 // we only handle hairlines and paints without path effects or mask filters,
423 // else we let the SkDraw call our drawPath() 430 // else we let the SkDraw call our drawPath()
424 if (width > 0 || paint.getPathEffect() || paint.getMaskFilter()) { 431 if (width > 0 || paint.getPathEffect() || paint.getMaskFilter()) {
425 draw.drawPoints(mode, count, pts, paint, true); 432 draw.drawPoints(mode, count, pts, paint, true);
426 return; 433 return;
427 } 434 }
428 435
429 GrPaint grPaint; 436 GrPaint grPaint;
430 SkPaint2GrPaintShader(this, paint, true, &grPaint); 437 SkPaint2GrPaintShader(this, paint, true, &grPaint);
431 438
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1983 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict ure, i); 1990 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict ure, i);
1984 1991
1985 if (NULL != layer->getTexture()) { 1992 if (NULL != layer->getTexture()) {
1986 fContext->unlockScratchTexture(layer->getTexture()); 1993 fContext->unlockScratchTexture(layer->getTexture());
1987 layer->setTexture(NULL); 1994 layer->setTexture(NULL);
1988 } 1995 }
1989 } 1996 }
1990 1997
1991 return true; 1998 return true;
1992 } 1999 }
OLDNEW
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/gpu/effects/GrDashingEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698