OLD | NEW |
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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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). |
319 */ | 319 */ |
320 void stencilPath(const GrPath*, SkPath::FillType fill); | 320 void stencilPath(const GrPath*, GrPathRendering::FillType fill); |
321 | 321 |
322 /** | 322 /** |
323 * Draws a path. Fill must not be a hairline. It will respect the HW | 323 * 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). | 324 * antialias flag on the draw state (if possible in the 3D API). |
325 */ | 325 */ |
326 void drawPath(const GrPath*, SkPath::FillType fill); | 326 void drawPath(const GrPath*, GrPathRendering::FillType fill); |
327 | 327 |
328 /** | 328 /** |
329 * Draws many paths. It will respect the HW | 329 * Draws many paths. It will respect the HW |
330 * antialias flag on the draw state (if possible in the 3D API). | 330 * antialias flag on the draw state (if possible in the 3D API). |
331 * | 331 * |
332 * @param pathRange Source of paths to draw from | 332 * @param pathRange Source of paths to draw from |
333 * @param indices Array of indices into the the pathRange | 333 * @param indices Array of indices into the the pathRange |
334 * @param count Number of paths to draw (length of indices array) | 334 * @param count Number of paths to draw (length of indices array) |
335 * @param transforms Array of individual transforms, one for each path | 335 * @param transforms Array of individual transforms, one for each path |
336 * @param transformsType Type of transformations in the array. Array contai
ns | 336 * @param transformsType Type of transformations in the array. Array contai
ns |
337 PathTransformSize(transformsType) * count elements | 337 PathTransformSize(transformsType) * count elements |
338 * @param fill Fill type for drawing all the paths | 338 * @param fill Fill type for drawing all the paths |
339 */ | 339 */ |
340 void drawPaths(const GrPathRange* pathRange, | 340 void drawPaths(const GrPathRange* pathRange, |
341 const uint32_t indices[], int count, | 341 const uint32_t indices[], int count, |
342 const float transforms[], PathTransformType transformsType, | 342 const float transforms[], PathTransformType transformsType, |
343 SkPath::FillType fill); | 343 GrPathRendering::FillType fill); |
344 | 344 |
345 /** | 345 /** |
346 * Helper function for drawing rects. It performs a geometry src push and po
p | 346 * Helper function for drawing rects. It performs a geometry src push and po
p |
347 * and thus will finalize any reserved geometry. | 347 * and thus will finalize any reserved geometry. |
348 * | 348 * |
349 * @param rect the rect to draw | 349 * @param rect the rect to draw |
350 * @param localRect optional rect that specifies local coords to map onto | 350 * @param localRect optional rect that specifies local coords to map onto |
351 * rect. If NULL then rect serves as the local coords. | 351 * rect. If NULL then rect serves as the local coords. |
352 * @param localMatrix optional matrix applied to localRect. If | 352 * @param localMatrix optional matrix applied to localRect. If |
353 * srcRect is non-NULL and srcMatrix is non-NULL | 353 * srcRect is non-NULL and srcMatrix is non-NULL |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 virtual void purgeResources() {}; | 483 virtual void purgeResources() {}; |
484 | 484 |
485 /** | 485 /** |
486 * For subclass internal use to invoke a call to onDraw(). See DrawInfo belo
w. | 486 * For subclass internal use to invoke a call to onDraw(). See DrawInfo belo
w. |
487 */ | 487 */ |
488 void executeDraw(const DrawInfo& info) { this->onDraw(info); } | 488 void executeDraw(const DrawInfo& info) { this->onDraw(info); } |
489 | 489 |
490 /** | 490 /** |
491 * For subclass internal use to invoke a call to onDrawPath(). | 491 * For subclass internal use to invoke a call to onDrawPath(). |
492 */ | 492 */ |
493 void executeDrawPath(const GrPath* path, SkPath::FillType fill, | 493 void executeDrawPath(const GrPath* path, GrPathRendering::FillType fill, |
494 const GrDeviceCoordTexture* dstCopy) { | 494 const GrDeviceCoordTexture* dstCopy) { |
495 this->onDrawPath(path, fill, dstCopy); | 495 this->onDrawPath(path, fill, dstCopy); |
496 } | 496 } |
497 | 497 |
498 /** | 498 /** |
499 * For subclass internal use to invoke a call to onDrawPaths(). | 499 * For subclass internal use to invoke a call to onDrawPaths(). |
500 */ | 500 */ |
501 void executeDrawPaths(const GrPathRange* pathRange, | 501 void executeDrawPaths(const GrPathRange* pathRange, |
502 const uint32_t indices[], int count, | 502 const uint32_t indices[], int count, |
503 const float transforms[], PathTransformType transforms
Type, | 503 const float transforms[], PathTransformType transforms
Type, |
504 SkPath::FillType fill, | 504 GrPathRendering::FillType fill, |
505 const GrDeviceCoordTexture* dstCopy) { | 505 const GrDeviceCoordTexture* dstCopy) { |
506 this->onDrawPaths(pathRange, indices, count, transforms, transformsType,
fill, dstCopy); | 506 this->onDrawPaths(pathRange, indices, count, transforms, transformsType,
fill, dstCopy); |
507 } | 507 } |
508 | 508 |
509 void getPathStencilSettingsForFillType(SkPath::FillType, GrStencilSettings*)
; | |
510 | |
511 //////////////////////////////////////////////////////////////////////////// | 509 //////////////////////////////////////////////////////////////////////////// |
512 | 510 |
513 /** | 511 /** |
514 * See AutoStateRestore below. | 512 * See AutoStateRestore below. |
515 */ | 513 */ |
516 enum ASRInit { | 514 enum ASRInit { |
517 kPreserve_ASRInit, | 515 kPreserve_ASRInit, |
518 kReset_ASRInit | 516 kReset_ASRInit |
519 }; | 517 }; |
520 | 518 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 // Implementation of drawRect. The geometry src and vertex attribs will alre
ady | 889 // 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 | 890 // 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 | 891 // this to perform more optimal rect rendering. Its draws should be funneled
through |
894 // one of the public GrDrawTarget draw methods (e.g. drawNonIndexed, | 892 // one of the public GrDrawTarget draw methods (e.g. drawNonIndexed, |
895 // drawIndexedInstances, ...). The base class draws a two triangle fan using | 893 // drawIndexedInstances, ...). The base class draws a two triangle fan using |
896 // drawNonIndexed from reserved vertex space. | 894 // drawNonIndexed from reserved vertex space. |
897 virtual void onDrawRect(const SkRect& rect, | 895 virtual void onDrawRect(const SkRect& rect, |
898 const SkRect* localRect, | 896 const SkRect* localRect, |
899 const SkMatrix* localMatrix); | 897 const SkMatrix* localMatrix); |
900 | 898 |
901 virtual void onStencilPath(const GrPath*, SkPath::FillType) = 0; | 899 virtual void onStencilPath(const GrPath*, GrPathRendering::FillType) = 0; |
902 virtual void onDrawPath(const GrPath*, SkPath::FillType, | 900 virtual void onDrawPath(const GrPath*, GrPathRendering::FillType, |
903 const GrDeviceCoordTexture* dstCopy) = 0; | 901 const GrDeviceCoordTexture* dstCopy) = 0; |
904 virtual void onDrawPaths(const GrPathRange*, | 902 virtual void onDrawPaths(const GrPathRange*, |
905 const uint32_t indices[], int count, | 903 const uint32_t indices[], int count, |
906 const float transforms[], PathTransformType, | 904 const float transforms[], PathTransformType, |
907 SkPath::FillType, const GrDeviceCoordTexture*) = 0; | 905 GrPathRendering::FillType, const GrDeviceCoordTextu
re*) = 0; |
908 | 906 |
909 virtual void didAddGpuTraceMarker() = 0; | 907 virtual void didAddGpuTraceMarker() = 0; |
910 virtual void didRemoveGpuTraceMarker() = 0; | 908 virtual void didRemoveGpuTraceMarker() = 0; |
911 | 909 |
912 // helpers for reserving vertex and index space. | 910 // helpers for reserving vertex and index space. |
913 bool reserveVertexSpace(size_t vertexSize, | 911 bool reserveVertexSpace(size_t vertexSize, |
914 int vertexCount, | 912 int vertexCount, |
915 void** vertices); | 913 void** vertices); |
916 bool reserveIndexSpace(int indexCount, void** indices); | 914 bool reserveIndexSpace(int indexCount, void** indices); |
917 | 915 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 protected: | 969 protected: |
972 GrClipMaskManager fClipMaskManager; | 970 GrClipMaskManager fClipMaskManager; |
973 | 971 |
974 private: | 972 private: |
975 GrClipMaskManager* getClipMaskManager() { return &fClipMaskManager; } | 973 GrClipMaskManager* getClipMaskManager() { return &fClipMaskManager; } |
976 | 974 |
977 typedef GrDrawTarget INHERITED; | 975 typedef GrDrawTarget INHERITED; |
978 }; | 976 }; |
979 | 977 |
980 #endif | 978 #endif |
OLD | NEW |