| 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 GrInOrderDrawBuffer_DEFINED | 8 #ifndef GrInOrderDrawBuffer_DEFINED |
| 9 #define GrInOrderDrawBuffer_DEFINED | 9 #define GrInOrderDrawBuffer_DEFINED |
| 10 | 10 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 SkIPoint fDstPoint; | 165 SkIPoint fDstPoint; |
| 166 SkIRect fSrcRect; | 166 SkIRect fSrcRect; |
| 167 | 167 |
| 168 private: | 168 private: |
| 169 GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst; | 169 GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst; |
| 170 GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc; | 170 GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc; |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 struct SetState : public Cmd { | 173 struct SetState : public Cmd { |
| 174 SetState(const GrDrawState& drawState, GrColor color, uint8_t coverage, | 174 SetState(const GrDrawState& drawState, const GrGeometryProcessor* gp, Gr
Color color, |
| 175 const GrDrawTargetCaps& caps, const ScissorState& scissor, | 175 uint8_t coverage, const GrDrawTargetCaps& caps, const ScissorSt
ate& scissor, |
| 176 const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType drawType) | 176 const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType drawType) |
| 177 : Cmd(kSetState_Cmd) | 177 : Cmd(kSetState_Cmd) |
| 178 , fState(drawState, color, coverage, caps, scissor, dstCopy, drawType) {
} | 178 , fState(drawState, gp, color, coverage, caps, scissor, dstCopy, drawTyp
e) {} |
| 179 | 179 |
| 180 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; | 180 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
| 181 | 181 |
| 182 GrOptDrawState fState; | 182 GrOptDrawState fState; |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. | 185 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. |
| 186 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; | 186 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; |
| 187 | 187 |
| 188 void onReset() SK_OVERRIDE; | 188 void onReset() SK_OVERRIDE; |
| 189 void onFlush() SK_OVERRIDE; | 189 void onFlush() SK_OVERRIDE; |
| 190 | 190 |
| 191 // overrides from GrDrawTarget | 191 // overrides from GrDrawTarget |
| 192 void onDraw(const GrDrawState&, | 192 void onDraw(const GrDrawState&, |
| 193 const GrGeometryProcessor*, |
| 193 const DrawInfo&, | 194 const DrawInfo&, |
| 194 const ScissorState&, | 195 const ScissorState&, |
| 195 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; | 196 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
| 196 void onDrawRect(GrDrawState*, | 197 void onDrawRect(GrDrawState*, |
| 197 GrColor, | 198 GrColor, |
| 198 const SkRect& rect, | 199 const SkRect& rect, |
| 199 const SkRect* localRect, | 200 const SkRect* localRect, |
| 200 const SkMatrix* localMatrix) SK_OVERRIDE; | 201 const SkMatrix* localMatrix) SK_OVERRIDE; |
| 201 | 202 |
| 202 void onStencilPath(const GrDrawState&, | 203 void onStencilPath(const GrDrawState&, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 230 const SkIPoint& dstPoint) SK_OVERRIDE; | 231 const SkIPoint& dstPoint) SK_OVERRIDE; |
| 231 | 232 |
| 232 // Attempts to concat instances from info onto the previous draw. info must
represent an | 233 // Attempts to concat instances from info onto the previous draw. info must
represent an |
| 233 // instanced draw. The caller must have already recorded a new draw state an
d clip if necessary. | 234 // instanced draw. The caller must have already recorded a new draw state an
d clip if necessary. |
| 234 int concatInstancedDraw(const GrDrawState&, const DrawInfo&); | 235 int concatInstancedDraw(const GrDrawState&, const DrawInfo&); |
| 235 | 236 |
| 236 // Determines whether the current draw operation requires a new GrOptDrawSta
te and if so | 237 // Determines whether the current draw operation requires a new GrOptDrawSta
te and if so |
| 237 // records it. If the draw can be skipped false is returned and no new GrOpt
DrawState is | 238 // records it. If the draw can be skipped false is returned and no new GrOpt
DrawState is |
| 238 // recorded. | 239 // recorded. |
| 239 bool SK_WARN_UNUSED_RESULT recordStateAndShouldDraw(const GrDrawState&, | 240 bool SK_WARN_UNUSED_RESULT recordStateAndShouldDraw(const GrDrawState&, |
| 241 const GrGeometryProcesso
r* gp, |
| 240 GrColor, | 242 GrColor, |
| 241 uint8_t coverage, | 243 uint8_t coverage, |
| 242 GrGpu::DrawType, | 244 GrGpu::DrawType, |
| 243 const GrClipMaskManager:
:ScissorState&, | 245 const GrClipMaskManager:
:ScissorState&, |
| 244 const GrDeviceCoordTextu
re*); | 246 const GrDeviceCoordTextu
re*); |
| 245 // We lazily record clip changes in order to skip clips that have no effect. | 247 // We lazily record clip changes in order to skip clips that have no effect. |
| 246 void recordClipIfNecessary(); | 248 void recordClipIfNecessary(); |
| 247 // Records any trace markers for a command after adding it to the buffer. | 249 // Records any trace markers for a command after adding it to the buffer. |
| 248 void recordTraceMarkersIfNecessary(); | 250 void recordTraceMarkersIfNecessary(); |
| 249 | 251 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 260 const GrOptDrawState* fPrevState; | 262 const GrOptDrawState* fPrevState; |
| 261 SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers; | 263 SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers; |
| 262 SkTDArray<char> fPathIndexBuffer; | 264 SkTDArray<char> fPathIndexBuffer; |
| 263 SkTDArray<float> fPathTransformBuffer; | 265 SkTDArray<float> fPathTransformBuffer; |
| 264 uint32_t fDrawID; | 266 uint32_t fDrawID; |
| 265 | 267 |
| 266 typedef GrFlushToGpuDrawTarget INHERITED; | 268 typedef GrFlushToGpuDrawTarget INHERITED; |
| 267 }; | 269 }; |
| 268 | 270 |
| 269 #endif | 271 #endif |
| OLD | NEW |