| 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 16 matching lines...) Expand all Loading... |
| 27 * @param context the context object that owns this draw buffer. | 27 * @param context the context object that owns this draw buffer. |
| 28 */ | 28 */ |
| 29 GrBufferedDrawTarget(GrContext* context); | 29 GrBufferedDrawTarget(GrContext* context); |
| 30 | 30 |
| 31 ~GrBufferedDrawTarget() override; | 31 ~GrBufferedDrawTarget() override; |
| 32 | 32 |
| 33 void clearStencilClip(const SkIRect& rect, | 33 void clearStencilClip(const SkIRect& rect, |
| 34 bool insideClip, | 34 bool insideClip, |
| 35 GrRenderTarget* renderTarget) override; | 35 GrRenderTarget* renderTarget) override; |
| 36 | 36 |
| 37 void discard(GrRenderTarget*) override; | |
| 38 | |
| 39 protected: | 37 protected: |
| 40 void appendIndicesAndTransforms(const void* indexValues, PathIndexType index
Type, | 38 void appendIndicesAndTransforms(const void* indexValues, PathIndexType index
Type, |
| 41 const float* transformValues, PathTransformT
ype transformType, | 39 const float* transformValues, PathTransformT
ype transformType, |
| 42 int count, char** indicesLocation, float** x
formsLocation) { | 40 int count, char** indicesLocation, float** x
formsLocation) { |
| 43 int indexBytes = GrPathRange::PathIndexSizeInBytes(indexType); | 41 int indexBytes = GrPathRange::PathIndexSizeInBytes(indexType); |
| 44 *indicesLocation = (char*) fPathIndexBuffer.alloc(count * indexBytes, | 42 *indicesLocation = (char*) fPathIndexBuffer.alloc(count * indexBytes, |
| 45 SkChunkAlloc::kThrow_A
llocFailType); | 43 SkChunkAlloc::kThrow_A
llocFailType); |
| 46 SkASSERT(SkIsAlign4((uintptr_t)*indicesLocation)); | 44 SkASSERT(SkIsAlign4((uintptr_t)*indicesLocation)); |
| 47 memcpy(*indicesLocation, reinterpret_cast<const char*>(indexValues), cou
nt * indexBytes); | 45 memcpy(*indicesLocation, reinterpret_cast<const char*>(indexValues), cou
nt * indexBytes); |
| 48 | 46 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 71 | 69 |
| 72 void unallocState(StateForPathDraw* state) { | 70 void unallocState(StateForPathDraw* state) { |
| 73 state->unref(); | 71 state->unref(); |
| 74 fPipelineBuffer.unalloc(state); | 72 fPipelineBuffer.unalloc(state); |
| 75 } | 73 } |
| 76 | 74 |
| 77 void onReset() override; | 75 void onReset() override; |
| 78 void onFlush() override; | 76 void onFlush() override; |
| 79 | 77 |
| 80 // overrides from GrDrawTarget | 78 // overrides from GrDrawTarget |
| 81 void onDrawBatch(GrDrawBatch*) override; | 79 void onDrawBatch(GrBatch*) override; |
| 82 void onStencilPath(const GrPipelineBuilder&, | 80 void onStencilPath(const GrPipelineBuilder&, |
| 83 const GrPathProcessor*, | 81 const GrPathProcessor*, |
| 84 const GrPath*, | 82 const GrPath*, |
| 85 const GrScissorState&, | 83 const GrScissorState&, |
| 86 const GrStencilSettings&) override; | 84 const GrStencilSettings&) override; |
| 87 void onDrawPath(const GrPathProcessor*, | 85 void onDrawPath(const GrPathProcessor*, |
| 88 const GrPath*, | 86 const GrPath*, |
| 89 const GrStencilSettings&, | 87 const GrStencilSettings&, |
| 90 const PipelineInfo&) override; | 88 const PipelineInfo&) override; |
| 91 void onDrawPaths(const GrPathProcessor*, | 89 void onDrawPaths(const GrPathProcessor*, |
| 92 const GrPathRange*, | 90 const GrPathRange*, |
| 93 const void* indices, | 91 const void* indices, |
| 94 PathIndexType, | 92 PathIndexType, |
| 95 const float transformValues[], | 93 const float transformValues[], |
| 96 PathTransformType, | 94 PathTransformType, |
| 97 int count, | 95 int count, |
| 98 const GrStencilSettings&, | 96 const GrStencilSettings&, |
| 99 const PipelineInfo&) override; | 97 const PipelineInfo&) override; |
| 100 void onClear(const SkIRect& rect, | |
| 101 GrColor color, | |
| 102 GrRenderTarget* renderTarget) override; | |
| 103 void onCopySurface(GrSurface* dst, | 98 void onCopySurface(GrSurface* dst, |
| 104 GrSurface* src, | 99 GrSurface* src, |
| 105 const SkIRect& srcRect, | 100 const SkIRect& srcRect, |
| 106 const SkIPoint& dstPoint) override; | 101 const SkIPoint& dstPoint) override; |
| 107 | 102 |
| 108 bool isIssued(uint32_t drawID) override { return drawID != fDrawID; } | 103 bool isIssued(uint32_t drawID) override { return drawID != fDrawID; } |
| 109 | 104 |
| 110 StateForPathDraw* SK_WARN_UNUSED_RESULT createStateForPathDraw( | 105 StateForPathDraw* SK_WARN_UNUSED_RESULT createStateForPathDraw( |
| 111 const GrPrimitiveProcessor*, | 106 const GrPrimitiveProcessor*, |
| 112 const PipelineInfo&, | 107 const PipelineInfo&, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 127 SkChunkAlloc fPathIndexBuffer; | 122 SkChunkAlloc fPathIndexBuffer; |
| 128 SkChunkAlloc fPathTransformBuffer; | 123 SkChunkAlloc fPathTransformBuffer; |
| 129 SkChunkAlloc fPipelineBuffer; | 124 SkChunkAlloc fPipelineBuffer; |
| 130 uint32_t fDrawID; | 125 uint32_t fDrawID; |
| 131 SkAutoTUnref<StateForPathDraw> fPrevState; | 126 SkAutoTUnref<StateForPathDraw> fPrevState; |
| 132 | 127 |
| 133 typedef GrClipTarget INHERITED; | 128 typedef GrClipTarget INHERITED; |
| 134 }; | 129 }; |
| 135 | 130 |
| 136 #endif | 131 #endif |
| OLD | NEW |