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

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

Issue 209413006: Make it possible to draw multiple paths at once to a draw target (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address review comment Created 6 years, 8 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 | « 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
11 #include "GrClipData.h" 11 #include "GrClipData.h"
12 #include "GrDrawState.h" 12 #include "GrDrawState.h"
13 #include "GrIndexBuffer.h" 13 #include "GrIndexBuffer.h"
14 14
15 #include "SkClipStack.h" 15 #include "SkClipStack.h"
16 #include "SkMatrix.h" 16 #include "SkMatrix.h"
17 #include "SkPath.h" 17 #include "SkPath.h"
18 #include "SkStrokeRec.h"
18 #include "SkTArray.h" 19 #include "SkTArray.h"
19 #include "SkTLazy.h" 20 #include "SkTLazy.h"
20 #include "SkTypes.h" 21 #include "SkTypes.h"
21 #include "SkXfermode.h" 22 #include "SkXfermode.h"
22 23
23 class GrClipData; 24 class GrClipData;
24 class GrDrawTargetCaps; 25 class GrDrawTargetCaps;
25 class GrPath; 26 class GrPath;
26 class GrVertexBuffer; 27 class GrVertexBuffer;
27 class SkStrokeRec;
28 28
29 class GrDrawTarget : public SkRefCnt { 29 class GrDrawTarget : public SkRefCnt {
30 protected: 30 protected:
31 class DrawInfo; 31 class DrawInfo;
32 32
33 public: 33 public:
34 SK_DECLARE_INST_COUNT(GrDrawTarget) 34 SK_DECLARE_INST_COUNT(GrDrawTarget)
35 35
36 /////////////////////////////////////////////////////////////////////////// 36 ///////////////////////////////////////////////////////////////////////////
37 37
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 */ 337 */
338 void stencilPath(const GrPath*, SkPath::FillType fill); 338 void stencilPath(const GrPath*, SkPath::FillType fill);
339 339
340 /** 340 /**
341 * Draws a path. Fill must not be a hairline. It will respect the HW 341 * Draws a path. Fill must not be a hairline. It will respect the HW
342 * antialias flag on the draw state (if possible in the 3D API). 342 * antialias flag on the draw state (if possible in the 3D API).
343 */ 343 */
344 void drawPath(const GrPath*, SkPath::FillType fill); 344 void drawPath(const GrPath*, SkPath::FillType fill);
345 345
346 /** 346 /**
347 * Draws many paths. It will respect the HW
348 * antialias flag on the draw state (if possible in the 3D API).
349 *
350 * @param transforms array of 2d affine transformations, one for each path.
351 * @param fill the fill type for drawing all the paths. Fill must not be a
352 * hairline.
353 * @param stroke the stroke for drawing all the paths.
354 */
355 void drawPaths(size_t pathCount, const GrPath** paths,
356 const SkMatrix* transforms, SkPath::FillType fill,
357 SkStrokeRec::Style stroke);
358
359 /**
347 * Helper function for drawing rects. It performs a geometry src push and po p 360 * Helper function for drawing rects. It performs a geometry src push and po p
348 * and thus will finalize any reserved geometry. 361 * and thus will finalize any reserved geometry.
349 * 362 *
350 * @param rect the rect to draw 363 * @param rect the rect to draw
351 * @param matrix optional matrix applied to rect (before viewMatrix) 364 * @param matrix optional matrix applied to rect (before viewMatrix)
352 * @param localRect optional rect that specifies local coords to map onto 365 * @param localRect optional rect that specifies local coords to map onto
353 * rect. If NULL then rect serves as the local coords. 366 * rect. If NULL then rect serves as the local coords.
354 * @param localMatrix optional matrix applied to localRect. If 367 * @param localMatrix optional matrix applied to localRect. If
355 * srcRect is non-NULL and srcMatrix is non-NULL 368 * srcRect is non-NULL and srcMatrix is non-NULL
356 * then srcRect will be transformed by srcMatrix. 369 * then srcRect will be transformed by srcMatrix.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 void executeDraw(const DrawInfo& info) { this->onDraw(info); } 493 void executeDraw(const DrawInfo& info) { this->onDraw(info); }
481 494
482 /** 495 /**
483 * For subclass internal use to invoke a call to onDrawPath(). 496 * For subclass internal use to invoke a call to onDrawPath().
484 */ 497 */
485 void executeDrawPath(const GrPath* path, SkPath::FillType fill, 498 void executeDrawPath(const GrPath* path, SkPath::FillType fill,
486 const GrDeviceCoordTexture* dstCopy) { 499 const GrDeviceCoordTexture* dstCopy) {
487 this->onDrawPath(path, fill, dstCopy); 500 this->onDrawPath(path, fill, dstCopy);
488 } 501 }
489 502
503 /**
504 * For subclass internal use to invoke a call to onDrawPaths().
505 */
506 void executeDrawPaths(size_t pathCount, const GrPath** paths,
507 const SkMatrix* transforms, SkPath::FillType fill,
508 SkStrokeRec::Style stroke,
509 const GrDeviceCoordTexture* dstCopy) {
510 this->onDrawPaths(pathCount, paths, transforms, fill, stroke, dstCopy);
511 }
512
490 //////////////////////////////////////////////////////////////////////////// 513 ////////////////////////////////////////////////////////////////////////////
491 514
492 /** 515 /**
493 * See AutoStateRestore below. 516 * See AutoStateRestore below.
494 */ 517 */
495 enum ASRInit { 518 enum ASRInit {
496 kPreserve_ASRInit, 519 kPreserve_ASRInit,
497 kReset_ASRInit 520 kReset_ASRInit
498 }; 521 };
499 522
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 // drawIndexedInstances, ...). The base class draws a two triangle fan using 883 // drawIndexedInstances, ...). The base class draws a two triangle fan using
861 // drawNonIndexed from reserved vertex space. 884 // drawNonIndexed from reserved vertex space.
862 virtual void onDrawRect(const SkRect& rect, 885 virtual void onDrawRect(const SkRect& rect,
863 const SkMatrix* matrix, 886 const SkMatrix* matrix,
864 const SkRect* localRect, 887 const SkRect* localRect,
865 const SkMatrix* localMatrix); 888 const SkMatrix* localMatrix);
866 889
867 virtual void onStencilPath(const GrPath*, SkPath::FillType) = 0; 890 virtual void onStencilPath(const GrPath*, SkPath::FillType) = 0;
868 virtual void onDrawPath(const GrPath*, SkPath::FillType, 891 virtual void onDrawPath(const GrPath*, SkPath::FillType,
869 const GrDeviceCoordTexture* dstCopy) = 0; 892 const GrDeviceCoordTexture* dstCopy) = 0;
893 virtual void onDrawPaths(size_t, const GrPath**, const SkMatrix*,
894 SkPath::FillType, SkStrokeRec::Style,
895 const GrDeviceCoordTexture* dstCopy) = 0;
870 896
871 virtual void onInstantGpuTraceEvent(const char* marker) = 0; 897 virtual void onInstantGpuTraceEvent(const char* marker) = 0;
872 virtual void onPushGpuTraceEvent(const char* marker) = 0; 898 virtual void onPushGpuTraceEvent(const char* marker) = 0;
873 virtual void onPopGpuTraceEvent() = 0; 899 virtual void onPopGpuTraceEvent() = 0;
874 900
875 // helpers for reserving vertex and index space. 901 // helpers for reserving vertex and index space.
876 bool reserveVertexSpace(size_t vertexSize, 902 bool reserveVertexSpace(size_t vertexSize,
877 int vertexCount, 903 int vertexCount,
878 void** vertices); 904 void** vertices);
879 bool reserveIndexSpace(int indexCount, void** indices); 905 bool reserveIndexSpace(int indexCount, void** indices);
(...skipping 26 matching lines...) Expand all
906 GrDrawState fDefaultDraw State; 932 GrDrawState fDefaultDraw State;
907 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get. 933 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get.
908 GrContext* fContext; 934 GrContext* fContext;
909 // To keep track that we always have at least as many debug marker pushes as pops 935 // To keep track that we always have at least as many debug marker pushes as pops
910 int fPushGpuTrac eCount; 936 int fPushGpuTrac eCount;
911 937
912 typedef SkRefCnt INHERITED; 938 typedef SkRefCnt INHERITED;
913 }; 939 };
914 940
915 #endif 941 #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