| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrAtlasTextContext.h" | 9 #include "GrAtlasTextContext.h" |
| 10 #include "GrBatchTest.h" | 10 #include "GrBatchTest.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 bool needAA = paint.isAntiAlias() && | 266 bool needAA = paint.isAntiAlias() && |
| 267 !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled(); | 267 !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled(); |
| 268 | 268 |
| 269 // The fill path can handle rotation but not skew | 269 // The fill path can handle rotation but not skew |
| 270 // The stroke path needs the rect to remain axis aligned (no rotation or ske
w) | 270 // The stroke path needs the rect to remain axis aligned (no rotation or ske
w) |
| 271 // None of our AA draw rect calls can handle perspective yet | 271 // None of our AA draw rect calls can handle perspective yet |
| 272 bool canApplyAA = width >=0 ? viewMatrix.rectStaysRect() : viewMatrix.preser
vesRightAngles(); | 272 bool canApplyAA = width >=0 ? viewMatrix.rectStaysRect() : viewMatrix.preser
vesRightAngles(); |
| 273 | 273 |
| 274 if (needAA && canApplyAA) { | 274 if (needAA && canApplyAA) { |
| 275 SkASSERT(!viewMatrix.hasPerspective()); | 275 SkASSERT(!viewMatrix.hasPerspective()); |
| 276 SkRect devBoundRect; | |
| 277 viewMatrix.mapRect(&devBoundRect, rect); | |
| 278 SkAutoTUnref<GrDrawBatch> batch; | 276 SkAutoTUnref<GrDrawBatch> batch; |
| 279 if (width >= 0) { | 277 if (width >= 0) { |
| 280 batch.reset(GrRectBatchFactory::CreateAAStroke(color, viewMatrix, re
ct, devBoundRect, | 278 batch.reset(GrRectBatchFactory::CreateAAStroke(color, viewMatrix, re
ct, *strokeInfo)); |
| 281 *strokeInfo)); | |
| 282 } else { | 279 } else { |
| 280 SkRect devBoundRect; |
| 281 viewMatrix.mapRect(&devBoundRect, rect); |
| 283 batch.reset(GrRectBatchFactory::CreateAAFill(color, viewMatrix, rect
, devBoundRect)); | 282 batch.reset(GrRectBatchFactory::CreateAAFill(color, viewMatrix, rect
, devBoundRect)); |
| 284 } | 283 } |
| 285 fDrawTarget->drawBatch(pipelineBuilder, batch); | 284 fDrawTarget->drawBatch(pipelineBuilder, batch); |
| 286 return; | 285 return; |
| 287 } | 286 } |
| 288 | 287 |
| 289 if (width >= 0) { | 288 if (width >= 0) { |
| 290 // Non-AA hairlines are snapped to pixel centers to make which pixels ar
e hit deterministic | 289 // Non-AA hairlines are snapped to pixel centers to make which pixels ar
e hit deterministic |
| 291 bool snapToPixelCenters = (0 == width && !rt->isUnifiedMultisampled()); | 290 bool snapToPixelCenters = (0 == width && !rt->isUnifiedMultisampled()); |
| 292 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAStroke( | 291 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAStroke( |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 RETURN_FALSE_IF_ABANDONED | 755 RETURN_FALSE_IF_ABANDONED |
| 757 | 756 |
| 758 ASSERT_OWNED_RESOURCE(rt); | 757 ASSERT_OWNED_RESOURCE(rt); |
| 759 SkASSERT(rt); | 758 SkASSERT(rt); |
| 760 return true; | 759 return true; |
| 761 } | 760 } |
| 762 | 761 |
| 763 void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* b
atch) { | 762 void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* b
atch) { |
| 764 fDrawTarget->drawBatch(*pipelineBuilder, batch); | 763 fDrawTarget->drawBatch(*pipelineBuilder, batch); |
| 765 } | 764 } |
| OLD | NEW |