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 "GrBitmapTextContext.h" | 9 #include "GrBitmapTextContext.h" |
10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, NULL, true /*igno
reGamma*/); | 341 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, NULL, true /*igno
reGamma*/); |
342 fGlyphs = canUseRawPaths ? | 342 fGlyphs = canUseRawPaths ? |
343 get_gr_glyphs(fContext, fSkPaint.getTypeface(), NULL, fStr
oke) : | 343 get_gr_glyphs(fContext, fSkPaint.getTypeface(), NULL, fStr
oke) : |
344 get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->g
etTypeface(), | 344 get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->g
etTypeface(), |
345 &fGlyphCache->getDescriptor(), fStroke); | 345 &fGlyphCache->getDescriptor(), fStroke); |
346 } | 346 } |
347 | 347 |
348 fStateRestore.set(&fDrawState); | 348 fStateRestore.set(&fDrawState); |
349 | 349 |
350 fDrawState.setFromPaint(fPaint, fViewMatrix, fContext->getRenderTarget()); | 350 fDrawState.setFromPaint(fPaint, fContext->getRenderTarget()); |
351 | 351 |
352 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 352 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, |
353 kZero_StencilOp, | 353 kZero_StencilOp, |
354 kZero_StencilOp, | 354 kZero_StencilOp, |
355 kNotEqual_StencilFunc, | 355 kNotEqual_StencilFunc, |
356 0xffff, | 356 0xffff, |
357 0x0000, | 357 0x0000, |
358 0xffff); | 358 0xffff); |
359 | 359 |
360 *fDrawState.stencil() = kStencilPass; | 360 *fDrawState.stencil() = kStencilPass; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 399 |
400 static const SkScalar* get_xy_scalar_array(const SkPoint* pointArray) { | 400 static const SkScalar* get_xy_scalar_array(const SkPoint* pointArray) { |
401 GR_STATIC_ASSERT(2 * sizeof(SkScalar) == sizeof(SkPoint)); | 401 GR_STATIC_ASSERT(2 * sizeof(SkScalar) == sizeof(SkPoint)); |
402 GR_STATIC_ASSERT(0 == offsetof(SkPoint, fX)); | 402 GR_STATIC_ASSERT(0 == offsetof(SkPoint, fX)); |
403 | 403 |
404 return &pointArray[0].fX; | 404 return &pointArray[0].fX; |
405 } | 405 } |
406 | 406 |
407 void GrStencilAndCoverTextContext::flush() { | 407 void GrStencilAndCoverTextContext::flush() { |
408 if (fQueuedGlyphCount > 0) { | 408 if (fQueuedGlyphCount > 0) { |
409 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(fPaint.getColor
(), fLocalMatrix)); | 409 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(fPaint.getColor
(), |
| 410 fViewMatrix, |
| 411 fLocalMatrix)); |
410 fDrawTarget->drawPaths(&fDrawState, pp, fGlyphs, | 412 fDrawTarget->drawPaths(&fDrawState, pp, fGlyphs, |
411 fGlyphIndices, GrPathRange::kU16_PathIndexType, | 413 fGlyphIndices, GrPathRange::kU16_PathIndexType, |
412 get_xy_scalar_array(fGlyphPositions), | 414 get_xy_scalar_array(fGlyphPositions), |
413 GrPathRendering::kTranslate_PathTransformType, | 415 GrPathRendering::kTranslate_PathTransformType, |
414 fQueuedGlyphCount, GrPathRendering::kWinding_Fill
Type); | 416 fQueuedGlyphCount, GrPathRendering::kWinding_Fill
Type); |
415 | 417 |
416 fQueuedGlyphCount = 0; | 418 fQueuedGlyphCount = 0; |
417 } | 419 } |
418 | 420 |
419 if (fFallbackGlyphsIdx < kGlyphBufferSize) { | 421 if (fFallbackGlyphsIdx < kGlyphBufferSize) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 | 453 |
452 SkGlyphCache::AttachCache(fGlyphCache); | 454 SkGlyphCache::AttachCache(fGlyphCache); |
453 fGlyphCache = NULL; | 455 fGlyphCache = NULL; |
454 | 456 |
455 fDrawState.stencil()->setDisabled(); | 457 fDrawState.stencil()->setDisabled(); |
456 fStateRestore.set(NULL); | 458 fStateRestore.set(NULL); |
457 fViewMatrix = fContextInitialMatrix; | 459 fViewMatrix = fContextInitialMatrix; |
458 GrTextContext::finish(); | 460 GrTextContext::finish(); |
459 } | 461 } |
460 | 462 |
OLD | NEW |