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

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

Issue 1010113004: Add GrRenderTarget parameter to GrTextContext::canDraw (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "GrDistanceFieldTextContext.h" 8 #include "GrDistanceFieldTextContext.h"
9 #include "GrAtlas.h" 9 #include "GrAtlas.h"
10 #include "GrBitmapTextContext.h" 10 #include "GrBitmapTextContext.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 (context, props, enable )); 73 (context, props, enable ));
74 textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, pro ps); 74 textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, pro ps);
75 75
76 return textContext; 76 return textContext;
77 } 77 }
78 78
79 GrDistanceFieldTextContext::~GrDistanceFieldTextContext() { 79 GrDistanceFieldTextContext::~GrDistanceFieldTextContext() {
80 SkSafeSetNull(fGammaTexture); 80 SkSafeSetNull(fGammaTexture);
81 } 81 }
82 82
83 bool GrDistanceFieldTextContext::canDraw(const SkPaint& paint, const SkMatrix& v iewMatrix) { 83 bool GrDistanceFieldTextContext::canDraw(const GrRenderTarget* rt, const SkPaint & paint,
84 const SkMatrix& viewMatrix) {
84 // TODO: support perspective (need getMaxScale replacement) 85 // TODO: support perspective (need getMaxScale replacement)
85 if (viewMatrix.hasPerspective()) { 86 if (viewMatrix.hasPerspective()) {
86 return false; 87 return false;
87 } 88 }
88 89
89 SkScalar maxScale = viewMatrix.getMaxScale(); 90 SkScalar maxScale = viewMatrix.getMaxScale();
90 SkScalar scaledTextSize = maxScale*paint.getTextSize(); 91 SkScalar scaledTextSize = maxScale*paint.getTextSize();
91 // Scaling up beyond 2x yields undesireable artifacts 92 // Scaling up beyond 2x yields undesireable artifacts
92 if (scaledTextSize > 2*kLargeDFFontSize) { 93 if (scaledTextSize > 2*kLargeDFFontSize) {
93 return false; 94 return false;
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 } 719 }
719 } 720 }
720 721
721 inline void GrDistanceFieldTextContext::finish() { 722 inline void GrDistanceFieldTextContext::finish() {
722 this->flush(); 723 this->flush();
723 fTotalVertexCount = 0; 724 fTotalVertexCount = 0;
724 725
725 GrTextContext::finish(); 726 GrTextContext::finish();
726 } 727 }
727 728
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698