| 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 "GrBufferedDrawTarget.h" | 10 #include "GrBufferedDrawTarget.h" |
| 11 | 11 |
| 12 #include "GrColor.h" | 12 #include "GrColor.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(const State* sta
te, |
| 29 const GrPipeline
Optimizations& opts, |
| 30 GrBatch* batch)
{ |
| 29 // Check if there is a Batch Draw we can batch with | 31 // Check if there is a Batch Draw we can batch with |
| 30 batch->setPipeline(state->getPipeline()); | 32 batch->setPipeline(state->getPipeline(), opts); |
| 31 GrBATCH_INFO("In-Recording (%s, %u)\n", batch->name(), batch->uniqueID()); | 33 GrBATCH_INFO("In-Recording (%s, %u)\n", batch->name(), batch->uniqueID()); |
| 32 if (!this->cmdBuffer()->empty() && | 34 if (!this->cmdBuffer()->empty() && |
| 33 Cmd::kDrawBatch_CmdType == this->cmdBuffer()->back().type()) { | 35 Cmd::kDrawBatch_CmdType == this->cmdBuffer()->back().type()) { |
| 34 DrawBatch* previous = static_cast<DrawBatch*>(&this->cmdBuffer()->back()
); | 36 DrawBatch* previous = static_cast<DrawBatch*>(&this->cmdBuffer()->back()
); |
| 35 if (previous->fState == state && previous->fBatch->combineIfPossible(bat
ch)) { | 37 if (previous->fState == state && previous->fBatch->combineIfPossible(bat
ch)) { |
| 36 GrBATCH_INFO("\tBatching with (%s, %u)\n", | 38 GrBATCH_INFO("\tBatching with (%s, %u)\n", |
| 37 previous->fBatch->name(), previous->fBatch->uniqueID())
; | 39 previous->fBatch->name(), previous->fBatch->uniqueID())
; |
| 38 return NULL; | 40 return NULL; |
| 39 } | 41 } |
| 40 } | 42 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 125 |
| 124 DrawPaths* dp = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawPaths, (sta
te, pathRange)); | 126 DrawPaths* dp = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawPaths, (sta
te, pathRange)); |
| 125 dp->fIndices = savedIndices; | 127 dp->fIndices = savedIndices; |
| 126 dp->fIndexType = indexType; | 128 dp->fIndexType = indexType; |
| 127 dp->fTransforms = savedTransforms; | 129 dp->fTransforms = savedTransforms; |
| 128 dp->fTransformType = transformType; | 130 dp->fTransformType = transformType; |
| 129 dp->fCount = count; | 131 dp->fCount = count; |
| 130 dp->fStencilSettings = stencilSettings; | 132 dp->fStencilSettings = stencilSettings; |
| 131 return dp; | 133 return dp; |
| 132 } | 134 } |
| OLD | NEW |