| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "GrInOrderCommandBuilder.h" | 8 #include "GrInOrderCommandBuilder.h" |
| 9 | 9 |
| 10 #include "GrColor.h" | 10 #include "GrColor.h" |
| 11 #include "GrInOrderDrawBuffer.h" | 11 #include "GrInOrderDrawBuffer.h" |
| 12 #include "GrTemplates.h" | 12 #include "GrTemplates.h" |
| 13 #include "SkPoint.h" | 13 #include "SkPoint.h" |
| 14 | 14 |
| 15 static bool path_fill_type_is_winding(const GrStencilSettings& pathStencilSettin
gs) { | 15 static bool path_fill_type_is_winding(const GrStencilSettings& pathStencilSettin
gs) { |
| 16 static const GrStencilSettings::Face pathFace = GrStencilSettings::kFront_Fa
ce; | 16 static const GrStencilSettings::Face pathFace = GrStencilSettings::kFront_Fa
ce; |
| 17 bool isWinding = kInvert_StencilOp != pathStencilSettings.passOp(pathFace); | 17 bool isWinding = kInvert_StencilOp != pathStencilSettings.passOp(pathFace); |
| 18 if (isWinding) { | 18 if (isWinding) { |
| 19 // Double check that it is in fact winding. | 19 // Double check that it is in fact winding. |
| 20 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.passOp(pathFace)); | 20 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.passOp(pathFace)); |
| 21 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.failOp(pathFace)); | 21 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.failOp(pathFace)); |
| 22 SkASSERT(0x1 != pathStencilSettings.writeMask(pathFace)); | 22 SkASSERT(0x1 != pathStencilSettings.writeMask(pathFace)); |
| 23 SkASSERT(!pathStencilSettings.isTwoSided()); | 23 SkASSERT(!pathStencilSettings.isTwoSided()); |
| 24 } | 24 } |
| 25 return isWinding; | 25 return isWinding; |
| 26 } | 26 } |
| 27 | 27 |
| 28 GrTargetCommands::Cmd* GrInOrderCommandBuilder::recordDrawBatch(State* state, Gr
Batch* batch) { | 28 GrTargetCommands::Cmd* GrInOrderCommandBuilder::recordDrawBatch(State* state, Gr
Batch* batch) { |
| 29 // Check if there is a Batch Draw we can batch with | 29 // Check if there is a Batch Draw we can batch with |
| 30 batch->setPipeline(state->getPipeline()); |
| 30 if (!this->cmdBuffer()->empty() && | 31 if (!this->cmdBuffer()->empty() && |
| 31 Cmd::kDrawBatch_CmdType == this->cmdBuffer()->back().type()) { | 32 Cmd::kDrawBatch_CmdType == this->cmdBuffer()->back().type()) { |
| 32 DrawBatch* previous = static_cast<DrawBatch*>(&this->cmdBuffer()->back()
); | 33 DrawBatch* previous = static_cast<DrawBatch*>(&this->cmdBuffer()->back()
); |
| 33 if (previous->fState == state && previous->fBatch->combineIfPossible(bat
ch)) { | 34 if (previous->fState == state && previous->fBatch->combineIfPossible(bat
ch)) { |
| 34 return NULL; | 35 return NULL; |
| 35 } | 36 } |
| 36 } | 37 } |
| 37 | 38 |
| 38 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (state, batch
, | 39 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (state, batch
, |
| 39 this->batchT
arget())); | 40 this->batchT
arget())); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 120 |
| 120 DrawPaths* dp = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawPaths, (sta
te, pathRange)); | 121 DrawPaths* dp = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawPaths, (sta
te, pathRange)); |
| 121 dp->fIndices = savedIndices; | 122 dp->fIndices = savedIndices; |
| 122 dp->fIndexType = indexType; | 123 dp->fIndexType = indexType; |
| 123 dp->fTransforms = savedTransforms; | 124 dp->fTransforms = savedTransforms; |
| 124 dp->fTransformType = transformType; | 125 dp->fTransformType = transformType; |
| 125 dp->fCount = count; | 126 dp->fCount = count; |
| 126 dp->fStencilSettings = stencilSettings; | 127 dp->fStencilSettings = stencilSettings; |
| 127 return dp; | 128 return dp; |
| 128 } | 129 } |
| OLD | NEW |