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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 default: | 381 default: |
382 SkFAIL("Unknown path transform type"); | 382 SkFAIL("Unknown path transform type"); |
383 return 0; | 383 return 0; |
384 } | 384 } |
385 } | 385 } |
386 | 386 |
387 /** | 387 /** |
388 * Helper function for drawing rects. It performs a geometry src push and po p | 388 * Helper function for drawing rects. It performs a geometry src push and po p |
389 * and thus will finalize any reserved geometry. | 389 * and thus will finalize any reserved geometry. |
390 * | 390 * |
391 * @param rect the rect to draw | 391 * @param rect the rect to draw |
robertphillips
2014/08/04 15:29:16
Remove this @param ?
bsalomon
2014/08/05 14:04:55
Done.
| |
392 * @param matrix optional matrix applied to rect (before viewMatrix) | 392 * @param matrix optional matrix applied to rect (before viewMatrix) |
393 * @param localRect optional rect that specifies local coords to map onto | 393 * @param localRect optional rect that specifies local coords to map onto |
394 * rect. If NULL then rect serves as the local coords. | 394 * rect. If NULL then rect serves as the local coords. |
395 * @param localMatrix optional matrix applied to localRect. If | 395 * @param localMatrix optional matrix applied to localRect. If |
396 * srcRect is non-NULL and srcMatrix is non-NULL | 396 * srcRect is non-NULL and srcMatrix is non-NULL |
397 * then srcRect will be transformed by srcMatrix. | 397 * then srcRect will be transformed by srcMatrix. |
398 * srcMatrix can be NULL when no srcMatrix is desired. | 398 * srcMatrix can be NULL when no srcMatrix is desired. |
399 */ | 399 */ |
400 void drawRect(const SkRect& rect, | 400 void drawRect(const SkRect& rect, |
401 const SkMatrix* matrix, | |
402 const SkRect* localRect, | 401 const SkRect* localRect, |
403 const SkMatrix* localMatrix) { | 402 const SkMatrix* localMatrix) { |
404 AutoGeometryPush agp(this); | 403 AutoGeometryPush agp(this); |
405 this->onDrawRect(rect, matrix, localRect, localMatrix); | 404 this->onDrawRect(rect, localRect, localMatrix); |
406 } | 405 } |
407 | 406 |
408 /** | 407 /** |
409 * Helper for drawRect when the caller doesn't need separate local rects or matrices. | 408 * Helper for drawRect when the caller doesn't need separate local rects or matrices. |
410 */ | 409 */ |
411 void drawSimpleRect(const SkRect& rect, const SkMatrix* matrix = NULL) { | 410 void drawSimpleRect(const SkRect& rect) { |
412 this->drawRect(rect, matrix, NULL, NULL); | 411 this->drawRect(rect, NULL, NULL); |
413 } | 412 } |
414 void drawSimpleRect(const SkIRect& irect, const SkMatrix* matrix = NULL) { | 413 void drawSimpleRect(const SkIRect& irect) { |
415 SkRect rect = SkRect::Make(irect); | 414 SkRect rect = SkRect::Make(irect); |
416 this->drawRect(rect, matrix, NULL, NULL); | 415 this->drawRect(rect, NULL, NULL); |
417 } | 416 } |
418 | 417 |
419 /** | 418 /** |
420 * This call is used to draw multiple instances of some geometry with a | 419 * This call is used to draw multiple instances of some geometry with a |
421 * given number of vertices (V) and indices (I) per-instance. The indices in | 420 * given number of vertices (V) and indices (I) per-instance. The indices in |
422 * the index source must have the form i[k+I] == i[k] + V. Also, all indices | 421 * the index source must have the form i[k+I] == i[k] + V. Also, all indices |
423 * i[kI] ... i[(k+1)I-1] must be elements of the range kV ... (k+1)V-1. As a | 422 * i[kI] ... i[(k+1)I-1] must be elements of the range kV ... (k+1)V-1. As a |
424 * concrete example, the following index buffer for drawing a series of | 423 * concrete example, the following index buffer for drawing a series of |
425 * quads each as two triangles each satisfies these conditions with V=4 and | 424 * quads each as two triangles each satisfies these conditions with V=4 and |
426 * I=6: | 425 * I=6: |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
922 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) = 0; | 921 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) = 0; |
923 // subclass called to perform drawing | 922 // subclass called to perform drawing |
924 virtual void onDraw(const DrawInfo&) = 0; | 923 virtual void onDraw(const DrawInfo&) = 0; |
925 // Implementation of drawRect. The geometry src and vertex attribs will alre ady | 924 // Implementation of drawRect. The geometry src and vertex attribs will alre ady |
926 // be saved before this is called and restored afterwards. A subclass may ov erride | 925 // be saved before this is called and restored afterwards. A subclass may ov erride |
927 // this to perform more optimal rect rendering. Its draws should be funneled through | 926 // this to perform more optimal rect rendering. Its draws should be funneled through |
928 // one of the public GrDrawTarget draw methods (e.g. drawNonIndexed, | 927 // one of the public GrDrawTarget draw methods (e.g. drawNonIndexed, |
929 // drawIndexedInstances, ...). The base class draws a two triangle fan using | 928 // drawIndexedInstances, ...). The base class draws a two triangle fan using |
930 // drawNonIndexed from reserved vertex space. | 929 // drawNonIndexed from reserved vertex space. |
931 virtual void onDrawRect(const SkRect& rect, | 930 virtual void onDrawRect(const SkRect& rect, |
932 const SkMatrix* matrix, | |
933 const SkRect* localRect, | 931 const SkRect* localRect, |
934 const SkMatrix* localMatrix); | 932 const SkMatrix* localMatrix); |
935 | 933 |
936 virtual void onStencilPath(const GrPath*, SkPath::FillType) = 0; | 934 virtual void onStencilPath(const GrPath*, SkPath::FillType) = 0; |
937 virtual void onDrawPath(const GrPath*, SkPath::FillType, | 935 virtual void onDrawPath(const GrPath*, SkPath::FillType, |
938 const GrDeviceCoordTexture* dstCopy) = 0; | 936 const GrDeviceCoordTexture* dstCopy) = 0; |
939 virtual void onDrawPaths(const GrPathRange*, | 937 virtual void onDrawPaths(const GrPathRange*, |
940 const uint32_t indices[], int count, | 938 const uint32_t indices[], int count, |
941 const float transforms[], PathTransformType, | 939 const float transforms[], PathTransformType, |
942 SkPath::FillType, const GrDeviceCoordTexture*) = 0; | 940 SkPath::FillType, const GrDeviceCoordTexture*) = 0; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
980 GrContext* fContext; | 978 GrContext* fContext; |
981 // To keep track that we always have at least as many debug marker adds as r emoves | 979 // To keep track that we always have at least as many debug marker adds as r emoves |
982 int fGpuTraceMar kerCount; | 980 int fGpuTraceMar kerCount; |
983 GrTraceMarkerSet fActiveTrace Markers; | 981 GrTraceMarkerSet fActiveTrace Markers; |
984 GrTraceMarkerSet fStoredTrace Markers; | 982 GrTraceMarkerSet fStoredTrace Markers; |
985 | 983 |
986 typedef SkRefCnt INHERITED; | 984 typedef SkRefCnt INHERITED; |
987 }; | 985 }; |
988 | 986 |
989 #endif | 987 #endif |
OLD | NEW |