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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 248 } |
249 | 249 |
250 void GrStencilAndCoverTextContext::init(GrRenderTarget* rt, | 250 void GrStencilAndCoverTextContext::init(GrRenderTarget* rt, |
251 const GrClip& clip, | 251 const GrClip& clip, |
252 const GrPaint& paint, | 252 const GrPaint& paint, |
253 const SkPaint& skPaint, | 253 const SkPaint& skPaint, |
254 size_t textByteLength, | 254 size_t textByteLength, |
255 RenderMode renderMode, | 255 RenderMode renderMode, |
256 const SkMatrix& viewMatrix, | 256 const SkMatrix& viewMatrix, |
257 const SkIRect& regionClipBounds) { | 257 const SkIRect& regionClipBounds) { |
258 GrTextContext::init(rt, clip, paint, skPaint, regionClipBounds); | 258 fClip = clip; |
| 259 |
| 260 fRenderTarget.reset(SkRef(rt)); |
| 261 |
| 262 fRegionClipBounds = regionClipBounds; |
| 263 fClip.getConservativeBounds(fRenderTarget->width(), fRenderTarget->height(),
&fClipRect); |
| 264 |
| 265 fPaint = paint; |
| 266 fSkPaint = skPaint; |
259 | 267 |
260 fContextInitialMatrix = viewMatrix; | 268 fContextInitialMatrix = viewMatrix; |
261 fViewMatrix = viewMatrix; | 269 fViewMatrix = viewMatrix; |
262 fLocalMatrix = SkMatrix::I(); | 270 fLocalMatrix = SkMatrix::I(); |
263 | 271 |
264 const bool otherBackendsWillDrawAsPaths = | 272 const bool otherBackendsWillDrawAsPaths = |
265 SkDraw::ShouldDrawTextAsPaths(skPaint, fContextInitialMatrix); | 273 SkDraw::ShouldDrawTextAsPaths(skPaint, fContextInitialMatrix); |
266 | 274 |
267 fUsingDeviceSpaceGlyphs = !otherBackendsWillDrawAsPaths && | 275 fUsingDeviceSpaceGlyphs = !otherBackendsWillDrawAsPaths && |
268 kMaxAccuracy_RenderMode == renderMode && | 276 kMaxAccuracy_RenderMode == renderMode && |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 fGlyphs = NULL; | 488 fGlyphs = NULL; |
481 | 489 |
482 SkGlyphCache::AttachCache(fGlyphCache); | 490 SkGlyphCache::AttachCache(fGlyphCache); |
483 fGlyphCache = NULL; | 491 fGlyphCache = NULL; |
484 | 492 |
485 fPipelineBuilder.stencil()->setDisabled(); | 493 fPipelineBuilder.stencil()->setDisabled(); |
486 fStateRestore.set(NULL); | 494 fStateRestore.set(NULL); |
487 fViewMatrix = fContextInitialMatrix; | 495 fViewMatrix = fContextInitialMatrix; |
488 } | 496 } |
489 | 497 |
OLD | NEW |