Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: src/gpu/batches/GrAAFillRectBatch.cpp

Issue 2114663003: Remove GrTInstanceBatch (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Remove GrTInstanceBatch Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/batches/GrNonAAFillRectBatch.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrColor.h" 11 #include "GrColor.h"
11 #include "GrDefaultGeoProcFactory.h" 12 #include "GrDefaultGeoProcFactory.h"
12 #include "GrResourceKey.h" 13 #include "GrResourceKey.h"
13 #include "GrResourceProvider.h" 14 #include "GrResourceProvider.h"
14 #include "GrTInstanceBatch.h"
15 #include "GrTypes.h" 15 #include "GrTypes.h"
16 #include "SkMatrix.h" 16 #include "SkMatrix.h"
17 #include "SkRect.h" 17 #include "SkRect.h"
18 #include "GrVertexBatch.h"
18 19
19 GR_DECLARE_STATIC_UNIQUE_KEY(gAAFillRectIndexBufferKey); 20 GR_DECLARE_STATIC_UNIQUE_KEY(gAAFillRectIndexBufferKey);
20 21
21 static void set_inset_fan(SkPoint* pts, size_t stride, 22 static void set_inset_fan(SkPoint* pts, size_t stride,
22 const SkRect& r, SkScalar dx, SkScalar dy) { 23 const SkRect& r, SkScalar dx, SkScalar dy) {
23 pts->setRectFan(r.fLeft + dx, r.fTop + dy, 24 pts->setRectFan(r.fLeft + dx, r.fTop + dy,
24 r.fRight - dx, r.fBottom - dy, stride); 25 r.fRight - dx, r.fBottom - dy, stride);
25 } 26 }
26 27
27 static const int kNumAAFillRectsInIndexBuffer = 256; 28 static const int kNumAAFillRectsInIndexBuffer = 256;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 if (tweakAlphaForCoverage) { 180 if (tweakAlphaForCoverage) {
180 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = scaledColor; 181 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = scaledColor;
181 } else { 182 } else {
182 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = color; 183 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = color;
183 *reinterpret_cast<float*>(verts + i * vertexStride + 184 *reinterpret_cast<float*>(verts + i * vertexStride +
184 coverageOffset) = innerCoverage; 185 coverageOffset) = innerCoverage;
185 } 186 }
186 } 187 }
187 } 188 }
188 189
189 // Common functions 190 class AAFillRectNoLocalMatrixBatch : public GrVertexBatch {
190 class AAFillRectBatchBase {
191 public: 191 public:
192 DEFINE_BATCH_CLASS_ID
193
194 struct Geometry {
195 SkMatrix fViewMatrix;
196 SkRect fRect;
197 SkRect fDevRect;
198 GrColor fColor;
199 };
200
201 static AAFillRectNoLocalMatrixBatch* Create() { return new AAFillRectNoLocal MatrixBatch; }
202
robertphillips 2016/06/30 19:22:16 rm Name too ?
203 const char* name() const override { return Name(); }
204
205 SkString dumpInfo() const override {
206 SkString str;
207 str.appendf("# batched: %d\n", fGeoData.count());
208 for (int i = 0; i < fGeoData.count(); ++i) {
209 str.append(DumpInfo(fGeoData[i], i));
210 }
211 str.append(INHERITED::dumpInfo());
212 return str;
213 }
214
215 void computePipelineOptimizations(GrInitInvariantOutput* color,
216 GrInitInvariantOutput* coverage,
217 GrBatchToXPOverrides* overrides) const ove rride {
218 // When this is called on a batch, there is only one geometry bundle
219 color->setKnownFourComponents(fGeoData[0].fColor);
robertphillips 2016/06/30 19:22:16 rm InitInvariantOutput ?
220 InitInvariantOutputCoverage(coverage);
221 }
222
223 void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
224 overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
225 fOverrides = overrides;
226 }
227
228 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
229
230 // After seeding, the client should call init() so the Batch can initialize itself
231 void init() {
232 const Geometry& geo = fGeoData[0];
robertphillips 2016/06/30 19:22:16 fold this in ?
233 SetBounds(geo, &fBounds);
234 }
235
236 void updateBoundsAfterAppend() {
237 const Geometry& geo = fGeoData.back();
robertphillips 2016/06/30 19:22:16 this too ?
238 UpdateBoundsAfterAppend(geo, &fBounds);
239 }
240
241 private:
192 static const int kVertsPerInstance = kVertsPerAAFillRect; 242 static const int kVertsPerInstance = kVertsPerAAFillRect;
193 static const int kIndicesPerInstance = kIndicesPerAAFillRect; 243 static const int kIndicesPerInstance = kIndicesPerAAFillRect;
194 244
195 static void InitInvariantOutputCoverage(GrInitInvariantOutput* out) { 245 static void InitInvariantOutputCoverage(GrInitInvariantOutput* out) {
196 out->setUnknownSingleComponent(); 246 out->setUnknownSingleComponent();
197 } 247 }
198 248
199 static const GrBuffer* GetIndexBuffer(GrResourceProvider* rp) { 249 static const GrBuffer* GetIndexBuffer(GrResourceProvider* rp) {
200 return get_index_buffer(rp); 250 return get_index_buffer(rp);
201 } 251 }
202 252
203 template <class Geometry>
204 static void SetBounds(const Geometry& geo, SkRect* outBounds) { 253 static void SetBounds(const Geometry& geo, SkRect* outBounds) {
205 *outBounds = geo.fDevRect; 254 *outBounds = geo.fDevRect;
206 } 255 }
207 256
208 template <class Geometry>
209 static void UpdateBoundsAfterAppend(const Geometry& geo, SkRect* outBounds) { 257 static void UpdateBoundsAfterAppend(const Geometry& geo, SkRect* outBounds) {
210 outBounds->join(geo.fDevRect); 258 outBounds->join(geo.fDevRect);
211 } 259 }
212 };
213
214 class AAFillRectBatchNoLocalMatrixImp : public AAFillRectBatchBase {
215 public:
216 struct Geometry {
217 SkMatrix fViewMatrix;
218 SkRect fRect;
219 SkRect fDevRect;
220 GrColor fColor;
221 };
222 260
223 static const char* Name() { return "AAFillRectBatchNoLocalMatrix"; } 261 static const char* Name() { return "AAFillRectBatchNoLocalMatrix"; }
224 262
225 static SkString DumpInfo(const Geometry& geo, int index) { 263 static SkString DumpInfo(const Geometry& geo, int index) {
226 SkString str; 264 SkString str;
227 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f ]\n", 265 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f ]\n",
228 index, 266 index,
229 geo.fColor, 267 geo.fColor,
230 geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.fRect .fBottom); 268 geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.fRect .fBottom);
231 return str; 269 return str;
232 } 270 }
233 271
234 static bool CanCombine(const Geometry& mine, const Geometry& theirs, 272 static bool CanCombine(const Geometry& mine, const Geometry& theirs,
235 const GrXPOverridesForBatch& overrides) { 273 const GrXPOverridesForBatch& overrides) {
236 // We apply the viewmatrix to the rect points on the cpu. However, if t he pipeline uses 274 // We apply the viewmatrix to the rect points on the cpu. However, if t he pipeline uses
237 // local coords then we won't be able to batch. We could actually uploa d the viewmatrix 275 // local coords then we won't be able to batch. We could actually uploa d the viewmatrix
238 // using vertex attributes in these cases, but haven't investigated that 276 // using vertex attributes in these cases, but haven't investigated that
239 return !overrides.readsLocalCoords() || mine.fViewMatrix.cheapEqualTo(th eirs.fViewMatrix); 277 return !overrides.readsLocalCoords() || mine.fViewMatrix.cheapEqualTo(th eirs.fViewMatrix);
240 } 278 }
241 279
242 static sk_sp<GrGeometryProcessor> MakeGP(const Geometry& geo, 280 static sk_sp<GrGeometryProcessor> MakeGP(const Geometry& geo,
243 const GrXPOverridesForBatch& over rides) { 281 const GrXPOverridesForBatch& overri des) {
244 sk_sp<GrGeometryProcessor> gp = 282 sk_sp<GrGeometryProcessor> gp =
245 create_fill_rect_gp(geo.fViewMatrix, overrides, 283 create_fill_rect_gp(geo.fViewMatrix, overrides,
246 GrDefaultGeoProcFactory::LocalCoords::kUsePo sition_Type); 284 GrDefaultGeoProcFactory::LocalCoords::kUsePo sition_Type);
247 285
248 SkASSERT(overrides.canTweakAlphaForCoverage() ? 286 SkASSERT(overrides.canTweakAlphaForCoverage() ?
249 gp->getVertexStride() == sizeof(GrDefaultGeoProcFactory::Positi onColorAttr) : 287 gp->getVertexStride() == sizeof(GrDefaultGeoProcFactory::Positi onColorAttr) :
250 gp->getVertexStride() == 288 gp->getVertexStride() ==
251 sizeof(GrDefaultGeoProcFactory::PositionColorCoverageAt tr)); 289 sizeof(GrDefaultGeoProcFactory::PositionColorCoverageAt tr));
252 return gp; 290 return gp;
253 } 291 }
254 292
255 static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry & geo, 293 static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry & geo,
256 const GrXPOverridesForBatch& overrides) { 294 const GrXPOverridesForBatch& overrides) {
257 generate_aa_fill_rect_geometry(vertices, vertexStride, 295 generate_aa_fill_rect_geometry(vertices, vertexStride,
258 geo.fColor, geo.fViewMatrix, geo.fRect, g eo.fDevRect, 296 geo.fColor, geo.fViewMatrix, geo.fRect, g eo.fDevRect,
259 overrides, nullptr); 297 overrides, nullptr);
260 } 298 }
299
300 AAFillRectNoLocalMatrixBatch() : INHERITED(ClassID()) {}
301
302 void onPrepareDraws(Target* target) const override {
303 sk_sp<GrGeometryProcessor> gp(MakeGP(this->seedGeometry(), fOverrides));
304 if (!gp) {
305 SkDebugf("Couldn't create GrGeometryProcessor\n");
306 return;
307 }
308
309 size_t vertexStride = gp->getVertexStride();
310 int instanceCount = fGeoData.count();
311
312 SkAutoTUnref<const GrBuffer> indexBuffer(GetIndexBuffer(target->resource Provider()));
313 InstancedHelper helper;
314 void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexS tride,
315 indexBuffer, kVertsPerInstance,
316 kIndicesPerInstance, instanceCount);
317 if (!vertices || !indexBuffer) {
318 SkDebugf("Could not allocate vertices\n");
319 return;
320 }
321
322 for (int i = 0; i < instanceCount; i++) {
323 intptr_t verts = reinterpret_cast<intptr_t>(vertices) +
324 i * kVertsPerInstance * vertexStride;
robertphillips 2016/06/30 19:22:16 rm Tesselate ?
325 Tesselate(verts, vertexStride, fGeoData[i], fOverrides);
326 }
327 helper.recordDraw(target, gp.get());
328 }
329
330 const Geometry& seedGeometry() const { return fGeoData[0]; }
331
332 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
333 AAFillRectNoLocalMatrixBatch* that = t->cast<AAFillRectNoLocalMatrixBatc h>();
334 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(),
335 that->bounds(), caps)) {
336 return false;
337 }
338
339 if (!CanCombine(this->seedGeometry(), that->seedGeometry(), fOverrides)) {
340 return false;
341 }
342
343 // In the event of two batches, one who can tweak, one who cannot, we ju st fall back to
344 // not tweaking
345 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA lphaForCoverage()) {
346 fOverrides = that->fOverrides;
347 }
348
349 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ;
350 this->joinBounds(that->bounds());
351 return true;
352 }
353
354 GrXPOverridesForBatch fOverrides;
355 SkSTArray<1, Geometry, true> fGeoData;
356
357 typedef GrVertexBatch INHERITED;
261 }; 358 };
262 359
263 class AAFillRectBatchLocalMatrixImp : public AAFillRectBatchBase { 360 class AAFillRectLocalMatrixBatch : public GrVertexBatch {
264 public: 361 public:
362 DEFINE_BATCH_CLASS_ID
363
265 struct Geometry { 364 struct Geometry {
266 SkMatrix fViewMatrix; 365 SkMatrix fViewMatrix;
267 SkMatrix fLocalMatrix; 366 SkMatrix fLocalMatrix;
268 SkRect fRect; 367 SkRect fRect;
269 SkRect fDevRect; 368 SkRect fDevRect;
270 GrColor fColor; 369 GrColor fColor;
271 }; 370 };
272 371
372 static AAFillRectLocalMatrixBatch* Create() { return new AAFillRectLocalMatr ixBatch; }
373
robertphillips 2016/06/30 19:22:16 same here
374 const char* name() const override { return Name(); }
375
376 SkString dumpInfo() const override {
377 SkString str;
378 str.appendf("# batched: %d\n", fGeoData.count());
379 for (int i = 0; i < fGeoData.count(); ++i) {
380 str.append(DumpInfo(fGeoData[i], i));
381 }
382 str.append(INHERITED::dumpInfo());
383 return str;
384 }
385
386 void computePipelineOptimizations(GrInitInvariantOutput* color,
387 GrInitInvariantOutput* coverage,
388 GrBatchToXPOverrides* overrides) const ove rride {
389 // When this is called on a batch, there is only one geometry bundle
390 color->setKnownFourComponents(fGeoData[0].fColor);
robertphillips 2016/06/30 19:22:16 rm InitInvariantOutput ?
391 InitInvariantOutputCoverage(coverage);
392 }
393
394 void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
395 overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
396 fOverrides = overrides;
397 }
398
399 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
400
401 // After seeding, the client should call init() so the Batch can initialize itself
402 void init() {
403 const Geometry& geo = fGeoData[0];
404 SetBounds(geo, &fBounds);
405 }
406
407 void updateBoundsAfterAppend() {
408 const Geometry& geo = fGeoData.back();
409 UpdateBoundsAfterAppend(geo, &fBounds);
410 }
411
412 private:
413 static const int kVertsPerInstance = kVertsPerAAFillRect;
414 static const int kIndicesPerInstance = kIndicesPerAAFillRect;
415
416 static void InitInvariantOutputCoverage(GrInitInvariantOutput* out) {
417 out->setUnknownSingleComponent();
418 }
419
420 static const GrBuffer* GetIndexBuffer(GrResourceProvider* rp) {
421 return get_index_buffer(rp);
422 }
423
424 static void SetBounds(const Geometry& geo, SkRect* outBounds) {
425 *outBounds = geo.fDevRect;
426 }
427
428 static void UpdateBoundsAfterAppend(const Geometry& geo, SkRect* outBounds) {
429 outBounds->join(geo.fDevRect);
430 }
431
273 static const char* Name() { return "AAFillRectBatchLocalMatrix"; } 432 static const char* Name() { return "AAFillRectBatchLocalMatrix"; }
274 433
275 static SkString DumpInfo(const Geometry& geo, int index) { 434 static SkString DumpInfo(const Geometry& geo, int index) {
276 SkString str; 435 SkString str;
277 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f ]\n", 436 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f ]\n",
278 index, 437 index,
279 geo.fColor, 438 geo.fColor,
280 geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.fRect .fBottom); 439 geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.fRect .fBottom);
281 return str; 440 return str;
282 } 441 }
(...skipping 16 matching lines...) Expand all
299 sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoord Coverage)); 458 sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoord Coverage));
300 return gp; 459 return gp;
301 } 460 }
302 461
303 static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry & geo, 462 static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry & geo,
304 const GrXPOverridesForBatch& overrides) { 463 const GrXPOverridesForBatch& overrides) {
305 generate_aa_fill_rect_geometry(vertices, vertexStride, 464 generate_aa_fill_rect_geometry(vertices, vertexStride,
306 geo.fColor, geo.fViewMatrix, geo.fRect, g eo.fDevRect, 465 geo.fColor, geo.fViewMatrix, geo.fRect, g eo.fDevRect,
307 overrides, &geo.fLocalMatrix); 466 overrides, &geo.fLocalMatrix);
308 } 467 }
468
469 AAFillRectLocalMatrixBatch() : INHERITED(ClassID()) {}
470
471 void onPrepareDraws(Target* target) const override {
472 sk_sp<GrGeometryProcessor> gp(MakeGP(this->seedGeometry(), fOverrides));
473 if (!gp) {
474 SkDebugf("Couldn't create GrGeometryProcessor\n");
475 return;
476 }
477
478 size_t vertexStride = gp->getVertexStride();
479 int instanceCount = fGeoData.count();
480
481 SkAutoTUnref<const GrBuffer> indexBuffer(GetIndexBuffer(target->resource Provider()));
482 InstancedHelper helper;
483 void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexS tride,
484 indexBuffer, kVertsPerInstance,
485 kIndicesPerInstance, instanceCount);
486 if (!vertices || !indexBuffer) {
487 SkDebugf("Could not allocate vertices\n");
488 return;
489 }
490
491 for (int i = 0; i < instanceCount; i++) {
492 intptr_t verts = reinterpret_cast<intptr_t>(vertices) +
493 i * kVertsPerInstance * vertexStride;
robertphillips 2016/06/30 19:22:16 rm Tesselate here too ?
494 Tesselate(verts, vertexStride, fGeoData[i], fOverrides);
495 }
496 helper.recordDraw(target, gp.get());
497 }
498
499 const Geometry& seedGeometry() const { return fGeoData[0]; }
500
501 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
502 AAFillRectLocalMatrixBatch* that = t->cast<AAFillRectLocalMatrixBatch>() ;
503 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(),
504 that->bounds(), caps)) {
505 return false;
506 }
507
508 if (!CanCombine(this->seedGeometry(), that->seedGeometry(), fOverrides)) {
509 return false;
510 }
511
512 // In the event of two batches, one who can tweak, one who cannot, we ju st fall back to
513 // not tweaking
514 if (fOverrides.canTweakAlphaForCoverage() && !that->fOverrides.canTweakA lphaForCoverage()) {
515 fOverrides = that->fOverrides;
516 }
517
518 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ;
519 this->joinBounds(that->bounds());
520 return true;
521 }
522
523 GrXPOverridesForBatch fOverrides;
524 SkSTArray<1, Geometry, true> fGeoData;
525
526 typedef GrVertexBatch INHERITED;
309 }; 527 };
310 528
311 typedef GrTInstanceBatch<AAFillRectBatchNoLocalMatrixImp> AAFillRectBatchNoLocal Matrix; 529 inline static void append_to_batch(AAFillRectNoLocalMatrixBatch* batch, GrColor color,
312 typedef GrTInstanceBatch<AAFillRectBatchLocalMatrixImp> AAFillRectBatchLocalMatr ix;
313
314 inline static void append_to_batch(AAFillRectBatchNoLocalMatrix* batch, GrColor color,
315 const SkMatrix& viewMatrix, const SkRect& rec t, 530 const SkMatrix& viewMatrix, const SkRect& rec t,
316 const SkRect& devRect) { 531 const SkRect& devRect) {
317 AAFillRectBatchNoLocalMatrix::Geometry& geo = batch->geoData()->push_back(); 532 AAFillRectNoLocalMatrixBatch::Geometry& geo = batch->geoData()->push_back();
318 geo.fColor = color; 533 geo.fColor = color;
319 geo.fViewMatrix = viewMatrix; 534 geo.fViewMatrix = viewMatrix;
320 geo.fRect = rect; 535 geo.fRect = rect;
321 geo.fDevRect = devRect; 536 geo.fDevRect = devRect;
322 } 537 }
323 538
324 inline static void append_to_batch(AAFillRectBatchLocalMatrix* batch, GrColor co lor, 539 inline static void append_to_batch(AAFillRectLocalMatrixBatch* batch, GrColor co lor,
325 const SkMatrix& viewMatrix, const SkMatrix& l ocalMatrix, 540 const SkMatrix& viewMatrix, const SkMatrix& l ocalMatrix,
326 const SkRect& rect, const SkRect& devRect) { 541 const SkRect& rect, const SkRect& devRect) {
327 AAFillRectBatchLocalMatrix::Geometry& geo = batch->geoData()->push_back(); 542 AAFillRectLocalMatrixBatch::Geometry& geo = batch->geoData()->push_back();
328 geo.fColor = color; 543 geo.fColor = color;
329 geo.fViewMatrix = viewMatrix; 544 geo.fViewMatrix = viewMatrix;
330 geo.fLocalMatrix = localMatrix; 545 geo.fLocalMatrix = localMatrix;
331 geo.fRect = rect; 546 geo.fRect = rect;
332 geo.fDevRect = devRect; 547 geo.fDevRect = devRect;
333 } 548 }
334 549
335 namespace GrAAFillRectBatch { 550 namespace GrAAFillRectBatch {
336 551
337 GrDrawBatch* Create(GrColor color, 552 GrDrawBatch* Create(GrColor color,
338 const SkMatrix& viewMatrix, 553 const SkMatrix& viewMatrix,
339 const SkRect& rect, 554 const SkRect& rect,
340 const SkRect& devRect) { 555 const SkRect& devRect) {
341 AAFillRectBatchNoLocalMatrix* batch = AAFillRectBatchNoLocalMatrix::Create() ; 556 AAFillRectNoLocalMatrixBatch* batch = AAFillRectNoLocalMatrixBatch::Create() ;
342 append_to_batch(batch, color, viewMatrix, rect, devRect); 557 append_to_batch(batch, color, viewMatrix, rect, devRect);
343 batch->init(); 558 batch->init();
344 return batch; 559 return batch;
345 } 560 }
346 561
347 GrDrawBatch* Create(GrColor color, 562 GrDrawBatch* Create(GrColor color,
348 const SkMatrix& viewMatrix, 563 const SkMatrix& viewMatrix,
349 const SkMatrix& localMatrix, 564 const SkMatrix& localMatrix,
350 const SkRect& rect, 565 const SkRect& rect,
351 const SkRect& devRect) { 566 const SkRect& devRect) {
352 AAFillRectBatchLocalMatrix* batch = AAFillRectBatchLocalMatrix::Create(); 567 AAFillRectLocalMatrixBatch* batch = AAFillRectLocalMatrixBatch::Create();
353 append_to_batch(batch, color, viewMatrix, localMatrix, rect, devRect); 568 append_to_batch(batch, color, viewMatrix, localMatrix, rect, devRect);
354 batch->init(); 569 batch->init();
355 return batch; 570 return batch;
356 } 571 }
357 572
358 GrDrawBatch* Create(GrColor color, 573 GrDrawBatch* Create(GrColor color,
359 const SkMatrix& viewMatrix, 574 const SkMatrix& viewMatrix,
360 const SkMatrix& localMatrix, 575 const SkMatrix& localMatrix,
361 const SkRect& rect) { 576 const SkRect& rect) {
362 SkRect devRect; 577 SkRect devRect;
(...skipping 12 matching lines...) Expand all
375 return nullptr; 590 return nullptr;
376 } 591 }
377 return Create(color, viewMatrix, localMatrix, rect, devRect); 592 return Create(color, viewMatrix, localMatrix, rect, devRect);
378 } 593 }
379 594
380 void Append(GrBatch* origBatch, 595 void Append(GrBatch* origBatch,
381 GrColor color, 596 GrColor color,
382 const SkMatrix& viewMatrix, 597 const SkMatrix& viewMatrix,
383 const SkRect& rect, 598 const SkRect& rect,
384 const SkRect& devRect) { 599 const SkRect& devRect) {
385 AAFillRectBatchNoLocalMatrix* batch = origBatch->cast<AAFillRectBatchNoLocal Matrix>(); 600 AAFillRectNoLocalMatrixBatch* batch = origBatch->cast<AAFillRectNoLocalMatri xBatch>();
386 append_to_batch(batch, color, viewMatrix, rect, devRect); 601 append_to_batch(batch, color, viewMatrix, rect, devRect);
387 batch->updateBoundsAfterAppend(); 602 batch->updateBoundsAfterAppend();
388 } 603 }
389 604
390 void Append(GrBatch* origBatch, 605 void Append(GrBatch* origBatch,
391 GrColor color, 606 GrColor color,
392 const SkMatrix& viewMatrix, 607 const SkMatrix& viewMatrix,
393 const SkMatrix& localMatrix, 608 const SkMatrix& localMatrix,
394 const SkRect& rect, 609 const SkRect& rect,
395 const SkRect& devRect) { 610 const SkRect& devRect) {
396 AAFillRectBatchLocalMatrix* batch = origBatch->cast<AAFillRectBatchLocalMatr ix>(); 611 AAFillRectLocalMatrixBatch* batch = origBatch->cast<AAFillRectLocalMatrixBat ch>();
397 append_to_batch(batch, color, viewMatrix, localMatrix, rect, devRect); 612 append_to_batch(batch, color, viewMatrix, localMatrix, rect, devRect);
398 batch->updateBoundsAfterAppend(); 613 batch->updateBoundsAfterAppend();
399 } 614 }
400 615
401 }; 616 };
402 617
403 //////////////////////////////////////////////////////////////////////////////// /////////////////// 618 //////////////////////////////////////////////////////////////////////////////// ///////////////////
404 619
405 #ifdef GR_TEST_UTILS 620 #ifdef GR_TEST_UTILS
406 621
(...skipping 10 matching lines...) Expand all
417 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) { 632 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) {
418 GrColor color = GrRandomColor(random); 633 GrColor color = GrRandomColor(random);
419 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); 634 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
420 SkMatrix localMatrix = GrTest::TestMatrix(random); 635 SkMatrix localMatrix = GrTest::TestMatrix(random);
421 SkRect rect = GrTest::TestRect(random); 636 SkRect rect = GrTest::TestRect(random);
422 SkRect devRect = GrTest::TestRect(random); 637 SkRect devRect = GrTest::TestRect(random);
423 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe ct); 638 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe ct);
424 } 639 }
425 640
426 #endif 641 #endif
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/batches/GrNonAAFillRectBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698