| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrStencilAndCoverTextContext.h" | 8 #include "GrStencilAndCoverTextContext.h" |
| 9 #include "GrAtlasTextContext.h" | 9 #include "GrAtlasTextContext.h" |
| 10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 static const SkScalar* get_xy_scalar_array(const SkPoint* pointArray) { | 420 static const SkScalar* get_xy_scalar_array(const SkPoint* pointArray) { |
| 421 GR_STATIC_ASSERT(2 * sizeof(SkScalar) == sizeof(SkPoint)); | 421 GR_STATIC_ASSERT(2 * sizeof(SkScalar) == sizeof(SkPoint)); |
| 422 GR_STATIC_ASSERT(0 == offsetof(SkPoint, fX)); | 422 GR_STATIC_ASSERT(0 == offsetof(SkPoint, fX)); |
| 423 | 423 |
| 424 return &pointArray[0].fX; | 424 return &pointArray[0].fX; |
| 425 } | 425 } |
| 426 | 426 |
| 427 void GrStencilAndCoverTextContext::flush(GrDrawContext* dc) { | 427 void GrStencilAndCoverTextContext::flush(GrDrawContext* dc) { |
| 428 if (fDraw) { | 428 if (fDraw) { |
| 429 SkASSERT(fDraw->count()); | 429 SkASSERT(fDraw->count()); |
| 430 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(fPaint.getColor
(), | |
| 431 fViewMatrix, | |
| 432 fLocalMatrix)); | |
| 433 | 430 |
| 434 // We should only be flushing about once every run. However, if this im
pacts performance | 431 // We should only be flushing about once every run. However, if this im
pacts performance |
| 435 // we could move the creation of the GrPipelineBuilder earlier. | 432 // we could move the creation of the GrPipelineBuilder earlier. |
| 436 GrPipelineBuilder pipelineBuilder(fPaint, fRenderTarget, fClip); | 433 GrPipelineBuilder pipelineBuilder(fPaint, fRenderTarget, fClip); |
| 437 SkASSERT(fRenderTarget->isStencilBufferMultisampled() || !fPaint.isAntiA
lias()); | 434 SkASSERT(fRenderTarget->isStencilBufferMultisampled() || !fPaint.isAntiA
lias()); |
| 438 pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, fPaint.is
AntiAlias()); | 435 pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, fPaint.is
AntiAlias()); |
| 439 | 436 |
| 440 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 437 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, |
| 441 kZero_StencilOp, | 438 kZero_StencilOp, |
| 442 kKeep_StencilOp, | 439 kKeep_StencilOp, |
| 443 kNotEqual_StencilFunc, | 440 kNotEqual_StencilFunc, |
| 444 0xffff, | 441 0xffff, |
| 445 0x0000, | 442 0x0000, |
| 446 0xffff); | 443 0xffff); |
| 447 | 444 |
| 448 *pipelineBuilder.stencil() = kStencilPass; | 445 *pipelineBuilder.stencil() = kStencilPass; |
| 449 | 446 |
| 450 dc->drawPathsFromRange(&pipelineBuilder, pp, fDraw, GrPathRendering::kWi
nding_FillType); | 447 dc->drawPathsFromRange(&pipelineBuilder, fViewMatrix, fLocalMatrix, fPai
nt.getColor(), |
| 448 fDraw, GrPathRendering::kWinding_FillType); |
| 451 fDraw->unref(); | 449 fDraw->unref(); |
| 452 fDraw = nullptr; | 450 fDraw = nullptr; |
| 453 } | 451 } |
| 454 | 452 |
| 455 if (fFallbackIndices.count()) { | 453 if (fFallbackIndices.count()) { |
| 456 SkASSERT(fFallbackPositions.count() == fFallbackIndices.count()); | 454 SkASSERT(fFallbackPositions.count() == fFallbackIndices.count()); |
| 457 GrPaint paintFallback(fPaint); | 455 GrPaint paintFallback(fPaint); |
| 458 | 456 |
| 459 SkPaint skPaintFallback(fSkPaint); | 457 SkPaint skPaintFallback(fSkPaint); |
| 460 if (!fUsingDeviceSpaceGlyphs) { | 458 if (!fUsingDeviceSpaceGlyphs) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 486 SkASSERT(!fFallbackPositions.count()); | 484 SkASSERT(!fFallbackPositions.count()); |
| 487 | 485 |
| 488 fGlyphs->unref(); | 486 fGlyphs->unref(); |
| 489 fGlyphs = nullptr; | 487 fGlyphs = nullptr; |
| 490 | 488 |
| 491 SkGlyphCache::AttachCache(fGlyphCache); | 489 SkGlyphCache::AttachCache(fGlyphCache); |
| 492 fGlyphCache = nullptr; | 490 fGlyphCache = nullptr; |
| 493 | 491 |
| 494 fViewMatrix = fContextInitialMatrix; | 492 fViewMatrix = fContextInitialMatrix; |
| 495 } | 493 } |
| OLD | NEW |