Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: src/gpu/GrDrawTarget.h

Issue 699733002: removing setVertexArraySource from drawtarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 * out: a hint about the number of indices that can be 194 * out: a hint about the number of indices that can be
195 * allocated cheaply. Negative means no hint. 195 * allocated cheaply. Negative means no hint.
196 * Ignored if NULL. 196 * Ignored if NULL.
197 * 197 *
198 * @return true if target should be flushed based on the input values. 198 * @return true if target should be flushed based on the input values.
199 */ 199 */
200 virtual bool geometryHints(int* vertexCount, 200 virtual bool geometryHints(int* vertexCount,
201 int* indexCount) const; 201 int* indexCount) const;
202 202
203 /** 203 /**
204 * Sets source of vertex data for the next draw. Array must contain
205 * the vertex data when this is called.
206 *
207 * @param vertexArray cpu array containing vertex data.
208 * @param vertexCount the number of vertices in the array. Vertex size is
209 * queried from the current GrDrawState.
210 */
211 void setVertexSourceToArray(const void* vertexArray, int vertexCount);
212
213 /**
214 * Sets source of index data for the next indexed draw. Array must contain
215 * the indices when this is called.
216 *
217 * @param indexArray cpu array containing index data.
218 * @param indexCount the number of indices in the array.
219 */
220 void setIndexSourceToArray(const void* indexArray, int indexCount);
221
222 /**
223 * Sets source of vertex data for the next draw. Data does not have to be 204 * Sets source of vertex data for the next draw. Data does not have to be
224 * in the buffer until drawIndexed, drawNonIndexed, or drawIndexedInstances. 205 * in the buffer until drawIndexed, drawNonIndexed, or drawIndexedInstances.
225 * 206 *
226 * @param buffer vertex buffer containing vertex data. Must be 207 * @param buffer vertex buffer containing vertex data. Must be
227 * unlocked before draw call. Vertex size is queried 208 * unlocked before draw call. Vertex size is queried
228 * from current GrDrawState. 209 * from current GrDrawState.
229 */ 210 */
230 void setVertexSourceToBuffer(const GrVertexBuffer* buffer); 211 void setVertexSourceToBuffer(const GrVertexBuffer* buffer);
231 212
232 /** 213 /**
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 674
694 protected: 675 protected:
695 // Extend access to GrDrawState::convertToPEndeingExec to subclasses. 676 // Extend access to GrDrawState::convertToPEndeingExec to subclasses.
696 void convertDrawStateToPendingExec(GrDrawState* ds) { 677 void convertDrawStateToPendingExec(GrDrawState* ds) {
697 ds->convertToPendingExec(); 678 ds->convertToPendingExec();
698 } 679 }
699 680
700 enum GeometrySrcType { 681 enum GeometrySrcType {
701 kNone_GeometrySrcType, //<! src has not been specified 682 kNone_GeometrySrcType, //<! src has not been specified
702 kReserved_GeometrySrcType, //<! src was set using reserve*Space 683 kReserved_GeometrySrcType, //<! src was set using reserve*Space
703 kArray_GeometrySrcType, //<! src was set using set*SourceToArray 684 kArray_GeometrySrcType, //<! src was set using set*SourceToArray
bsalomon 2014/11/03 22:14:16 Can we kill this value too?
704 kBuffer_GeometrySrcType //<! src was set using set*SourceToBuffer 685 kBuffer_GeometrySrcType //<! src was set using set*SourceToBuffer
705 }; 686 };
706 687
707 struct GeometrySrcState { 688 struct GeometrySrcState {
708 GeometrySrcType fVertexSrc; 689 GeometrySrcType fVertexSrc;
709 union { 690 union {
710 // valid if src type is buffer 691 // valid if src type is buffer
711 const GrVertexBuffer* fVertexBuffer; 692 const GrVertexBuffer* fVertexBuffer;
712 // valid if src type is reserved or array 693 // valid if src type is reserved or array
713 int fVertexCount; 694 int fVertexCount;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 // A subclass can optionally overload this function to be notified before 846 // A subclass can optionally overload this function to be notified before
866 // vertex and index space is reserved. 847 // vertex and index space is reserved.
867 virtual void willReserveVertexAndIndexSpace(int vertexCount, int indexCount) {} 848 virtual void willReserveVertexAndIndexSpace(int vertexCount, int indexCount) {}
868 849
869 // implemented by subclass to allocate space for reserved geom 850 // implemented by subclass to allocate space for reserved geom
870 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertices) = 0; 851 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertices) = 0;
871 virtual bool onReserveIndexSpace(int indexCount, void** indices) = 0; 852 virtual bool onReserveIndexSpace(int indexCount, void** indices) = 0;
872 // implemented by subclass to handle release of reserved geom space 853 // implemented by subclass to handle release of reserved geom space
873 virtual void releaseReservedVertexSpace() = 0; 854 virtual void releaseReservedVertexSpace() = 0;
874 virtual void releaseReservedIndexSpace() = 0; 855 virtual void releaseReservedIndexSpace() = 0;
875 // subclass must consume array contents when set
876 virtual void onSetVertexSourceToArray(const void* vertexArray, int vertexCou nt) = 0;
877 virtual void onSetIndexSourceToArray(const void* indexArray, int indexCount) = 0;
878 // subclass is notified that geom source will be set away from an array 856 // subclass is notified that geom source will be set away from an array
879 virtual void releaseVertexArray() = 0; 857 virtual void releaseVertexArray() = 0;
880 virtual void releaseIndexArray() = 0; 858 virtual void releaseIndexArray() = 0;
881 // subclass overrides to be notified just before geo src state is pushed/pop ped. 859 // subclass overrides to be notified just before geo src state is pushed/pop ped.
882 virtual void geometrySourceWillPush() = 0; 860 virtual void geometrySourceWillPush() = 0;
883 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) = 0; 861 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) = 0;
884 // subclass called to perform drawing 862 // subclass called to perform drawing
885 virtual void onDraw(const DrawInfo&) = 0; 863 virtual void onDraw(const DrawInfo&) = 0;
886 // Implementation of drawRect. The geometry src and vertex attribs will alre ady 864 // Implementation of drawRect. The geometry src and vertex attribs will alre ady
887 // be saved before this is called and restored afterwards. A subclass may ov erride 865 // be saved before this is called and restored afterwards. A subclass may ov erride
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 protected: 954 protected:
977 GrClipMaskManager fClipMaskManager; 955 GrClipMaskManager fClipMaskManager;
978 956
979 private: 957 private:
980 GrClipMaskManager* getClipMaskManager() { return &fClipMaskManager; } 958 GrClipMaskManager* getClipMaskManager() { return &fClipMaskManager; }
981 959
982 typedef GrDrawTarget INHERITED; 960 typedef GrDrawTarget INHERITED;
983 }; 961 };
984 962
985 #endif 963 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698