Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: src/gpu/GrStencilAndCoverTextContext.cpp

Issue 1010113004: Add GrRenderTarget parameter to GrTextContext::canDraw (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrStencilAndCoverTextContext.h ('k') | src/gpu/GrTextContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
35 GrStencilAndCoverTextContext* textContext = SkNEW_ARGS(GrStencilAndCoverText Context, 35 GrStencilAndCoverTextContext* textContext = SkNEW_ARGS(GrStencilAndCoverText Context,
36 (context, gpuDevice, props)); 36 (context, gpuDevice, props));
37 textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, gpu Device, props); 37 textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, gpu Device, props);
38 38
39 return textContext; 39 return textContext;
40 } 40 }
41 41
42 GrStencilAndCoverTextContext::~GrStencilAndCoverTextContext() { 42 GrStencilAndCoverTextContext::~GrStencilAndCoverTextContext() {
43 } 43 }
44 44
45 bool GrStencilAndCoverTextContext::canDraw(const SkPaint& paint, const SkMatrix& viewMatrix) { 45 bool GrStencilAndCoverTextContext::canDraw(const GrRenderTarget* rt,
46 if (paint.getRasterizer()) { 46 const GrClip& clip,
47 const GrPaint& paint,
48 const SkPaint& skPaint,
49 const SkMatrix& viewMatrix) {
50 if (skPaint.getRasterizer()) {
47 return false; 51 return false;
48 } 52 }
49 if (paint.getMaskFilter()) { 53 if (skPaint.getMaskFilter()) {
50 return false; 54 return false;
51 } 55 }
52 if (paint.getPathEffect()) { 56 if (skPaint.getPathEffect()) {
53 return false; 57 return false;
54 } 58 }
55 59
56 // No hairlines unless we can map the 1 px width to the object space. 60 // No hairlines unless we can map the 1 px width to the object space.
57 if (paint.getStyle() == SkPaint::kStroke_Style 61 if (skPaint.getStyle() == SkPaint::kStroke_Style
58 && paint.getStrokeWidth() == 0 62 && skPaint.getStrokeWidth() == 0
59 && viewMatrix.hasPerspective()) { 63 && viewMatrix.hasPerspective()) {
60 return false; 64 return false;
61 } 65 }
62 66
63 // No color bitmap fonts. 67 // No color bitmap fonts.
64 SkScalerContext::Rec rec; 68 SkScalerContext::Rec rec;
65 SkScalerContext::MakeRec(paint, &fDeviceProperties, NULL, &rec); 69 SkScalerContext::MakeRec(skPaint, &fDeviceProperties, NULL, &rec);
66 return rec.getFormat() != SkMask::kARGB32_Format; 70 return rec.getFormat() != SkMask::kARGB32_Format;
67 } 71 }
68 72
69 void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt, 73 void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt,
70 const GrClip& clip, 74 const GrClip& clip,
71 const GrPaint& paint, 75 const GrPaint& paint,
72 const SkPaint& skPaint, 76 const SkPaint& skPaint,
73 const SkMatrix& viewMatrix, 77 const SkMatrix& viewMatrix,
74 const char text[], 78 const char text[],
75 size_t byteLength, 79 size_t byteLength,
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 474
471 SkGlyphCache::AttachCache(fGlyphCache); 475 SkGlyphCache::AttachCache(fGlyphCache);
472 fGlyphCache = NULL; 476 fGlyphCache = NULL;
473 477
474 fPipelineBuilder.stencil()->setDisabled(); 478 fPipelineBuilder.stencil()->setDisabled();
475 fStateRestore.set(NULL); 479 fStateRestore.set(NULL);
476 fViewMatrix = fContextInitialMatrix; 480 fViewMatrix = fContextInitialMatrix;
477 GrTextContext::finish(); 481 GrTextContext::finish();
478 } 482 }
479 483
OLDNEW
« no previous file with comments | « src/gpu/GrStencilAndCoverTextContext.h ('k') | src/gpu/GrTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698