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 |
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 "GrPathRendering.h" |
15 #include "GrTraceMarker.h" | 16 #include "GrTraceMarker.h" |
16 | 17 |
17 #include "SkClipStack.h" | 18 #include "SkClipStack.h" |
18 #include "SkMatrix.h" | 19 #include "SkMatrix.h" |
19 #include "SkPath.h" | 20 #include "SkPath.h" |
20 #include "SkStrokeRec.h" | 21 #include "SkStrokeRec.h" |
21 #include "SkTArray.h" | 22 #include "SkTArray.h" |
22 #include "SkTLazy.h" | 23 #include "SkTLazy.h" |
23 #include "SkTypes.h" | 24 #include "SkTypes.h" |
24 #include "SkXfermode.h" | 25 #include "SkXfermode.h" |
25 | 26 |
26 class GrClipData; | 27 class GrClipData; |
27 class GrDrawTargetCaps; | 28 class GrDrawTargetCaps; |
28 class GrPath; | 29 class GrPath; |
29 class GrPathRange; | 30 class GrPathRange; |
30 class GrVertexBuffer; | 31 class GrVertexBuffer; |
31 | 32 |
32 class GrDrawTarget : public SkRefCnt { | 33 class GrDrawTarget : public SkRefCnt { |
33 protected: | 34 protected: |
34 class DrawInfo; | 35 class DrawInfo; |
35 | 36 |
36 public: | 37 public: |
37 SK_DECLARE_INST_COUNT(GrDrawTarget) | 38 SK_DECLARE_INST_COUNT(GrDrawTarget) |
38 | 39 |
| 40 |
| 41 typedef GrPathRendering::PathTransformType PathTransformType ; |
| 42 |
39 /////////////////////////////////////////////////////////////////////////// | 43 /////////////////////////////////////////////////////////////////////////// |
40 | 44 |
41 // The context may not be fully constructed and should not be used during Gr
DrawTarget | 45 // The context may not be fully constructed and should not be used during Gr
DrawTarget |
42 // construction. | 46 // construction. |
43 GrDrawTarget(GrContext* context); | 47 GrDrawTarget(GrContext* context); |
44 virtual ~GrDrawTarget(); | 48 virtual ~GrDrawTarget(); |
45 | 49 |
46 /** | 50 /** |
47 * Gets the capabilities of the draw target. | 51 * Gets the capabilities of the draw target. |
48 */ | 52 */ |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 * antialias flag on the draw state (if possible in the 3D API). | 349 * antialias flag on the draw state (if possible in the 3D API). |
346 * | 350 * |
347 * @param pathRange Source of paths to draw from | 351 * @param pathRange Source of paths to draw from |
348 * @param indices Array of indices into the the pathRange | 352 * @param indices Array of indices into the the pathRange |
349 * @param count Number of paths to draw (length of indices array) | 353 * @param count Number of paths to draw (length of indices array) |
350 * @param transforms Array of individual transforms, one for each path | 354 * @param transforms Array of individual transforms, one for each path |
351 * @param transformsType Type of transformations in the array. Array contai
ns | 355 * @param transformsType Type of transformations in the array. Array contai
ns |
352 PathTransformSize(transformsType) × count elements | 356 PathTransformSize(transformsType) × count elements |
353 * @param fill Fill type for drawing all the paths | 357 * @param fill Fill type for drawing all the paths |
354 */ | 358 */ |
355 enum PathTransformType { | |
356 kNone_PathTransformType, //!< [] | |
357 kTranslateX_PathTransformType, //!< [kMTransX] | |
358 kTranslateY_PathTransformType, //!< [kMTransY] | |
359 kTranslate_PathTransformType, //!< [kMTransX, kMTransY] | |
360 kAffine_PathTransformType, //!< [kMScaleX, kMSkewX, kMTransX, kMSke
wY, kMScaleY, kMTransY] | |
361 | |
362 kLast_PathTransformType = kAffine_PathTransformType | |
363 }; | |
364 void drawPaths(const GrPathRange* pathRange, | 359 void drawPaths(const GrPathRange* pathRange, |
365 const uint32_t indices[], int count, | 360 const uint32_t indices[], int count, |
366 const float transforms[], PathTransformType transformsType, | 361 const float transforms[], PathTransformType transformsType, |
367 SkPath::FillType fill); | 362 SkPath::FillType fill); |
368 | 363 |
369 static inline int PathTransformSize(PathTransformType type) { | |
370 switch (type) { | |
371 case kNone_PathTransformType: | |
372 return 0; | |
373 case kTranslateX_PathTransformType: | |
374 case kTranslateY_PathTransformType: | |
375 return 1; | |
376 case kTranslate_PathTransformType: | |
377 return 2; | |
378 case kAffine_PathTransformType: | |
379 return 6; | |
380 | |
381 default: | |
382 SkFAIL("Unknown path transform type"); | |
383 return 0; | |
384 } | |
385 } | |
386 | |
387 /** | 364 /** |
388 * Helper function for drawing rects. It performs a geometry src push and po
p | 365 * Helper function for drawing rects. It performs a geometry src push and po
p |
389 * and thus will finalize any reserved geometry. | 366 * and thus will finalize any reserved geometry. |
390 * | 367 * |
391 * @param rect the rect to draw | 368 * @param rect the rect to draw |
392 * @param localRect optional rect that specifies local coords to map onto | 369 * @param localRect optional rect that specifies local coords to map onto |
393 * rect. If NULL then rect serves as the local coords. | 370 * rect. If NULL then rect serves as the local coords. |
394 * @param localMatrix optional matrix applied to localRect. If | 371 * @param localMatrix optional matrix applied to localRect. If |
395 * srcRect is non-NULL and srcMatrix is non-NULL | 372 * srcRect is non-NULL and srcMatrix is non-NULL |
396 * then srcRect will be transformed by srcMatrix. | 373 * then srcRect will be transformed by srcMatrix. |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 GrContext* fContext; | 949 GrContext* fContext; |
973 // To keep track that we always have at least as many debug marker adds as r
emoves | 950 // To keep track that we always have at least as many debug marker adds as r
emoves |
974 int fGpuTraceMar
kerCount; | 951 int fGpuTraceMar
kerCount; |
975 GrTraceMarkerSet fActiveTrace
Markers; | 952 GrTraceMarkerSet fActiveTrace
Markers; |
976 GrTraceMarkerSet fStoredTrace
Markers; | 953 GrTraceMarkerSet fStoredTrace
Markers; |
977 | 954 |
978 typedef SkRefCnt INHERITED; | 955 typedef SkRefCnt INHERITED; |
979 }; | 956 }; |
980 | 957 |
981 #endif | 958 #endif |
OLD | NEW |