Chromium Code Reviews| 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 "GrColor.h" | 10 #include "GrColor.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 geo.fViewMatrix = viewMatrix; | 306 geo.fViewMatrix = viewMatrix; |
| 307 geo.fLocalMatrix = localMatrix; | 307 geo.fLocalMatrix = localMatrix; |
| 308 geo.fRect = rect; | 308 geo.fRect = rect; |
| 309 geo.fDevRect = devRect; | 309 geo.fDevRect = devRect; |
| 310 } | 310 } |
| 311 | 311 |
| 312 namespace GrAAFillRectBatch { | 312 namespace GrAAFillRectBatch { |
| 313 | 313 |
| 314 GrDrawBatch* Create(GrColor color, | 314 GrDrawBatch* Create(GrColor color, |
| 315 const SkMatrix& viewMatrix, | 315 const SkMatrix& viewMatrix, |
| 316 const SkRect& rect, | 316 const SkRect& rect, |
|
robertphillips
2015/09/25 12:48:48
We still need 'devRect' here ?
joshualitt
2015/09/25 18:17:12
I can fix in a follow on
| |
| 317 const SkRect& devRect) { | 317 const SkRect& devRect) { |
| 318 AAFillRectBatchNoLocalMatrix* batch = AAFillRectBatchNoLocalMatrix::Create() ; | 318 AAFillRectBatchNoLocalMatrix* batch = AAFillRectBatchNoLocalMatrix::Create() ; |
| 319 append_to_batch(batch, color, viewMatrix, rect, devRect); | 319 append_to_batch(batch, color, viewMatrix, rect, devRect); |
| 320 batch->init(); | 320 batch->init(); |
| 321 return batch; | 321 return batch; |
| 322 } | 322 } |
| 323 | 323 |
| 324 GrDrawBatch* Create(GrColor color, | 324 GrDrawBatch* Create(GrColor color, |
| 325 const SkMatrix& viewMatrix, | 325 const SkMatrix& viewMatrix, |
| 326 const SkMatrix& localMatrix, | 326 const SkMatrix& localMatrix, |
| 327 const SkRect& rect, | 327 const SkRect& rect) { |
| 328 const SkRect& devRect) { | 328 //map rect |
| 329 SkRect devRect; | |
| 330 viewMatrix.mapRect(&devRect, rect); | |
| 331 | |
| 329 AAFillRectBatchLocalMatrix* batch = AAFillRectBatchLocalMatrix::Create(); | 332 AAFillRectBatchLocalMatrix* batch = AAFillRectBatchLocalMatrix::Create(); |
| 330 append_to_batch(batch, color, viewMatrix, localMatrix, rect, devRect); | 333 append_to_batch(batch, color, viewMatrix, localMatrix, rect, devRect); |
| 331 batch->init(); | 334 batch->init(); |
| 332 return batch; | 335 return batch; |
| 333 } | 336 } |
| 334 | 337 |
| 335 void Append(GrBatch* origBatch, | 338 void Append(GrBatch* origBatch, |
| 336 GrColor color, | 339 GrColor color, |
| 337 const SkMatrix& viewMatrix, | 340 const SkMatrix& viewMatrix, |
| 338 const SkRect& rect, | 341 const SkRect& rect) { |
| 339 const SkRect& devRect) { | 342 // map rect |
| 343 SkRect devRect; | |
| 344 viewMatrix.mapRect(&devRect, rect); | |
| 345 | |
| 340 AAFillRectBatchNoLocalMatrix* batch = origBatch->cast<AAFillRectBatchNoLocal Matrix>(); | 346 AAFillRectBatchNoLocalMatrix* batch = origBatch->cast<AAFillRectBatchNoLocal Matrix>(); |
| 341 append_to_batch(batch, color, viewMatrix, rect, devRect); | 347 append_to_batch(batch, color, viewMatrix, rect, devRect); |
| 342 batch->updateBoundsAfterAppend(); | 348 batch->updateBoundsAfterAppend(); |
| 343 } | 349 } |
| 344 | 350 |
| 345 void Append(GrBatch* origBatch, | 351 void Append(GrBatch* origBatch, |
| 346 GrColor color, | 352 GrColor color, |
| 347 const SkMatrix& viewMatrix, | 353 const SkMatrix& viewMatrix, |
| 348 const SkMatrix& localMatrix, | 354 const SkMatrix& localMatrix, |
| 349 const SkRect& rect, | 355 const SkRect& rect, |
|
robertphillips
2015/09/25 12:48:48
We still need 'devRect' here ?
joshualitt
2015/09/25 18:17:12
I can fix in a follow on
| |
| 350 const SkRect& devRect) { | 356 const SkRect& devRect) { |
| 351 AAFillRectBatchLocalMatrix* batch = origBatch->cast<AAFillRectBatchLocalMatr ix>(); | 357 AAFillRectBatchLocalMatrix* batch = origBatch->cast<AAFillRectBatchLocalMatr ix>(); |
| 352 append_to_batch(batch, color, viewMatrix, localMatrix, rect, devRect); | 358 append_to_batch(batch, color, viewMatrix, localMatrix, rect, devRect); |
| 353 batch->updateBoundsAfterAppend(); | 359 batch->updateBoundsAfterAppend(); |
| 354 } | 360 } |
| 355 | 361 |
| 356 }; | 362 }; |
| 357 | 363 |
| 358 //////////////////////////////////////////////////////////////////////////////// /////////////////// | 364 //////////////////////////////////////////////////////////////////////////////// /////////////////// |
| 359 | 365 |
| 360 #ifdef GR_TEST_UTILS | 366 #ifdef GR_TEST_UTILS |
| 361 | 367 |
| 362 #include "GrBatchTest.h" | 368 #include "GrBatchTest.h" |
| 363 | 369 |
| 364 DRAW_BATCH_TEST_DEFINE(AAFillRectBatch) { | 370 DRAW_BATCH_TEST_DEFINE(AAFillRectBatch) { |
| 365 GrColor color = GrRandomColor(random); | 371 GrColor color = GrRandomColor(random); |
| 366 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); | 372 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); |
| 367 SkRect rect = GrTest::TestRect(random); | 373 SkRect rect = GrTest::TestRect(random); |
| 368 SkRect devRect = GrTest::TestRect(random); | 374 SkRect devRect = GrTest::TestRect(random); |
| 369 return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect); | 375 return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect); |
| 370 } | 376 } |
| 371 | 377 |
| 372 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) { | 378 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) { |
| 373 GrColor color = GrRandomColor(random); | 379 GrColor color = GrRandomColor(random); |
| 374 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); | 380 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); |
| 375 SkMatrix localMatrix = GrTest::TestMatrix(random); | 381 SkMatrix localMatrix = GrTest::TestMatrix(random); |
| 376 SkRect rect = GrTest::TestRect(random); | 382 SkRect rect = GrTest::TestRect(random); |
| 377 SkRect devRect = GrTest::TestRect(random); | 383 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect); |
| 378 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe ct); | |
| 379 } | 384 } |
| 380 | 385 |
| 381 #endif | 386 #endif |
| OLD | NEW |