| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 * to index 0 | 226 * to index 0 |
| 227 * @param startIndex first index to read from index src. | 227 * @param startIndex first index to read from index src. |
| 228 * @param vertexCount one greater than the max index. | 228 * @param vertexCount one greater than the max index. |
| 229 * @param indexCount the number of index elements to read. The index count | 229 * @param indexCount the number of index elements to read. The index count |
| 230 * is effectively trimmed to the last completely | 230 * is effectively trimmed to the last completely |
| 231 * specified primitive. | 231 * specified primitive. |
| 232 * @param devBounds optional bounds hint. This is a promise from the call
er, | 232 * @param devBounds optional bounds hint. This is a promise from the call
er, |
| 233 * not a request for clipping. | 233 * not a request for clipping. |
| 234 */ | 234 */ |
| 235 void drawIndexed(GrDrawState*, | 235 void drawIndexed(GrDrawState*, |
| 236 const GrGeometryProcessor*, |
| 236 GrPrimitiveType type, | 237 GrPrimitiveType type, |
| 237 int startVertex, | 238 int startVertex, |
| 238 int startIndex, | 239 int startIndex, |
| 239 int vertexCount, | 240 int vertexCount, |
| 240 int indexCount, | 241 int indexCount, |
| 241 const SkRect* devBounds = NULL); | 242 const SkRect* devBounds = NULL); |
| 242 | 243 |
| 243 /** | 244 /** |
| 244 * Draws non-indexed geometry using the current state and current vertex | 245 * Draws non-indexed geometry using the current state and current vertex |
| 245 * sources. | 246 * sources. |
| 246 * | 247 * |
| 247 * @param type The type of primitives to draw. | 248 * @param type The type of primitives to draw. |
| 248 * @param startVertex the vertex in the vertex array/buffer corresponding | 249 * @param startVertex the vertex in the vertex array/buffer corresponding |
| 249 * to index 0 | 250 * to index 0 |
| 250 * @param vertexCount one greater than the max index. | 251 * @param vertexCount one greater than the max index. |
| 251 * @param devBounds optional bounds hint. This is a promise from the call
er, | 252 * @param devBounds optional bounds hint. This is a promise from the call
er, |
| 252 * not a request for clipping. | 253 * not a request for clipping. |
| 253 */ | 254 */ |
| 254 void drawNonIndexed(GrDrawState*, | 255 void drawNonIndexed(GrDrawState*, |
| 256 const GrGeometryProcessor*, |
| 255 GrPrimitiveType type, | 257 GrPrimitiveType type, |
| 256 int startVertex, | 258 int startVertex, |
| 257 int vertexCount, | 259 int vertexCount, |
| 258 const SkRect* devBounds = NULL); | 260 const SkRect* devBounds = NULL); |
| 259 | 261 |
| 260 /** | 262 /** |
| 261 * Draws path into the stencil buffer. The fill must be either even/odd or | 263 * Draws path into the stencil buffer. The fill must be either even/odd or |
| 262 * winding (not inverse or hairline). It will respect the HW antialias flag | 264 * winding (not inverse or hairline). It will respect the HW antialias flag |
| 263 * on the draw state (if possible in the 3D API). Note, we will never have
an inverse fill | 265 * on the draw state (if possible in the 3D API). Note, we will never have
an inverse fill |
| 264 * with stencil path | 266 * with stencil path |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 * indicesPerInstance indices drawn as the primitive | 352 * indicesPerInstance indices drawn as the primitive |
| 351 * type specified by type. | 353 * type specified by type. |
| 352 * @param verticesPerInstance The number of vertices in each instance (V | 354 * @param verticesPerInstance The number of vertices in each instance (V |
| 353 * in the above description). | 355 * in the above description). |
| 354 * @param indicesPerInstance The number of indices in each instance (I | 356 * @param indicesPerInstance The number of indices in each instance (I |
| 355 * in the above description). | 357 * in the above description). |
| 356 * @param devBounds optional bounds hint. This is a promise from the call
er, | 358 * @param devBounds optional bounds hint. This is a promise from the call
er, |
| 357 * not a request for clipping. | 359 * not a request for clipping. |
| 358 */ | 360 */ |
| 359 void drawIndexedInstances(GrDrawState*, | 361 void drawIndexedInstances(GrDrawState*, |
| 362 const GrGeometryProcessor*, |
| 360 GrPrimitiveType type, | 363 GrPrimitiveType type, |
| 361 int instanceCount, | 364 int instanceCount, |
| 362 int verticesPerInstance, | 365 int verticesPerInstance, |
| 363 int indicesPerInstance, | 366 int indicesPerInstance, |
| 364 const SkRect* devBounds = NULL); | 367 const SkRect* devBounds = NULL); |
| 365 | 368 |
| 366 /** | 369 /** |
| 367 * Clear the passed in render target. Ignores the draw state and clip. Clear
s the whole thing if | 370 * Clear the passed in render target. Ignores the draw state and clip. Clear
s the whole thing if |
| 368 * rect is NULL, otherwise just the rect. If canIgnoreRect is set then the e
ntire render target | 371 * rect is NULL, otherwise just the rect. If canIgnoreRect is set then the e
ntire render target |
| 369 * can be optionally cleared. | 372 * can be optionally cleared. |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 | 652 |
| 650 // Subclass must initialize this in its constructor. | 653 // Subclass must initialize this in its constructor. |
| 651 SkAutoTUnref<const GrDrawTargetCaps> fCaps; | 654 SkAutoTUnref<const GrDrawTargetCaps> fCaps; |
| 652 | 655 |
| 653 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers
; } | 656 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers
; } |
| 654 | 657 |
| 655 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required | 658 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required |
| 656 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it | 659 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it |
| 657 // needs to be accessed by GLPrograms to setup a correct drawstate | 660 // needs to be accessed by GLPrograms to setup a correct drawstate |
| 658 bool setupDstReadIfNecessary(GrDrawState*, | 661 bool setupDstReadIfNecessary(GrDrawState*, |
| 662 const GrPrimitiveProcessor*, |
| 659 GrColor, | 663 GrColor, |
| 660 uint8_t, | 664 uint8_t, |
| 661 GrDeviceCoordTexture* dstCopy, | 665 GrDeviceCoordTexture* dstCopy, |
| 662 const SkRect* drawBounds); | 666 const SkRect* drawBounds); |
| 663 | 667 |
| 664 private: | 668 private: |
| 665 /** | 669 /** |
| 666 * This will be called before allocating a texture as a dst for copySurface.
This function | 670 * This will be called before allocating a texture as a dst for copySurface.
This function |
| 667 * populates the dstDesc's config, flags, and origin so as to maximize effic
iency and guarantee | 671 * populates the dstDesc's config, flags, and origin so as to maximize effic
iency and guarantee |
| 668 * success of the copySurface call. | 672 * success of the copySurface call. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 691 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void**
vertices) = 0; | 695 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void**
vertices) = 0; |
| 692 virtual bool onReserveIndexSpace(int indexCount, void** indices) = 0; | 696 virtual bool onReserveIndexSpace(int indexCount, void** indices) = 0; |
| 693 // implemented by subclass to handle release of reserved geom space | 697 // implemented by subclass to handle release of reserved geom space |
| 694 virtual void releaseReservedVertexSpace() = 0; | 698 virtual void releaseReservedVertexSpace() = 0; |
| 695 virtual void releaseReservedIndexSpace() = 0; | 699 virtual void releaseReservedIndexSpace() = 0; |
| 696 // subclass overrides to be notified just before geo src state is pushed/pop
ped. | 700 // subclass overrides to be notified just before geo src state is pushed/pop
ped. |
| 697 virtual void geometrySourceWillPush() = 0; | 701 virtual void geometrySourceWillPush() = 0; |
| 698 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) =
0; | 702 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) =
0; |
| 699 // subclass called to perform drawing | 703 // subclass called to perform drawing |
| 700 virtual void onDraw(const GrDrawState&, | 704 virtual void onDraw(const GrDrawState&, |
| 705 const GrGeometryProcessor*, |
| 701 const DrawInfo&, | 706 const DrawInfo&, |
| 702 const GrClipMaskManager::ScissorState&, | 707 const GrClipMaskManager::ScissorState&, |
| 703 const GrDeviceCoordTexture* dstCopy) = 0; | 708 const GrDeviceCoordTexture* dstCopy) = 0; |
| 704 // TODO copy in order drawbuffer onDrawRect to here | 709 // TODO copy in order drawbuffer onDrawRect to here |
| 705 virtual void onDrawRect(GrDrawState*, | 710 virtual void onDrawRect(GrDrawState*, |
| 706 GrColor color, | 711 GrColor color, |
| 707 const SkRect& rect, | 712 const SkRect& rect, |
| 708 const SkRect* localRect, | 713 const SkRect* localRect, |
| 709 const SkMatrix* localMatrix) = 0; | 714 const SkMatrix* localMatrix) = 0; |
| 710 | 715 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 | 764 |
| 760 // helpers for reserving vertex and index space. | 765 // helpers for reserving vertex and index space. |
| 761 bool reserveVertexSpace(size_t vertexSize, | 766 bool reserveVertexSpace(size_t vertexSize, |
| 762 int vertexCount, | 767 int vertexCount, |
| 763 void** vertices); | 768 void** vertices); |
| 764 bool reserveIndexSpace(int indexCount, void** indices); | 769 bool reserveIndexSpace(int indexCount, void** indices); |
| 765 | 770 |
| 766 // called by drawIndexed and drawNonIndexed. Use a negative indexCount to | 771 // called by drawIndexed and drawNonIndexed. Use a negative indexCount to |
| 767 // indicate non-indexed drawing. | 772 // indicate non-indexed drawing. |
| 768 bool checkDraw(const GrDrawState&, | 773 bool checkDraw(const GrDrawState&, |
| 774 const GrGeometryProcessor*, |
| 769 GrPrimitiveType type, | 775 GrPrimitiveType type, |
| 770 int startVertex, | 776 int startVertex, |
| 771 int startIndex, | 777 int startIndex, |
| 772 int vertexCount, | 778 int vertexCount, |
| 773 int indexCount) const; | 779 int indexCount) const; |
| 774 // called when setting a new vert/idx source to unref prev vb/ib | 780 // called when setting a new vert/idx source to unref prev vb/ib |
| 775 void releasePreviousVertexSource(); | 781 void releasePreviousVertexSource(); |
| 776 void releasePreviousIndexSource(); | 782 void releasePreviousIndexSource(); |
| 777 | 783 |
| 778 // Check to see if this set of draw commands has been sent out | 784 // Check to see if this set of draw commands has been sent out |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 virtual bool setupClip(const SkRect* devBounds, | 850 virtual bool setupClip(const SkRect* devBounds, |
| 845 GrDrawState::AutoRestoreEffects* are, | 851 GrDrawState::AutoRestoreEffects* are, |
| 846 GrDrawState::AutoRestoreStencil* ars, | 852 GrDrawState::AutoRestoreStencil* ars, |
| 847 GrDrawState*, | 853 GrDrawState*, |
| 848 GrClipMaskManager::ScissorState* scissorState) SK_OVE
RRIDE; | 854 GrClipMaskManager::ScissorState* scissorState) SK_OVE
RRIDE; |
| 849 | 855 |
| 850 typedef GrDrawTarget INHERITED; | 856 typedef GrDrawTarget INHERITED; |
| 851 }; | 857 }; |
| 852 | 858 |
| 853 #endif | 859 #endif |
| OLD | NEW |