| 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 "GrDrawTarget.h" | 11 #include "GrDrawTarget.h" |
| 11 #include "GrGpu.h" | 12 #include "GrGpu.h" |
| 12 #include "GrPath.h" | 13 #include "GrPath.h" |
| 13 #include "GrPathRange.h" | 14 #include "GrPathRange.h" |
| 14 #include "GrResourceProvider.h" | 15 #include "GrResourceProvider.h" |
| 15 #include "SkAutoKern.h" | 16 #include "SkAutoKern.h" |
| 16 #include "SkDraw.h" | 17 #include "SkDraw.h" |
| 17 #include "SkDrawProcs.h" | 18 #include "SkDrawProcs.h" |
| 18 #include "SkGlyphCache.h" | 19 #include "SkGlyphCache.h" |
| 19 #include "SkGpuDevice.h" | 20 #include "SkGpuDevice.h" |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 GR_STATIC_ASSERT(0 == offsetof(SkPoint, fX)); | 429 GR_STATIC_ASSERT(0 == offsetof(SkPoint, fX)); |
| 429 | 430 |
| 430 return &pointArray[0].fX; | 431 return &pointArray[0].fX; |
| 431 } | 432 } |
| 432 | 433 |
| 433 void GrStencilAndCoverTextContext::flush() { | 434 void GrStencilAndCoverTextContext::flush() { |
| 434 if (fQueuedGlyphCount > 0) { | 435 if (fQueuedGlyphCount > 0) { |
| 435 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(fPaint.getColor
(), | 436 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(fPaint.getColor
(), |
| 436 fViewMatrix, | 437 fViewMatrix, |
| 437 fLocalMatrix)); | 438 fLocalMatrix)); |
| 438 fDrawTarget->drawPaths(&fPipelineBuilder, pp, fGlyphs, | 439 |
| 440 GrDrawContext* drawContext = fContext->drawContext(); |
| 441 if (!drawContext) { |
| 442 return; |
| 443 } |
| 444 |
| 445 drawContext->drawPaths(&fPipelineBuilder, pp, fGlyphs, |
| 439 fGlyphIndices, GrPathRange::kU16_PathIndexType, | 446 fGlyphIndices, GrPathRange::kU16_PathIndexType, |
| 440 get_xy_scalar_array(fGlyphPositions), | 447 get_xy_scalar_array(fGlyphPositions), |
| 441 GrPathRendering::kTranslate_PathTransformType, | 448 GrPathRendering::kTranslate_PathTransformType, |
| 442 fQueuedGlyphCount, GrPathRendering::kWinding_Fill
Type); | 449 fQueuedGlyphCount, GrPathRendering::kWinding_Fill
Type); |
| 443 | 450 |
| 444 fQueuedGlyphCount = 0; | 451 fQueuedGlyphCount = 0; |
| 445 } | 452 } |
| 446 | 453 |
| 447 if (fFallbackGlyphsIdx < kGlyphBufferSize) { | 454 if (fFallbackGlyphsIdx < kGlyphBufferSize) { |
| 448 int fallbackGlyphCount = kGlyphBufferSize - fFallbackGlyphsIdx; | 455 int fallbackGlyphCount = kGlyphBufferSize - fFallbackGlyphsIdx; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 476 | 483 |
| 477 fGlyphs->unref(); | 484 fGlyphs->unref(); |
| 478 fGlyphs = NULL; | 485 fGlyphs = NULL; |
| 479 | 486 |
| 480 SkGlyphCache::AttachCache(fGlyphCache); | 487 SkGlyphCache::AttachCache(fGlyphCache); |
| 481 fGlyphCache = NULL; | 488 fGlyphCache = NULL; |
| 482 | 489 |
| 483 fPipelineBuilder.stencil()->setDisabled(); | 490 fPipelineBuilder.stencil()->setDisabled(); |
| 484 fStateRestore.set(NULL); | 491 fStateRestore.set(NULL); |
| 485 fViewMatrix = fContextInitialMatrix; | 492 fViewMatrix = fContextInitialMatrix; |
| 486 GrTextContext::finish(); | |
| 487 } | 493 } |
| 488 | 494 |
| OLD | NEW |