| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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 |