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

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

Issue 687563008: Beginning to refactor nvpr code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 6 years, 1 month 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
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 * not a request for clipping. 308 * not a request for clipping.
309 */ 309 */
310 void drawNonIndexed(GrPrimitiveType type, 310 void drawNonIndexed(GrPrimitiveType type,
311 int startVertex, 311 int startVertex,
312 int vertexCount, 312 int vertexCount,
313 const SkRect* devBounds = NULL); 313 const SkRect* devBounds = NULL);
314 314
315 /** 315 /**
316 * Draws path into the stencil buffer. The fill must be either even/odd or 316 * Draws path into the stencil buffer. The fill must be either even/odd or
317 * winding (not inverse or hairline). It will respect the HW antialias flag 317 * winding (not inverse or hairline). It will respect the HW antialias flag
318 * on the draw state (if possible in the 3D API). 318 * on the draw state (if possible in the 3D API). Note, we will never have an inverse fill
319 * with stencil path
319 */ 320 */
320 void stencilPath(const GrPath*, SkPath::FillType fill); 321 void stencilPath(const GrPath*, GrPathRendering::FillType fill);
321 322
322 /** 323 /**
323 * Draws a path. Fill must not be a hairline. It will respect the HW 324 * Draws a path. Fill must not be a hairline. It will respect the HW
324 * antialias flag on the draw state (if possible in the 3D API). 325 * antialias flag on the draw state (if possible in the 3D API).
325 */ 326 */
326 void drawPath(const GrPath*, SkPath::FillType fill); 327 void drawPath(const GrPath*, GrPathRendering::FillType fill);
327 328
328 /** 329 /**
329 * Draws many paths. It will respect the HW 330 * Draws many paths. It will respect the HW
330 * antialias flag on the draw state (if possible in the 3D API). 331 * antialias flag on the draw state (if possible in the 3D API).
331 * 332 *
332 * @param pathRange Source of paths to draw from 333 * @param pathRange Source of paths to draw from
333 * @param indices Array of indices into the the pathRange 334 * @param indices Array of indices into the the pathRange
334 * @param count Number of paths to draw (length of indices array) 335 * @param count Number of paths to draw (length of indices array)
335 * @param transforms Array of individual transforms, one for each path 336 * @param transforms Array of individual transforms, one for each path
336 * @param transformsType Type of transformations in the array. Array contai ns 337 * @param transformsType Type of transformations in the array. Array contai ns
337 PathTransformSize(transformsType) * count elements 338 PathTransformSize(transformsType) * count elements
338 * @param fill Fill type for drawing all the paths 339 * @param fill Fill type for drawing all the paths
339 */ 340 */
340 void drawPaths(const GrPathRange* pathRange, 341 void drawPaths(const GrPathRange* pathRange,
341 const uint32_t indices[], int count, 342 const uint32_t indices[], int count,
342 const float transforms[], PathTransformType transformsType, 343 const float transforms[], PathTransformType transformsType,
343 SkPath::FillType fill); 344 GrPathRendering::FillType fill);
344 345
345 /** 346 /**
346 * Helper function for drawing rects. It performs a geometry src push and po p 347 * Helper function for drawing rects. It performs a geometry src push and po p
347 * and thus will finalize any reserved geometry. 348 * and thus will finalize any reserved geometry.
348 * 349 *
349 * @param rect the rect to draw 350 * @param rect the rect to draw
350 * @param localRect optional rect that specifies local coords to map onto 351 * @param localRect optional rect that specifies local coords to map onto
351 * rect. If NULL then rect serves as the local coords. 352 * rect. If NULL then rect serves as the local coords.
352 * @param localMatrix optional matrix applied to localRect. If 353 * @param localMatrix optional matrix applied to localRect. If
353 * srcRect is non-NULL and srcMatrix is non-NULL 354 * srcRect is non-NULL and srcMatrix is non-NULL
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 virtual void purgeResources() {}; 484 virtual void purgeResources() {};
484 485
485 /** 486 /**
486 * For subclass internal use to invoke a call to onDraw(). See DrawInfo belo w. 487 * For subclass internal use to invoke a call to onDraw(). See DrawInfo belo w.
487 */ 488 */
488 void executeDraw(const DrawInfo& info) { this->onDraw(info); } 489 void executeDraw(const DrawInfo& info) { this->onDraw(info); }
489 490
490 /** 491 /**
491 * For subclass internal use to invoke a call to onDrawPath(). 492 * For subclass internal use to invoke a call to onDrawPath().
492 */ 493 */
493 void executeDrawPath(const GrPath* path, SkPath::FillType fill, 494 void executeDrawPath(const GrPath* path, GrPathRendering::FillType fill,
494 const GrDeviceCoordTexture* dstCopy) { 495 const GrDeviceCoordTexture* dstCopy) {
495 this->onDrawPath(path, fill, dstCopy); 496 this->onDrawPath(path, fill, dstCopy);
496 } 497 }
497 498
498 /** 499 /**
499 * For subclass internal use to invoke a call to onDrawPaths(). 500 * For subclass internal use to invoke a call to onDrawPaths().
500 */ 501 */
501 void executeDrawPaths(const GrPathRange* pathRange, 502 void executeDrawPaths(const GrPathRange* pathRange,
502 const uint32_t indices[], int count, 503 const uint32_t indices[], int count,
503 const float transforms[], PathTransformType transforms Type, 504 const float transforms[], PathTransformType transforms Type,
504 SkPath::FillType fill, 505 GrPathRendering::FillType fill,
505 const GrDeviceCoordTexture* dstCopy) { 506 const GrDeviceCoordTexture* dstCopy) {
506 this->onDrawPaths(pathRange, indices, count, transforms, transformsType, fill, dstCopy); 507 this->onDrawPaths(pathRange, indices, count, transforms, transformsType, fill, dstCopy);
507 } 508 }
508 509
509 void getPathStencilSettingsForFillType(SkPath::FillType, GrStencilSettings*) ;
510
511 //////////////////////////////////////////////////////////////////////////// 510 ////////////////////////////////////////////////////////////////////////////
512 511
513 /** 512 /**
514 * See AutoStateRestore below. 513 * See AutoStateRestore below.
515 */ 514 */
516 enum ASRInit { 515 enum ASRInit {
517 kPreserve_ASRInit, 516 kPreserve_ASRInit,
518 kReset_ASRInit 517 kReset_ASRInit
519 }; 518 };
520 519
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 // Implementation of drawRect. The geometry src and vertex attribs will alre ady 890 // Implementation of drawRect. The geometry src and vertex attribs will alre ady
892 // be saved before this is called and restored afterwards. A subclass may ov erride 891 // be saved before this is called and restored afterwards. A subclass may ov erride
893 // this to perform more optimal rect rendering. Its draws should be funneled through 892 // this to perform more optimal rect rendering. Its draws should be funneled through
894 // one of the public GrDrawTarget draw methods (e.g. drawNonIndexed, 893 // one of the public GrDrawTarget draw methods (e.g. drawNonIndexed,
895 // drawIndexedInstances, ...). The base class draws a two triangle fan using 894 // drawIndexedInstances, ...). The base class draws a two triangle fan using
896 // drawNonIndexed from reserved vertex space. 895 // drawNonIndexed from reserved vertex space.
897 virtual void onDrawRect(const SkRect& rect, 896 virtual void onDrawRect(const SkRect& rect,
898 const SkRect* localRect, 897 const SkRect* localRect,
899 const SkMatrix* localMatrix); 898 const SkMatrix* localMatrix);
900 899
901 virtual void onStencilPath(const GrPath*, SkPath::FillType) = 0; 900 virtual void onStencilPath(const GrPath*, GrPathRendering::FillType) = 0;
902 virtual void onDrawPath(const GrPath*, SkPath::FillType, 901 virtual void onDrawPath(const GrPath*, GrPathRendering::FillType,
903 const GrDeviceCoordTexture* dstCopy) = 0; 902 const GrDeviceCoordTexture* dstCopy) = 0;
904 virtual void onDrawPaths(const GrPathRange*, 903 virtual void onDrawPaths(const GrPathRange*,
905 const uint32_t indices[], int count, 904 const uint32_t indices[], int count,
906 const float transforms[], PathTransformType, 905 const float transforms[], PathTransformType,
907 SkPath::FillType, const GrDeviceCoordTexture*) = 0; 906 GrPathRendering::FillType, const GrDeviceCoordTextu re*) = 0;
908 907
909 virtual void didAddGpuTraceMarker() = 0; 908 virtual void didAddGpuTraceMarker() = 0;
910 virtual void didRemoveGpuTraceMarker() = 0; 909 virtual void didRemoveGpuTraceMarker() = 0;
911 910
912 // helpers for reserving vertex and index space. 911 // helpers for reserving vertex and index space.
913 bool reserveVertexSpace(size_t vertexSize, 912 bool reserveVertexSpace(size_t vertexSize,
914 int vertexCount, 913 int vertexCount,
915 void** vertices); 914 void** vertices);
916 bool reserveIndexSpace(int indexCount, void** indices); 915 bool reserveIndexSpace(int indexCount, void** indices);
917 916
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 protected: 980 protected:
982 GrClipMaskManager fClipMaskManager; 981 GrClipMaskManager fClipMaskManager;
983 982
984 private: 983 private:
985 GrClipMaskManager* getClipMaskManager() { return &fClipMaskManager; } 984 GrClipMaskManager* getClipMaskManager() { return &fClipMaskManager; }
986 985
987 typedef GrDrawTarget INHERITED; 986 typedef GrDrawTarget INHERITED;
988 }; 987 };
989 988
990 #endif 989 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698