OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrBufferedDrawTarget_DEFINED | 8 #ifndef GrBufferedDrawTarget_DEFINED |
9 #define GrBufferedDrawTarget_DEFINED | 9 #define GrBufferedDrawTarget_DEFINED |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 void appendIndicesAndTransforms(const void* indexValues, PathIndexType index
Type, | 34 void appendIndicesAndTransforms(const void* indexValues, PathIndexType index
Type, |
35 const float* transformValues, PathTransformT
ype transformType, | 35 const float* transformValues, PathTransformT
ype transformType, |
36 int count, char** indicesLocation, float** x
formsLocation) { | 36 int count, char** indicesLocation, float** x
formsLocation) { |
37 int indexBytes = GrPathRange::PathIndexSizeInBytes(indexType); | 37 int indexBytes = GrPathRange::PathIndexSizeInBytes(indexType); |
38 *indicesLocation = (char*) fPathIndexBuffer.alloc(count * indexBytes, | 38 *indicesLocation = (char*) fPathIndexBuffer.alloc(count * indexBytes, |
39 SkChunkAlloc::kThrow_A
llocFailType); | 39 SkChunkAlloc::kThrow_A
llocFailType); |
40 SkASSERT(SkIsAlign4((uintptr_t)*indicesLocation)); | 40 SkASSERT(SkIsAlign4((uintptr_t)*indicesLocation)); |
41 memcpy(*indicesLocation, reinterpret_cast<const char*>(indexValues), cou
nt * indexBytes); | 41 memcpy(*indicesLocation, reinterpret_cast<const char*>(indexValues), cou
nt * indexBytes); |
42 | 42 |
43 const int xformBytes = GrPathRendering::PathTransformSize(transformType)
* sizeof(float); | 43 const int xformBytes = GrPathRendering::PathTransformSize(transformType)
* sizeof(float); |
44 *xformsLocation = NULL; | 44 *xformsLocation = nullptr; |
45 | 45 |
46 if (0 != xformBytes) { | 46 if (0 != xformBytes) { |
47 *xformsLocation = (float*) fPathTransformBuffer.alloc(count * xformB
ytes, | 47 *xformsLocation = (float*) fPathTransformBuffer.alloc(count * xformB
ytes, |
48 SkChunkAlloc::kTh
row_AllocFailType); | 48 SkChunkAlloc::kTh
row_AllocFailType); |
49 SkASSERT(SkIsAlign4((uintptr_t)*xformsLocation)); | 49 SkASSERT(SkIsAlign4((uintptr_t)*xformsLocation)); |
50 memcpy(*xformsLocation, transformValues, count * xformBytes); | 50 memcpy(*xformsLocation, transformValues, count * xformBytes); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 void onDrawBatch(GrBatch*) override; | 54 void onDrawBatch(GrBatch*) override; |
55 | 55 |
56 private: | 56 private: |
57 friend class GrInOrderCommandBuilder; | 57 friend class GrInOrderCommandBuilder; |
58 friend class GrTargetCommands; | 58 friend class GrTargetCommands; |
59 | 59 |
60 typedef GrTargetCommands::StateForPathDraw StateForPathDraw; | 60 typedef GrTargetCommands::StateForPathDraw StateForPathDraw; |
61 | 61 |
62 StateForPathDraw* allocState(const GrPrimitiveProcessor* primProc = NULL) { | 62 StateForPathDraw* allocState(const GrPrimitiveProcessor* primProc = nullptr)
{ |
63 void* allocation = fPipelineBuffer.alloc(sizeof(StateForPathDraw), | 63 void* allocation = fPipelineBuffer.alloc(sizeof(StateForPathDraw), |
64 SkChunkAlloc::kThrow_AllocFailT
ype); | 64 SkChunkAlloc::kThrow_AllocFailT
ype); |
65 return new (allocation) StateForPathDraw(primProc); | 65 return new (allocation) StateForPathDraw(primProc); |
66 } | 66 } |
67 | 67 |
68 void unallocState(StateForPathDraw* state) { | 68 void unallocState(StateForPathDraw* state) { |
69 state->unref(); | 69 state->unref(); |
70 fPipelineBuffer.unalloc(state); | 70 fPipelineBuffer.unalloc(state); |
71 } | 71 } |
72 | 72 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 SkChunkAlloc fPathIndexBuffer; | 105 SkChunkAlloc fPathIndexBuffer; |
106 SkChunkAlloc fPathTransformBuffer; | 106 SkChunkAlloc fPathTransformBuffer; |
107 SkChunkAlloc fPipelineBuffer; | 107 SkChunkAlloc fPipelineBuffer; |
108 uint32_t fDrawID; | 108 uint32_t fDrawID; |
109 SkAutoTUnref<StateForPathDraw> fPrevState; | 109 SkAutoTUnref<StateForPathDraw> fPrevState; |
110 | 110 |
111 typedef GrClipTarget INHERITED; | 111 typedef GrClipTarget INHERITED; |
112 }; | 112 }; |
113 | 113 |
114 #endif | 114 #endif |
OLD | NEW |