| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 * 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). |
| 327 * | 331 * |
| 328 * @param pathRange Source of paths to draw from | 332 * @param pathRange Source of paths to draw from |
| 329 * @param indices Array of indices into the the pathRange | 333 * @param indices Array of indices into the the pathRange |
| 330 * @param count Number of paths to draw (length of indices array) | 334 * @param count Number of paths to draw (length of indices array) |
| 331 * @param transforms Array of individual transforms, one for each path | 335 * @param transforms Array of individual transforms, one for each path |
| 332 * @param transformsType Type of transformations in the array. Array contai
ns | 336 * @param transformsType Type of transformations in the array. Array contai
ns |
| 333 PathTransformSize(transformsType) * count elements | 337 PathTransformSize(transformsType) * count elements |
| 334 * @param fill Fill type for drawing all the paths | 338 * @param fill Fill type for drawing all the paths |
| 335 */ | 339 */ |
| 336 enum PathTransformType { | |
| 337 kNone_PathTransformType, //!< [] | |
| 338 kTranslateX_PathTransformType, //!< [kMTransX] | |
| 339 kTranslateY_PathTransformType, //!< [kMTransY] | |
| 340 kTranslate_PathTransformType, //!< [kMTransX, kMTransY] | |
| 341 kAffine_PathTransformType, //!< [kMScaleX, kMSkewX, kMTransX, kMSke
wY, kMScaleY, kMTransY] | |
| 342 | |
| 343 kLast_PathTransformType = kAffine_PathTransformType | |
| 344 }; | |
| 345 void drawPaths(const GrPathRange* pathRange, | 340 void drawPaths(const GrPathRange* pathRange, |
| 346 const uint32_t indices[], int count, | 341 const uint32_t indices[], int count, |
| 347 const float transforms[], PathTransformType transformsType, | 342 const float transforms[], PathTransformType transformsType, |
| 348 SkPath::FillType fill); | 343 SkPath::FillType fill); |
| 349 | 344 |
| 350 static inline int PathTransformSize(PathTransformType type) { | |
| 351 switch (type) { | |
| 352 case kNone_PathTransformType: | |
| 353 return 0; | |
| 354 case kTranslateX_PathTransformType: | |
| 355 case kTranslateY_PathTransformType: | |
| 356 return 1; | |
| 357 case kTranslate_PathTransformType: | |
| 358 return 2; | |
| 359 case kAffine_PathTransformType: | |
| 360 return 6; | |
| 361 | |
| 362 default: | |
| 363 SkFAIL("Unknown path transform type"); | |
| 364 return 0; | |
| 365 } | |
| 366 } | |
| 367 | |
| 368 /** | 345 /** |
| 369 * 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 |
| 370 * and thus will finalize any reserved geometry. | 347 * and thus will finalize any reserved geometry. |
| 371 * | 348 * |
| 372 * @param rect the rect to draw | 349 * @param rect the rect to draw |
| 373 * @param localRect optional rect that specifies local coords to map onto | 350 * @param localRect optional rect that specifies local coords to map onto |
| 374 * rect. If NULL then rect serves as the local coords. | 351 * rect. If NULL then rect serves as the local coords. |
| 375 * @param localMatrix optional matrix applied to localRect. If | 352 * @param localMatrix optional matrix applied to localRect. If |
| 376 * srcRect is non-NULL and srcMatrix is non-NULL | 353 * srcRect is non-NULL and srcMatrix is non-NULL |
| 377 * then srcRect will be transformed by srcMatrix. | 354 * then srcRect will be transformed by srcMatrix. |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 GrContext* fContext; | 930 GrContext* fContext; |
| 954 // To keep track that we always have at least as many debug marker adds as r
emoves | 931 // To keep track that we always have at least as many debug marker adds as r
emoves |
| 955 int fGpuTraceMar
kerCount; | 932 int fGpuTraceMar
kerCount; |
| 956 GrTraceMarkerSet fActiveTrace
Markers; | 933 GrTraceMarkerSet fActiveTrace
Markers; |
| 957 GrTraceMarkerSet fStoredTrace
Markers; | 934 GrTraceMarkerSet fStoredTrace
Markers; |
| 958 | 935 |
| 959 typedef SkRefCnt INHERITED; | 936 typedef SkRefCnt INHERITED; |
| 960 }; | 937 }; |
| 961 | 938 |
| 962 #endif | 939 #endif |
| OLD | NEW |