| 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 "GrRectBatchFactory.h" | 8 #include "GrRectBatchFactory.h" |
| 9 | 9 |
| 10 #include "GrAAStrokeRectBatch.h" | 10 #include "GrAAStrokeRectBatch.h" |
| 11 | 11 |
| 12 #include "SkStrokeRec.h" | 12 #include "SkStrokeRec.h" |
| 13 | 13 |
| 14 namespace GrRectBatchFactory { | 14 namespace GrRectBatchFactory { |
| 15 | 15 |
| 16 GrDrawBatch* CreateAAFillNestedRects(GrColor color, | 16 GrDrawBatch* CreateAAFillNestedRects(GrColor color, |
| 17 const SkMatrix& viewMatrix, | 17 const SkMatrix& viewMatrix, |
| 18 const SkRect rects[2]) { | 18 const SkRect rects[2]) { |
| 19 SkASSERT(viewMatrix.rectStaysRect()); | 19 SkASSERT(viewMatrix.rectStaysRect()); |
| 20 SkASSERT(!rects[0].isEmpty() && !rects[1].isEmpty()); | 20 SkASSERT(!rects[0].isEmpty() && !rects[1].isEmpty()); |
| 21 | 21 |
| 22 SkRect devOutside, devInside; | 22 SkRect devOutside, devInside; |
| 23 viewMatrix.mapRect(&devOutside, rects[0]); | 23 viewMatrix.mapRect(&devOutside, rects[0]); |
| 24 viewMatrix.mapRect(&devInside, rects[1]); | 24 viewMatrix.mapRect(&devInside, rects[1]); |
| 25 if (devInside.isEmpty()) { |
| 26 if (devOutside.isEmpty()) { |
| 27 return nullptr; |
| 28 } |
| 29 return GrAAFillRectBatch::Create(color, viewMatrix, devOutside, devOutsi
de); |
| 30 } |
| 25 | 31 |
| 26 return GrAAStrokeRectBatch::Create(color, viewMatrix, devOutside, devOutside
, devInside, true, | 32 return GrAAStrokeRectBatch::CreateFillBetweenRects(color, viewMatrix, devOut
side, devInside); |
| 27 devInside.isEmpty()); | |
| 28 } | 33 } |
| 29 | 34 |
| 30 }; | 35 }; |
| OLD | NEW |