| 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 "GrDrawPathBatch.h" | 8 #include "GrDrawPathBatch.h" |
| 9 | 9 |
| 10 static void pre_translate_transform_values(const float* xforms, | 10 static void pre_translate_transform_values(const float* xforms, |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 if (fDraws.count() == 1) { | 131 if (fDraws.count() == 1) { |
| 132 const InstanceData& instances = *head.fInstanceData; | 132 const InstanceData& instances = *head.fInstanceData; |
| 133 state->gpu()->pathRendering()->drawPaths(args, fPathRange.get(), instanc
es.indices(), | 133 state->gpu()->pathRendering()->drawPaths(args, fPathRange.get(), instanc
es.indices(), |
| 134 GrPathRange::kU16_PathIndexType
, | 134 GrPathRange::kU16_PathIndexType
, |
| 135 instances.transformValues(), | 135 instances.transformValues(), |
| 136 instances.transformType(), | 136 instances.transformType(), |
| 137 instances.count()); | 137 instances.count()); |
| 138 } else { | 138 } else { |
| 139 int floatsPerTransform = GrPathRendering::PathTransformSize(this->transf
ormType()); | 139 int floatsPerTransform = GrPathRendering::PathTransformSize(this->transf
ormType()); |
| 140 #if defined(GOOGLE3) | |
| 141 //Stack frame size is limited in GOOGLE3. | |
| 142 SkAutoSTMalloc<512, float> transformStorage(floatsPerTransform * fTotalP
athCount); | |
| 143 SkAutoSTMalloc<256, uint16_t> indexStorage(fTotalPathCount); | |
| 144 #else | |
| 145 SkAutoSTMalloc<4096, float> transformStorage(floatsPerTransform * fTotal
PathCount); | 140 SkAutoSTMalloc<4096, float> transformStorage(floatsPerTransform * fTotal
PathCount); |
| 146 SkAutoSTMalloc<2048, uint16_t> indexStorage(fTotalPathCount); | 141 SkAutoSTMalloc<2048, uint16_t> indexStorage(fTotalPathCount); |
| 147 #endif | |
| 148 int idx = 0; | 142 int idx = 0; |
| 149 for (DrawList::Iter iter(fDraws); iter.get(); iter.next()) { | 143 for (DrawList::Iter iter(fDraws); iter.get(); iter.next()) { |
| 150 const Draw& draw = *iter.get(); | 144 const Draw& draw = *iter.get(); |
| 151 const InstanceData& instances = *draw.fInstanceData; | 145 const InstanceData& instances = *draw.fInstanceData; |
| 152 memcpy(&indexStorage[idx], instances.indices(), instances.count() *
sizeof(uint16_t)); | 146 memcpy(&indexStorage[idx], instances.indices(), instances.count() *
sizeof(uint16_t)); |
| 153 pre_translate_transform_values(instances.transformValues(), this->tr
ansformType(), | 147 pre_translate_transform_values(instances.transformValues(), this->tr
ansformType(), |
| 154 instances.count(), | 148 instances.count(), |
| 155 draw.fX - head.fX, draw.fY - head.fY, | 149 draw.fX - head.fX, draw.fY - head.fY, |
| 156 &transformStorage[floatsPerTransform
* idx]); | 150 &transformStorage[floatsPerTransform
* idx]); |
| 157 idx += instances.count(); | 151 idx += instances.count(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 dst[i + 3] = xforms[i + 3]; | 198 dst[i + 3] = xforms[i + 3]; |
| 205 dst[i + 4] = xforms[i + 4]; | 199 dst[i + 4] = xforms[i + 4]; |
| 206 dst[i + 5] = xforms[i + 3] * x + xforms[i + 4] * y + xforms[i +
5]; | 200 dst[i + 5] = xforms[i + 3] * x + xforms[i + 4] * y + xforms[i +
5]; |
| 207 } | 201 } |
| 208 break; | 202 break; |
| 209 default: | 203 default: |
| 210 SkFAIL("Unknown transform type."); | 204 SkFAIL("Unknown transform type."); |
| 211 break; | 205 break; |
| 212 } | 206 } |
| 213 } | 207 } |
| OLD | NEW |