| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 const SkRect& devRect) { |
| 329 AAFillRectBatchLocalMatrix* batch = AAFillRectBatchLocalMatrix::Create(); | 329 AAFillRectBatchLocalMatrix* batch = AAFillRectBatchLocalMatrix::Create(); |
| 330 append_to_batch(batch, color, viewMatrix, localMatrix, rect, devRect); | 330 append_to_batch(batch, color, viewMatrix, localMatrix, rect, devRect); |
| 331 batch->init(); | 331 batch->init(); |
| 332 return batch; | 332 return batch; |
| 333 } | 333 } |
| 334 | 334 |
| 335 GrDrawBatch* Create(GrColor color, |
| 336 const SkMatrix& viewMatrix, |
| 337 const SkMatrix& localMatrix, |
| 338 const SkRect& rect) { |
| 339 SkRect devRect; |
| 340 viewMatrix.mapRect(&devRect, rect); |
| 341 return Create(color, viewMatrix, localMatrix, rect, devRect); |
| 342 } |
| 343 |
| 344 GrDrawBatch* CreateWithLocalRect(GrColor color, |
| 345 const SkMatrix& viewMatrix, |
| 346 const SkRect& rect, |
| 347 const SkRect& localRect) { |
| 348 SkRect devRect; |
| 349 viewMatrix.mapRect(&devRect, rect); |
| 350 SkMatrix localMatrix; |
| 351 if (!localMatrix.setRectToRect(rect, localRect, SkMatrix::kFill_ScaleToFit))
{ |
| 352 return nullptr; |
| 353 } |
| 354 return Create(color, viewMatrix, localMatrix, rect, devRect); |
| 355 } |
| 356 |
| 335 void Append(GrBatch* origBatch, | 357 void Append(GrBatch* origBatch, |
| 336 GrColor color, | 358 GrColor color, |
| 337 const SkMatrix& viewMatrix, | 359 const SkMatrix& viewMatrix, |
| 338 const SkRect& rect, | 360 const SkRect& rect, |
| 339 const SkRect& devRect) { | 361 const SkRect& devRect) { |
| 340 AAFillRectBatchNoLocalMatrix* batch = origBatch->cast<AAFillRectBatchNoLocal
Matrix>(); | 362 AAFillRectBatchNoLocalMatrix* batch = origBatch->cast<AAFillRectBatchNoLocal
Matrix>(); |
| 341 append_to_batch(batch, color, viewMatrix, rect, devRect); | 363 append_to_batch(batch, color, viewMatrix, rect, devRect); |
| 342 batch->updateBoundsAfterAppend(); | 364 batch->updateBoundsAfterAppend(); |
| 343 } | 365 } |
| 344 | 366 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 372 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) { | 394 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) { |
| 373 GrColor color = GrRandomColor(random); | 395 GrColor color = GrRandomColor(random); |
| 374 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); | 396 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); |
| 375 SkMatrix localMatrix = GrTest::TestMatrix(random); | 397 SkMatrix localMatrix = GrTest::TestMatrix(random); |
| 376 SkRect rect = GrTest::TestRect(random); | 398 SkRect rect = GrTest::TestRect(random); |
| 377 SkRect devRect = GrTest::TestRect(random); | 399 SkRect devRect = GrTest::TestRect(random); |
| 378 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe
ct); | 400 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe
ct); |
| 379 } | 401 } |
| 380 | 402 |
| 381 #endif | 403 #endif |
| OLD | NEW |