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 "GrAAFillRectBatch.h" | 8 #include "GrAAFillRectBatch.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = color; | 183 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = color; |
184 *reinterpret_cast<float*>(verts + i * vertexStride + | 184 *reinterpret_cast<float*>(verts + i * vertexStride + |
185 coverageOffset) = innerCoverage; | 185 coverageOffset) = innerCoverage; |
186 } | 186 } |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 class AAFillRectNoLocalMatrixBatch : public GrVertexBatch { | 190 class AAFillRectNoLocalMatrixBatch : public GrVertexBatch { |
191 public: | 191 public: |
192 DEFINE_BATCH_CLASS_ID | 192 DEFINE_BATCH_CLASS_ID |
193 | 193 AAFillRectNoLocalMatrixBatch(GrColor color, |
194 struct Geometry { | 194 const SkMatrix& viewMatrix, |
195 SkMatrix fViewMatrix; | 195 const SkRect& rect, |
196 SkRect fRect; | 196 const SkRect& devRect) : INHERITED(ClassID()) { |
197 SkRect fDevRect; | 197 fRects.emplace_back(RectInfo{color, viewMatrix, rect, devRect}); |
198 GrColor fColor; | 198 fBounds = devRect; |
199 }; | 199 } |
200 | |
201 static AAFillRectNoLocalMatrixBatch* Create() { return new AAFillRectNoLocal
MatrixBatch; } | |
202 | 200 |
203 const char* name() const override { return "AAFillRectBatchNoLocalMatrix"; } | 201 const char* name() const override { return "AAFillRectBatchNoLocalMatrix"; } |
204 | 202 |
205 SkString dumpInfo() const override { | 203 SkString dumpInfo() const override { |
206 SkString str; | 204 SkString str; |
207 str.appendf("# batched: %d\n", fGeoData.count()); | 205 str.appendf("# batched: %d\n", fRects.count()); |
208 for (int i = 0; i < fGeoData.count(); ++i) { | 206 for (int i = 0; i < fRects.count(); ++i) { |
209 const Geometry& geo = fGeoData[i]; | 207 const RectInfo& info = fRects[i]; |
210 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B:
%.2f]\n", | 208 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B:
%.2f]\n", |
211 i, geo.fColor, | 209 i, info.fColor, |
212 geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.f
Rect.fBottom); | 210 info.fRect.fLeft, info.fRect.fTop, info.fRect.fRight, in
fo.fRect.fBottom); |
213 } | 211 } |
214 str.append(INHERITED::dumpInfo()); | 212 str.append(INHERITED::dumpInfo()); |
215 return str; | 213 return str; |
216 } | 214 } |
217 | 215 |
218 void computePipelineOptimizations(GrInitInvariantOutput* color, | 216 void computePipelineOptimizations(GrInitInvariantOutput* color, |
219 GrInitInvariantOutput* coverage, | 217 GrInitInvariantOutput* coverage, |
220 GrBatchToXPOverrides* overrides) const ove
rride { | 218 GrBatchToXPOverrides* overrides) const ove
rride { |
221 // When this is called on a batch, there is only one geometry bundle | 219 // When this is called on a batch, there is only one rect |
222 color->setKnownFourComponents(fGeoData[0].fColor); | 220 color->setKnownFourComponents(fRects[0].fColor); |
223 coverage->setUnknownSingleComponent(); | 221 coverage->setUnknownSingleComponent(); |
224 } | 222 } |
225 | 223 |
226 void initBatchTracker(const GrXPOverridesForBatch& overrides) override { | 224 void initBatchTracker(const GrXPOverridesForBatch& overrides) override { |
227 overrides.getOverrideColorIfSet(&fGeoData[0].fColor); | 225 overrides.getOverrideColorIfSet(&fRects[0].fColor); |
228 fOverrides = overrides; | 226 fOverrides = overrides; |
229 } | 227 } |
230 | 228 |
231 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | |
232 | |
233 // After seeding, the client should call init() so the Batch can initialize
itself | |
234 void init() { fBounds = fGeoData[0].fDevRect; } | |
235 | |
236 private: | 229 private: |
237 AAFillRectNoLocalMatrixBatch() : INHERITED(ClassID()) {} | 230 AAFillRectNoLocalMatrixBatch() : INHERITED(ClassID()) {} |
238 | 231 |
239 void onPrepareDraws(Target* target) const override { | 232 void onPrepareDraws(Target* target) const override { |
240 sk_sp<GrGeometryProcessor> gp = | 233 sk_sp<GrGeometryProcessor> gp = |
241 create_fill_rect_gp(fGeoData[0].fViewMatrix, fOverrides, | 234 create_fill_rect_gp(fRects[0].fViewMatrix, fOverrides, |
242 GrDefaultGeoProcFactory::LocalCoords::kUsePo
sition_Type); | 235 GrDefaultGeoProcFactory::LocalCoords::kUsePo
sition_Type); |
243 if (!gp) { | 236 if (!gp) { |
244 SkDebugf("Couldn't create GrGeometryProcessor\n"); | 237 SkDebugf("Couldn't create GrGeometryProcessor\n"); |
245 return; | 238 return; |
246 } | 239 } |
247 SkASSERT(fOverrides.canTweakAlphaForCoverage() ? | 240 SkASSERT(fOverrides.canTweakAlphaForCoverage() ? |
248 gp->getVertexStride() == sizeof(GrDefaultGeoProcFactory::Po
sitionColorAttr) : | 241 gp->getVertexStride() == sizeof(GrDefaultGeoProcFactory::Po
sitionColorAttr) : |
249 gp->getVertexStride() == | 242 gp->getVertexStride() == |
250 sizeof(GrDefaultGeoProcFactory::PositionColorCoverageAt
tr)); | 243 sizeof(GrDefaultGeoProcFactory::PositionColorCoverageAt
tr)); |
251 | 244 |
252 size_t vertexStride = gp->getVertexStride(); | 245 size_t vertexStride = gp->getVertexStride(); |
253 int instanceCount = fGeoData.count(); | |
254 | 246 |
255 SkAutoTUnref<const GrBuffer> indexBuffer(get_index_buffer(target->resour
ceProvider())); | 247 SkAutoTUnref<const GrBuffer> indexBuffer(get_index_buffer(target->resour
ceProvider())); |
256 InstancedHelper helper; | 248 InstancedHelper helper; |
257 void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexS
tride, | 249 void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexS
tride, |
258 indexBuffer, kVertsPerAAFillRect, | 250 indexBuffer, kVertsPerAAFillRect, |
259 kIndicesPerAAFillRect, instanceCount); | 251 kIndicesPerAAFillRect, fRects.count()); |
260 if (!vertices || !indexBuffer) { | 252 if (!vertices || !indexBuffer) { |
261 SkDebugf("Could not allocate vertices\n"); | 253 SkDebugf("Could not allocate vertices\n"); |
262 return; | 254 return; |
263 } | 255 } |
264 | 256 |
265 for (int i = 0; i < instanceCount; i++) { | 257 for (int i = 0; i < fRects.count(); i++) { |
266 intptr_t verts = reinterpret_cast<intptr_t>(vertices) + | 258 intptr_t verts = reinterpret_cast<intptr_t>(vertices) + |
267 i * kVertsPerAAFillRect * vertexStride; | 259 i * kVertsPerAAFillRect * vertexStride; |
268 generate_aa_fill_rect_geometry(verts, vertexStride, | 260 generate_aa_fill_rect_geometry(verts, vertexStride, |
269 fGeoData[i].fColor, fGeoData[i].fView
Matrix, | 261 fRects[i].fColor, fRects[i].fViewMatr
ix, |
270 fGeoData[i].fRect, fGeoData[i].fDevRe
ct, fOverrides, | 262 fRects[i].fRect, fRects[i].fDevRect,
fOverrides, |
271 nullptr); | 263 nullptr); |
272 } | 264 } |
273 helper.recordDraw(target, gp.get()); | 265 helper.recordDraw(target, gp.get()); |
274 } | 266 } |
275 | 267 |
276 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { | 268 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
277 AAFillRectNoLocalMatrixBatch* that = t->cast<AAFillRectNoLocalMatrixBatc
h>(); | 269 AAFillRectNoLocalMatrixBatch* that = t->cast<AAFillRectNoLocalMatrixBatc
h>(); |
278 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi
peline(), | 270 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi
peline(), |
279 that->bounds(), caps)) { | 271 that->bounds(), caps)) { |
280 return false; | 272 return false; |
281 } | 273 } |
282 | 274 |
283 // We apply the viewmatrix to the rect points on the cpu. However, if t
he pipeline uses | 275 // We apply the viewmatrix to the rect points on the cpu. However, if t
he pipeline uses |
284 // local coords then we won't be able to batch. We could actually uploa
d the viewmatrix | 276 // local coords then we won't be able to batch. We could actually uploa
d the viewmatrix |
285 // using vertex attributes in these cases, but haven't investigated that | 277 // using vertex attributes in these cases, but haven't investigated that |
286 if (fOverrides.readsLocalCoords() && | 278 if (fOverrides.readsLocalCoords() && |
287 !fGeoData[0].fViewMatrix.cheapEqualTo(that->fGeoData[0].fViewMatrix)
) { | 279 !fRects[0].fViewMatrix.cheapEqualTo(that->fRects[0].fViewMatrix)) { |
288 return false; | 280 return false; |
289 } | 281 } |
290 | 282 |
291 // In the event of two batches, one who can tweak, one who cannot, we ju
st fall back to | 283 // In the event of two batches, one who can tweak, one who cannot, we ju
st fall back to |
292 // not tweaking | 284 // not tweaking |
293 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA
lphaForCoverage()) { | 285 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA
lphaForCoverage()) { |
294 fOverrides = that->fOverrides; | 286 fOverrides = that->fOverrides; |
295 } | 287 } |
296 | 288 |
297 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; | 289 fRects.push_back_n(that->fRects.count(), that->fRects.begin()); |
298 this->joinBounds(that->bounds()); | 290 this->joinBounds(that->bounds()); |
299 return true; | 291 return true; |
300 } | 292 } |
301 | 293 |
| 294 struct RectInfo { |
| 295 GrColor fColor; |
| 296 SkMatrix fViewMatrix; |
| 297 SkRect fRect; |
| 298 SkRect fDevRect; |
| 299 }; |
| 300 |
302 GrXPOverridesForBatch fOverrides; | 301 GrXPOverridesForBatch fOverrides; |
303 SkSTArray<1, Geometry, true> fGeoData; | 302 SkSTArray<1, RectInfo, true> fRects; |
304 | 303 |
305 typedef GrVertexBatch INHERITED; | 304 typedef GrVertexBatch INHERITED; |
306 }; | 305 }; |
307 | 306 |
308 class AAFillRectLocalMatrixBatch : public GrVertexBatch { | 307 class AAFillRectLocalMatrixBatch : public GrVertexBatch { |
309 public: | 308 public: |
310 DEFINE_BATCH_CLASS_ID | 309 DEFINE_BATCH_CLASS_ID |
311 | 310 |
312 struct Geometry { | 311 AAFillRectLocalMatrixBatch(GrColor color, |
313 SkMatrix fViewMatrix; | 312 const SkMatrix& viewMatrix, |
314 SkMatrix fLocalMatrix; | 313 const SkMatrix& localMatrix, |
315 SkRect fRect; | 314 const SkRect& rect, |
316 SkRect fDevRect; | 315 const SkRect& devRect) : INHERITED(ClassID()) { |
317 GrColor fColor; | 316 fRects.emplace_back(RectInfo{color, viewMatrix, localMatrix, rect, devRe
ct}); |
318 }; | 317 fBounds = devRect; |
319 | 318 } |
320 static AAFillRectLocalMatrixBatch* Create() { return new AAFillRectLocalMatr
ixBatch; } | |
321 | 319 |
322 const char* name() const override { return "AAFillRectBatchLocalMatrix"; } | 320 const char* name() const override { return "AAFillRectBatchLocalMatrix"; } |
323 | 321 |
324 SkString dumpInfo() const override { | 322 SkString dumpInfo() const override { |
325 SkString str; | 323 SkString str; |
326 str.appendf("# batched: %d\n", fGeoData.count()); | 324 str.appendf("# batched: %d\n", fRects.count()); |
327 for (int i = 0; i < fGeoData.count(); ++i) { | 325 for (int i = 0; i < fRects.count(); ++i) { |
328 const Geometry& geo = fGeoData[i]; | 326 const RectInfo& info = fRects[i]; |
329 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B:
%.2f]\n", | 327 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B:
%.2f]\n", |
330 i, geo.fColor, | 328 i, info.fColor, |
331 geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.f
Rect.fBottom); | 329 info.fRect.fLeft, info.fRect.fTop, info.fRect.fRight, in
fo.fRect.fBottom); |
332 } | 330 } |
333 str.append(INHERITED::dumpInfo()); | 331 str.append(INHERITED::dumpInfo()); |
334 return str; | 332 return str; |
335 } | 333 } |
336 | 334 |
337 void computePipelineOptimizations(GrInitInvariantOutput* color, | 335 void computePipelineOptimizations(GrInitInvariantOutput* color, |
338 GrInitInvariantOutput* coverage, | 336 GrInitInvariantOutput* coverage, |
339 GrBatchToXPOverrides* overrides) const ove
rride { | 337 GrBatchToXPOverrides* overrides) const ove
rride { |
340 // When this is called on a batch, there is only one geometry bundle | 338 // When this is called on a batch, there is only one rect |
341 color->setKnownFourComponents(fGeoData[0].fColor); | 339 color->setKnownFourComponents(fRects[0].fColor); |
342 coverage->setUnknownSingleComponent(); | 340 coverage->setUnknownSingleComponent(); |
343 } | 341 } |
344 | 342 |
345 void initBatchTracker(const GrXPOverridesForBatch& overrides) override { | 343 void initBatchTracker(const GrXPOverridesForBatch& overrides) override { |
346 overrides.getOverrideColorIfSet(&fGeoData[0].fColor); | 344 overrides.getOverrideColorIfSet(&fRects[0].fColor); |
347 fOverrides = overrides; | 345 fOverrides = overrides; |
348 } | 346 } |
349 | 347 |
350 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | |
351 | |
352 // After seeding, the client should call init() so the Batch can initialize
itself | |
353 void init() { fBounds = fGeoData[0].fDevRect; } | |
354 | |
355 private: | 348 private: |
356 AAFillRectLocalMatrixBatch() : INHERITED(ClassID()) {} | 349 AAFillRectLocalMatrixBatch() : INHERITED(ClassID()) {} |
357 | 350 |
358 void onPrepareDraws(Target* target) const override { | 351 void onPrepareDraws(Target* target) const override { |
359 sk_sp<GrGeometryProcessor> gp = | 352 sk_sp<GrGeometryProcessor> gp = |
360 create_fill_rect_gp(fGeoData[0].fViewMatrix, fOverrides, | 353 create_fill_rect_gp(fRects[0].fViewMatrix, fOverrides, |
361 GrDefaultGeoProcFactory::LocalCoords::kHasEx
plicit_Type); | 354 GrDefaultGeoProcFactory::LocalCoords::kHasEx
plicit_Type); |
362 if (!gp) { | 355 if (!gp) { |
363 SkDebugf("Couldn't create GrGeometryProcessor\n"); | 356 SkDebugf("Couldn't create GrGeometryProcessor\n"); |
364 return; | 357 return; |
365 } | 358 } |
366 SkASSERT(fOverrides.canTweakAlphaForCoverage() ? | 359 SkASSERT(fOverrides.canTweakAlphaForCoverage() ? |
367 gp->getVertexStride() == | 360 gp->getVertexStride() == |
368 sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoordAttr) : | 361 sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoordAttr) : |
369 gp->getVertexStride() == | 362 gp->getVertexStride() == |
370 sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoordCoverage
)); | 363 sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoordCoverage
)); |
371 | 364 |
372 size_t vertexStride = gp->getVertexStride(); | 365 size_t vertexStride = gp->getVertexStride(); |
373 int instanceCount = fGeoData.count(); | |
374 | 366 |
375 SkAutoTUnref<const GrBuffer> indexBuffer(get_index_buffer(target->resour
ceProvider())); | 367 SkAutoTUnref<const GrBuffer> indexBuffer(get_index_buffer(target->resour
ceProvider())); |
376 InstancedHelper helper; | 368 InstancedHelper helper; |
377 void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexS
tride, | 369 void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexS
tride, |
378 indexBuffer, kVertsPerAAFillRect, | 370 indexBuffer, kVertsPerAAFillRect, |
379 kIndicesPerAAFillRect, instanceCount); | 371 kIndicesPerAAFillRect, fRects.count()); |
380 if (!vertices || !indexBuffer) { | 372 if (!vertices || !indexBuffer) { |
381 SkDebugf("Could not allocate vertices\n"); | 373 SkDebugf("Could not allocate vertices\n"); |
382 return; | 374 return; |
383 } | 375 } |
384 | 376 |
385 for (int i = 0; i < instanceCount; i++) { | 377 for (int i = 0; i < fRects.count(); i++) { |
386 intptr_t verts = reinterpret_cast<intptr_t>(vertices) + | 378 intptr_t verts = reinterpret_cast<intptr_t>(vertices) + |
387 i * kVertsPerAAFillRect * vertexStride; | 379 i * kVertsPerAAFillRect * vertexStride; |
388 generate_aa_fill_rect_geometry(verts, vertexStride, fGeoData[i].fCol
or, | 380 generate_aa_fill_rect_geometry(verts, vertexStride, fRects[i].fColor
, |
389 fGeoData[i].fViewMatrix, fGeoData[i].
fRect, | 381 fRects[i].fViewMatrix, fRects[i].fRec
t, |
390 fGeoData[i].fDevRect, fOverrides, | 382 fRects[i].fDevRect, fOverrides, |
391 &fGeoData[i].fLocalMatrix); | 383 &fRects[i].fLocalMatrix); |
392 } | 384 } |
393 helper.recordDraw(target, gp.get()); | 385 helper.recordDraw(target, gp.get()); |
394 } | 386 } |
395 | 387 |
396 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { | 388 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
397 AAFillRectLocalMatrixBatch* that = t->cast<AAFillRectLocalMatrixBatch>()
; | 389 AAFillRectLocalMatrixBatch* that = t->cast<AAFillRectLocalMatrixBatch>()
; |
398 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi
peline(), | 390 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi
peline(), |
399 that->bounds(), caps)) { | 391 that->bounds(), caps)) { |
400 return false; | 392 return false; |
401 } | 393 } |
402 | 394 |
403 // In the event of two batches, one who can tweak, one who cannot, we ju
st fall back to | 395 // In the event of two batches, one who can tweak, one who cannot, we ju
st fall back to |
404 // not tweaking | 396 // not tweaking |
405 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA
lphaForCoverage()) { | 397 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA
lphaForCoverage()) { |
406 fOverrides = that->fOverrides; | 398 fOverrides = that->fOverrides; |
407 } | 399 } |
408 | 400 |
409 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; | 401 fRects.push_back_n(that->fRects.count(), that->fRects.begin()); |
410 this->joinBounds(that->bounds()); | 402 this->joinBounds(that->bounds()); |
411 return true; | 403 return true; |
412 } | 404 } |
413 | 405 |
| 406 struct RectInfo { |
| 407 GrColor fColor; |
| 408 SkMatrix fViewMatrix; |
| 409 SkMatrix fLocalMatrix; |
| 410 SkRect fRect; |
| 411 SkRect fDevRect; |
| 412 }; |
| 413 |
414 GrXPOverridesForBatch fOverrides; | 414 GrXPOverridesForBatch fOverrides; |
415 SkSTArray<1, Geometry, true> fGeoData; | 415 SkSTArray<1, RectInfo, true> fRects; |
416 | 416 |
417 typedef GrVertexBatch INHERITED; | 417 typedef GrVertexBatch INHERITED; |
418 }; | 418 }; |
419 | 419 |
420 namespace GrAAFillRectBatch { | 420 namespace GrAAFillRectBatch { |
421 | 421 |
422 GrDrawBatch* Create(GrColor color, | 422 GrDrawBatch* Create(GrColor color, |
423 const SkMatrix& viewMatrix, | 423 const SkMatrix& viewMatrix, |
424 const SkRect& rect, | 424 const SkRect& rect, |
425 const SkRect& devRect) { | 425 const SkRect& devRect) { |
426 AAFillRectNoLocalMatrixBatch* batch = AAFillRectNoLocalMatrixBatch::Create()
; | 426 return new AAFillRectNoLocalMatrixBatch(color, viewMatrix, rect, devRect); |
427 AAFillRectNoLocalMatrixBatch::Geometry& geo = batch->geoData()->push_back(); | |
428 geo.fColor = color; | |
429 geo.fViewMatrix = viewMatrix; | |
430 geo.fRect = rect; | |
431 geo.fDevRect = devRect; | |
432 batch->init(); | |
433 return batch; | |
434 } | 427 } |
435 | 428 |
436 GrDrawBatch* Create(GrColor color, | 429 GrDrawBatch* Create(GrColor color, |
437 const SkMatrix& viewMatrix, | 430 const SkMatrix& viewMatrix, |
438 const SkMatrix& localMatrix, | 431 const SkMatrix& localMatrix, |
439 const SkRect& rect, | 432 const SkRect& rect, |
440 const SkRect& devRect) { | 433 const SkRect& devRect) { |
441 AAFillRectLocalMatrixBatch* batch = AAFillRectLocalMatrixBatch::Create(); | 434 return new AAFillRectLocalMatrixBatch(color, viewMatrix, localMatrix, rect,
devRect); |
442 AAFillRectLocalMatrixBatch::Geometry& geo = batch->geoData()->push_back(); | |
443 geo.fColor = color; | |
444 geo.fViewMatrix = viewMatrix; | |
445 geo.fLocalMatrix = localMatrix; | |
446 geo.fRect = rect; | |
447 geo.fDevRect = devRect; | |
448 batch->init(); | |
449 return batch; | |
450 } | 435 } |
451 | 436 |
452 GrDrawBatch* Create(GrColor color, | 437 GrDrawBatch* Create(GrColor color, |
453 const SkMatrix& viewMatrix, | 438 const SkMatrix& viewMatrix, |
454 const SkMatrix& localMatrix, | 439 const SkMatrix& localMatrix, |
455 const SkRect& rect) { | 440 const SkRect& rect) { |
456 SkRect devRect; | 441 SkRect devRect; |
457 viewMatrix.mapRect(&devRect, rect); | 442 viewMatrix.mapRect(&devRect, rect); |
458 return Create(color, viewMatrix, localMatrix, rect, devRect); | 443 return Create(color, viewMatrix, localMatrix, rect, devRect); |
459 } | 444 } |
(...skipping 30 matching lines...) Expand all Loading... |
490 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) { | 475 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) { |
491 GrColor color = GrRandomColor(random); | 476 GrColor color = GrRandomColor(random); |
492 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); | 477 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); |
493 SkMatrix localMatrix = GrTest::TestMatrix(random); | 478 SkMatrix localMatrix = GrTest::TestMatrix(random); |
494 SkRect rect = GrTest::TestRect(random); | 479 SkRect rect = GrTest::TestRect(random); |
495 SkRect devRect = GrTest::TestRect(random); | 480 SkRect devRect = GrTest::TestRect(random); |
496 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe
ct); | 481 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe
ct); |
497 } | 482 } |
498 | 483 |
499 #endif | 484 #endif |
OLD | NEW |