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

Side by Side Diff: src/gpu/GrDrawTarget.h

Issue 23440049: Implement stroking a path with nv_path_rendering (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/gpu/GrDrawTarget.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 2010 Google Inc. 2 * Copyright 2010 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 #ifndef GrDrawTarget_DEFINED 8 #ifndef GrDrawTarget_DEFINED
9 #define GrDrawTarget_DEFINED 9 #define GrDrawTarget_DEFINED
10 10
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 void drawNonIndexed(GrPrimitiveType type, 319 void drawNonIndexed(GrPrimitiveType type,
320 int startVertex, 320 int startVertex,
321 int vertexCount, 321 int vertexCount,
322 const SkRect* devBounds = NULL); 322 const SkRect* devBounds = NULL);
323 323
324 /** 324 /**
325 * Draws path into the stencil buffer. The fill must be either even/odd or 325 * Draws path into the stencil buffer. The fill must be either even/odd or
326 * winding (not inverse or hairline). It will respect the HW antialias flag 326 * winding (not inverse or hairline). It will respect the HW antialias flag
327 * on the draw state (if possible in the 3D API). 327 * on the draw state (if possible in the 3D API).
328 */ 328 */
329 void stencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath::FillType fill); 329 void stencilPath(const GrPath*, SkPath::FillType fill);
330 330
331 /** 331 /**
332 * Fills a path. Fill must not be a hairline. It will respect the HW 332 * Draws a path. Fill must not be a hairline. It will respect the HW
333 * antialias flag on the draw state (if possible in the 3D API). 333 * antialias flag on the draw state (if possible in the 3D API).
334 */ 334 */
335 void fillPath(const GrPath*, const SkStrokeRec& stroke, SkPath::FillType fil l); 335 void drawPath(const GrPath*, SkPath::FillType fill);
336 336
337 /** 337 /**
338 * Helper function for drawing rects. It performs a geometry src push and po p 338 * Helper function for drawing rects. It performs a geometry src push and po p
339 * and thus will finalize any reserved geometry. 339 * and thus will finalize any reserved geometry.
340 * 340 *
341 * @param rect the rect to draw 341 * @param rect the rect to draw
342 * @param matrix optional matrix applied to rect (before viewMatrix) 342 * @param matrix optional matrix applied to rect (before viewMatrix)
343 * @param localRect optional rect that specifies local coords to map onto 343 * @param localRect optional rect that specifies local coords to map onto
344 * rect. If NULL then rect serves as the local coords. 344 * rect. If NULL then rect serves as the local coords.
345 * @param localMatrix optional matrix applied to localRect. If 345 * @param localMatrix optional matrix applied to localRect. If
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 * is intended to give an application some recourse when resources are low. 448 * is intended to give an application some recourse when resources are low.
449 */ 449 */
450 virtual void purgeResources() {}; 450 virtual void purgeResources() {};
451 451
452 /** 452 /**
453 * For subclass internal use to invoke a call to onDraw(). See DrawInfo belo w. 453 * For subclass internal use to invoke a call to onDraw(). See DrawInfo belo w.
454 */ 454 */
455 void executeDraw(const DrawInfo& info) { this->onDraw(info); } 455 void executeDraw(const DrawInfo& info) { this->onDraw(info); }
456 456
457 /** 457 /**
458 * For subclass internal use to invoke a call to onFillPath(). 458 * For subclass internal use to invoke a call to onDrawPath().
459 */ 459 */
460 void executeFillPath(const GrPath* path, const SkStrokeRec& stroke, 460 void executeDrawPath(const GrPath* path, SkPath::FillType fill,
461 SkPath::FillType fill, const GrDeviceCoordTexture* dstC opy) { 461 const GrDeviceCoordTexture* dstCopy) {
462 this->onFillPath(path, stroke, fill, dstCopy); 462 this->onDrawPath(path, fill, dstCopy);
463 } 463 }
464 464
465 //////////////////////////////////////////////////////////////////////////// 465 ////////////////////////////////////////////////////////////////////////////
466 466
467 /** 467 /**
468 * See AutoStateRestore below. 468 * See AutoStateRestore below.
469 */ 469 */
470 enum ASRInit { 470 enum ASRInit {
471 kPreserve_ASRInit, 471 kPreserve_ASRInit,
472 kReset_ASRInit 472 kReset_ASRInit
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 // Implementation of drawRect. The geometry src and vertex attribs will alre ady 831 // Implementation of drawRect. The geometry src and vertex attribs will alre ady
832 // be saved before this is called and restored afterwards. A subclass may ov erride 832 // be saved before this is called and restored afterwards. A subclass may ov erride
833 // this to perform more optimal rect rendering. Its draws should be funneled through 833 // this to perform more optimal rect rendering. Its draws should be funneled through
834 // one of the public GrDrawTarget draw methods (e.g. drawNonIndexed, 834 // one of the public GrDrawTarget draw methods (e.g. drawNonIndexed,
835 // drawIndexedInstances, ...). The base class draws a two triangle fan using 835 // drawIndexedInstances, ...). The base class draws a two triangle fan using
836 // drawNonIndexed from reserved vertex space. 836 // drawNonIndexed from reserved vertex space.
837 virtual void onDrawRect(const SkRect& rect, 837 virtual void onDrawRect(const SkRect& rect,
838 const SkMatrix* matrix, 838 const SkMatrix* matrix,
839 const SkRect* localRect, 839 const SkRect* localRect,
840 const SkMatrix* localMatrix); 840 const SkMatrix* localMatrix);
841 virtual void onStencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath: :FillType fill) = 0; 841
842 virtual void onFillPath(const GrPath*, const SkStrokeRec& stroke, SkPath::Fi llType fill, 842 virtual void onStencilPath(const GrPath*, SkPath::FillType) = 0;
843 virtual void onDrawPath(const GrPath*, SkPath::FillType,
843 const GrDeviceCoordTexture* dstCopy) = 0; 844 const GrDeviceCoordTexture* dstCopy) = 0;
844 845
845 // helpers for reserving vertex and index space. 846 // helpers for reserving vertex and index space.
846 bool reserveVertexSpace(size_t vertexSize, 847 bool reserveVertexSpace(size_t vertexSize,
847 int vertexCount, 848 int vertexCount,
848 void** vertices); 849 void** vertices);
849 bool reserveIndexSpace(int indexCount, void** indices); 850 bool reserveIndexSpace(int indexCount, void** indices);
850 851
851 // called by drawIndexed and drawNonIndexed. Use a negative indexCount to 852 // called by drawIndexed and drawNonIndexed. Use a negative indexCount to
852 // indicate non-indexed drawing. 853 // indicate non-indexed drawing.
(...skipping 21 matching lines...) Expand all
874 const GrClipData* fClip; 875 const GrClipData* fClip;
875 GrDrawState* fDrawState; 876 GrDrawState* fDrawState;
876 GrDrawState fDefaultDraw State; 877 GrDrawState fDefaultDraw State;
877 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get. 878 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get.
878 GrContext* fContext; 879 GrContext* fContext;
879 880
880 typedef SkRefCnt INHERITED; 881 typedef SkRefCnt INHERITED;
881 }; 882 };
882 883
883 #endif 884 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698