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

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

Issue 400713003: Add a GrPathRange class (Closed) Base URL: https://skia.googlesource.com/skia.git@clupload-ispath
Patch Set: Created 6 years, 5 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
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
11 #include "GrClipData.h" 11 #include "GrClipData.h"
12 #include "GrContext.h" 12 #include "GrContext.h"
13 #include "GrDrawState.h" 13 #include "GrDrawState.h"
14 #include "GrIndexBuffer.h" 14 #include "GrIndexBuffer.h"
15 #include "GrTraceMarker.h" 15 #include "GrTraceMarker.h"
16 16
17 #include "SkClipStack.h" 17 #include "SkClipStack.h"
18 #include "SkMatrix.h" 18 #include "SkMatrix.h"
19 #include "SkPath.h" 19 #include "SkPath.h"
20 #include "SkStrokeRec.h" 20 #include "SkStrokeRec.h"
21 #include "SkTArray.h" 21 #include "SkTArray.h"
22 #include "SkTLazy.h" 22 #include "SkTLazy.h"
23 #include "SkTypes.h" 23 #include "SkTypes.h"
24 #include "SkXfermode.h" 24 #include "SkXfermode.h"
25 25
26 class GrClipData; 26 class GrClipData;
27 class GrDrawTargetCaps; 27 class GrDrawTargetCaps;
28 class GrPath; 28 class GrPath;
29 class GrPathRange;
29 class GrVertexBuffer; 30 class GrVertexBuffer;
30 31
31 class GrDrawTarget : public SkRefCnt { 32 class GrDrawTarget : public SkRefCnt {
32 protected: 33 protected:
33 class DrawInfo; 34 class DrawInfo;
34 35
35 public: 36 public:
36 SK_DECLARE_INST_COUNT(GrDrawTarget) 37 SK_DECLARE_INST_COUNT(GrDrawTarget)
37 38
38 /////////////////////////////////////////////////////////////////////////// 39 ///////////////////////////////////////////////////////////////////////////
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 /** 343 /**
343 * Draws a path. Fill must not be a hairline. It will respect the HW 344 * Draws a path. Fill must not be a hairline. It will respect the HW
344 * antialias flag on the draw state (if possible in the 3D API). 345 * antialias flag on the draw state (if possible in the 3D API).
345 */ 346 */
346 void drawPath(const GrPath*, SkPath::FillType fill); 347 void drawPath(const GrPath*, SkPath::FillType fill);
347 348
348 /** 349 /**
349 * Draws many paths. It will respect the HW 350 * Draws many paths. It will respect the HW
350 * antialias flag on the draw state (if possible in the 3D API). 351 * antialias flag on the draw state (if possible in the 3D API).
351 * 352 *
352 * @param transforms array of 2d affine transformations, one for each path. 353 * @param pathRange Source of paths to draw from, stroke must not be
bsalomon 2014/07/17 17:27:28 Is this comment right or should the hairline text
Chris Dalton 2014/07/17 18:15:19 The old comment wasn't correct, hairline is a stro
353 * @param fill the fill type for drawing all the paths. Fill must not be a 354 * hairline
354 * hairline. 355 * @param indices Array of indices into the the pathRange
355 * @param stroke the stroke for drawing all the paths. 356 * @param count Number of paths to draw (length of indices array)
357 * @param transforms Array of individual transforms, one for each path
358 * @param transformsFormat Format of the transforms array. The array contain s
359 * GrTransformSize(transformsFormat) × count element s
360 * @param fill Fill type for drawing all the paths
356 */ 361 */
357 void drawPaths(int pathCount, const GrPath** paths, 362 void drawPaths(const GrPathRange* pathRange,
358 const SkMatrix* transforms, SkPath::FillType fill, 363 const uint32_t indices[], int count,
359 SkStrokeRec::Style stroke); 364 const float transforms[], GrTransformFormat transformsFormat,
365 SkPath::FillType fill);
360 366
361 /** 367 /**
362 * Helper function for drawing rects. It performs a geometry src push and po p 368 * Helper function for drawing rects. It performs a geometry src push and po p
363 * and thus will finalize any reserved geometry. 369 * and thus will finalize any reserved geometry.
364 * 370 *
365 * @param rect the rect to draw 371 * @param rect the rect to draw
366 * @param matrix optional matrix applied to rect (before viewMatrix) 372 * @param matrix optional matrix applied to rect (before viewMatrix)
367 * @param localRect optional rect that specifies local coords to map onto 373 * @param localRect optional rect that specifies local coords to map onto
368 * rect. If NULL then rect serves as the local coords. 374 * rect. If NULL then rect serves as the local coords.
369 * @param localMatrix optional matrix applied to localRect. If 375 * @param localMatrix optional matrix applied to localRect. If
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 * For subclass internal use to invoke a call to onDrawPath(). 515 * For subclass internal use to invoke a call to onDrawPath().
510 */ 516 */
511 void executeDrawPath(const GrPath* path, SkPath::FillType fill, 517 void executeDrawPath(const GrPath* path, SkPath::FillType fill,
512 const GrDeviceCoordTexture* dstCopy) { 518 const GrDeviceCoordTexture* dstCopy) {
513 this->onDrawPath(path, fill, dstCopy); 519 this->onDrawPath(path, fill, dstCopy);
514 } 520 }
515 521
516 /** 522 /**
517 * For subclass internal use to invoke a call to onDrawPaths(). 523 * For subclass internal use to invoke a call to onDrawPaths().
518 */ 524 */
519 void executeDrawPaths(int pathCount, const GrPath** paths, 525 void executeDrawPaths(const GrPathRange* pathRange,
520 const SkMatrix* transforms, SkPath::FillType fill, 526 const uint32_t indices[], int count,
521 SkStrokeRec::Style stroke, 527 const float transforms[], GrTransformFormat transforms Format,
528 SkPath::FillType fill,
522 const GrDeviceCoordTexture* dstCopy) { 529 const GrDeviceCoordTexture* dstCopy) {
523 this->onDrawPaths(pathCount, paths, transforms, fill, stroke, dstCopy); 530 this->onDrawPaths(pathRange, indices, count, transforms, transformsForma t, fill, dstCopy);
524 } 531 }
525 532
526 inline bool isGpuTracingEnabled() const { 533 inline bool isGpuTracingEnabled() const {
527 return this->getContext()->isGpuTracingEnabled(); 534 return this->getContext()->isGpuTracingEnabled();
528 } 535 }
529 536
530 //////////////////////////////////////////////////////////////////////////// 537 ////////////////////////////////////////////////////////////////////////////
531 538
532 /** 539 /**
533 * See AutoStateRestore below. 540 * See AutoStateRestore below.
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 // drawIndexedInstances, ...). The base class draws a two triangle fan using 909 // drawIndexedInstances, ...). The base class draws a two triangle fan using
903 // drawNonIndexed from reserved vertex space. 910 // drawNonIndexed from reserved vertex space.
904 virtual void onDrawRect(const SkRect& rect, 911 virtual void onDrawRect(const SkRect& rect,
905 const SkMatrix* matrix, 912 const SkMatrix* matrix,
906 const SkRect* localRect, 913 const SkRect* localRect,
907 const SkMatrix* localMatrix); 914 const SkMatrix* localMatrix);
908 915
909 virtual void onStencilPath(const GrPath*, SkPath::FillType) = 0; 916 virtual void onStencilPath(const GrPath*, SkPath::FillType) = 0;
910 virtual void onDrawPath(const GrPath*, SkPath::FillType, 917 virtual void onDrawPath(const GrPath*, SkPath::FillType,
911 const GrDeviceCoordTexture* dstCopy) = 0; 918 const GrDeviceCoordTexture* dstCopy) = 0;
912 virtual void onDrawPaths(int, const GrPath**, const SkMatrix*, 919 virtual void onDrawPaths(const GrPathRange*,
913 SkPath::FillType, SkStrokeRec::Style, 920 const uint32_t indices[], int count,
914 const GrDeviceCoordTexture* dstCopy) = 0; 921 const float transforms[], GrTransformFormat,
922 SkPath::FillType, const GrDeviceCoordTexture*) = 0;
915 923
916 virtual void didAddGpuTraceMarker() = 0; 924 virtual void didAddGpuTraceMarker() = 0;
917 virtual void didRemoveGpuTraceMarker() = 0; 925 virtual void didRemoveGpuTraceMarker() = 0;
918 926
919 // helpers for reserving vertex and index space. 927 // helpers for reserving vertex and index space.
920 bool reserveVertexSpace(size_t vertexSize, 928 bool reserveVertexSpace(size_t vertexSize,
921 int vertexCount, 929 int vertexCount,
922 void** vertices); 930 void** vertices);
923 bool reserveIndexSpace(int indexCount, void** indices); 931 bool reserveIndexSpace(int indexCount, void** indices);
924 932
(...skipping 27 matching lines...) Expand all
952 GrContext* fContext; 960 GrContext* fContext;
953 // To keep track that we always have at least as many debug marker adds as r emoves 961 // To keep track that we always have at least as many debug marker adds as r emoves
954 int fGpuTraceMar kerCount; 962 int fGpuTraceMar kerCount;
955 GrTraceMarkerSet fActiveTrace Markers; 963 GrTraceMarkerSet fActiveTrace Markers;
956 GrTraceMarkerSet fStoredTrace Markers; 964 GrTraceMarkerSet fStoredTrace Markers;
957 965
958 typedef SkRefCnt INHERITED; 966 typedef SkRefCnt INHERITED;
959 }; 967 };
960 968
961 #endif 969 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698