| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 SkMatrix m; | 253 SkMatrix m; |
| 254 m.setScale(1, -1); | 254 m.setScale(1, -1); |
| 255 fContext->setMatrix(m); | 255 fContext->setMatrix(m); |
| 256 | 256 |
| 257 // Post-flip the initial matrix so we're left with just the flip after | 257 // Post-flip the initial matrix so we're left with just the flip after |
| 258 // the paint preConcats the inverse. | 258 // the paint preConcats the inverse. |
| 259 m = fContextInitialMatrix; | 259 m = fContextInitialMatrix; |
| 260 m.postScale(1, -1); | 260 m.postScale(1, -1); |
| 261 fPaint.localCoordChangeInverse(m); | 261 fPaint.localCoordChangeInverse(m); |
| 262 | 262 |
| 263 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, &fContextInitialM
atrix, false); | 263 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, &fContextInitialM
atrix, |
| 264 true /*ignoreGamma*/); |
| 264 fGlyphs = get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->getTy
peface(), | 265 fGlyphs = get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->getTy
peface(), |
| 265 &fGlyphCache->getDescriptor(), fStroke); | 266 &fGlyphCache->getDescriptor(), fStroke); |
| 266 } else { | 267 } else { |
| 267 // Don't bake strokes into the glyph outlines. We will stroke the glyphs | 268 // Don't bake strokes into the glyph outlines. We will stroke the glyphs |
| 268 // using the GPU instead. This is the fast path. | 269 // using the GPU instead. This is the fast path. |
| 269 fStroke = SkStrokeRec(fSkPaint); | 270 fStroke = SkStrokeRec(fSkPaint); |
| 270 fSkPaint.setStyle(SkPaint::kFill_Style); | 271 fSkPaint.setStyle(SkPaint::kFill_Style); |
| 271 | 272 |
| 272 if (fStroke.isHairlineStyle()) { | 273 if (fStroke.isHairlineStyle()) { |
| 273 // Approximate hairline stroke. | 274 // Approximate hairline stroke. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 fTextRatio = fTextInverseRatio = 1.0f; | 323 fTextRatio = fTextInverseRatio = 1.0f; |
| 323 canUseRawPaths = false; | 324 canUseRawPaths = false; |
| 324 } | 325 } |
| 325 | 326 |
| 326 SkMatrix textMatrix; | 327 SkMatrix textMatrix; |
| 327 // Glyphs loaded by GPU path rendering have an inverted y-direction. | 328 // Glyphs loaded by GPU path rendering have an inverted y-direction. |
| 328 textMatrix.setScale(fTextRatio, -fTextRatio); | 329 textMatrix.setScale(fTextRatio, -fTextRatio); |
| 329 fPaint.localCoordChange(textMatrix); | 330 fPaint.localCoordChange(textMatrix); |
| 330 fContext->concatMatrix(textMatrix); | 331 fContext->concatMatrix(textMatrix); |
| 331 | 332 |
| 332 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, NULL, false); | 333 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, NULL, true /*igno
reGamma*/); |
| 333 fGlyphs = canUseRawPaths ? | 334 fGlyphs = canUseRawPaths ? |
| 334 get_gr_glyphs(fContext, fSkPaint.getTypeface(), NULL, fStr
oke) : | 335 get_gr_glyphs(fContext, fSkPaint.getTypeface(), NULL, fStr
oke) : |
| 335 get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->g
etTypeface(), | 336 get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->g
etTypeface(), |
| 336 &fGlyphCache->getDescriptor(), fStroke); | 337 &fGlyphCache->getDescriptor(), fStroke); |
| 337 } | 338 } |
| 338 | 339 |
| 339 fStateRestore.set(&fDrawState); | 340 fStateRestore.set(&fDrawState); |
| 340 | 341 |
| 341 fDrawState.setFromPaint(fPaint, fContext->getMatrix(), fContext->getRenderTa
rget()); | 342 fDrawState.setFromPaint(fPaint, fContext->getMatrix(), fContext->getRenderTa
rget()); |
| 342 | 343 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 445 |
| 445 SkGlyphCache::AttachCache(fGlyphCache); | 446 SkGlyphCache::AttachCache(fGlyphCache); |
| 446 fGlyphCache = NULL; | 447 fGlyphCache = NULL; |
| 447 | 448 |
| 448 fDrawState.stencil()->setDisabled(); | 449 fDrawState.stencil()->setDisabled(); |
| 449 fStateRestore.set(NULL); | 450 fStateRestore.set(NULL); |
| 450 fContext->setMatrix(fContextInitialMatrix); | 451 fContext->setMatrix(fContextInitialMatrix); |
| 451 GrTextContext::finish(); | 452 GrTextContext::finish(); |
| 452 } | 453 } |
| 453 | 454 |
| OLD | NEW |