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 |
140 SkAutoSTMalloc<4096, float> transformStorage(floatsPerTransform * fTotal
PathCount); | 145 SkAutoSTMalloc<4096, float> transformStorage(floatsPerTransform * fTotal
PathCount); |
141 SkAutoSTMalloc<2048, uint16_t> indexStorage(fTotalPathCount); | 146 SkAutoSTMalloc<2048, uint16_t> indexStorage(fTotalPathCount); |
| 147 #endif |
142 int idx = 0; | 148 int idx = 0; |
143 for (DrawList::Iter iter(fDraws); iter.get(); iter.next()) { | 149 for (DrawList::Iter iter(fDraws); iter.get(); iter.next()) { |
144 const Draw& draw = *iter.get(); | 150 const Draw& draw = *iter.get(); |
145 const InstanceData& instances = *draw.fInstanceData; | 151 const InstanceData& instances = *draw.fInstanceData; |
146 memcpy(&indexStorage[idx], instances.indices(), instances.count() *
sizeof(uint16_t)); | 152 memcpy(&indexStorage[idx], instances.indices(), instances.count() *
sizeof(uint16_t)); |
147 pre_translate_transform_values(instances.transformValues(), this->tr
ansformType(), | 153 pre_translate_transform_values(instances.transformValues(), this->tr
ansformType(), |
148 instances.count(), | 154 instances.count(), |
149 draw.fX - head.fX, draw.fY - head.fY, | 155 draw.fX - head.fX, draw.fY - head.fY, |
150 &transformStorage[floatsPerTransform
* idx]); | 156 &transformStorage[floatsPerTransform
* idx]); |
151 idx += instances.count(); | 157 idx += instances.count(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 dst[i + 3] = xforms[i + 3]; | 204 dst[i + 3] = xforms[i + 3]; |
199 dst[i + 4] = xforms[i + 4]; | 205 dst[i + 4] = xforms[i + 4]; |
200 dst[i + 5] = xforms[i + 3] * x + xforms[i + 4] * y + xforms[i +
5]; | 206 dst[i + 5] = xforms[i + 3] * x + xforms[i + 4] * y + xforms[i +
5]; |
201 } | 207 } |
202 break; | 208 break; |
203 default: | 209 default: |
204 SkFAIL("Unknown transform type."); | 210 SkFAIL("Unknown transform type."); |
205 break; | 211 break; |
206 } | 212 } |
207 } | 213 } |
OLD | NEW |