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

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

Issue 193163003: Enable use of distance fields via SkPaint flag. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Change HACK to TEMP Created 6 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/GrBitmapTextContext.cpp ('k') | src/gpu/GrTextStrike.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 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 "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
(...skipping 27 matching lines...) Expand all
38 38
39 fVertices = NULL; 39 fVertices = NULL;
40 fMaxVertices = 0; 40 fMaxVertices = 0;
41 } 41 }
42 42
43 GrDistanceFieldTextContext::~GrDistanceFieldTextContext() { 43 GrDistanceFieldTextContext::~GrDistanceFieldTextContext() {
44 this->flushGlyphs(); 44 this->flushGlyphs();
45 } 45 }
46 46
47 bool GrDistanceFieldTextContext::canDraw(const SkPaint& paint) { 47 bool GrDistanceFieldTextContext::canDraw(const SkPaint& paint) {
48 return !paint.getRasterizer() && !paint.getMaskFilter() && 48 return paint.isDistanceFieldTextTEMP() &&
49 !paint.getRasterizer() && !paint.getMaskFilter() &&
49 paint.getStyle() == SkPaint::kFill_Style && 50 paint.getStyle() == SkPaint::kFill_Style &&
50 fContext->getTextTarget()->caps()->shaderDerivativeSupport() && 51 fContext->getTextTarget()->caps()->shaderDerivativeSupport() &&
51 !SkDraw::ShouldDrawTextAsPaths(paint, fContext->getMatrix()); 52 !SkDraw::ShouldDrawTextAsPaths(paint, fContext->getMatrix());
52 } 53 }
53 54
54 static inline GrColor skcolor_to_grcolor_nopremultiply(SkColor c) { 55 static inline GrColor skcolor_to_grcolor_nopremultiply(SkColor c) {
55 unsigned r = SkColorGetR(c); 56 unsigned r = SkColorGetR(c);
56 unsigned g = SkColorGetG(c); 57 unsigned g = SkColorGetG(c);
57 unsigned b = SkColorGetB(c); 58 unsigned b = SkColorGetB(c);
58 return GrColorPackRGBA(r, g, b, 0xff); 59 return GrColorPackRGBA(r, g, b, 0xff);
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 SkScalarToFixed(y) - (glyph.fAdvanceY >> a lignShift) 443 SkScalarToFixed(y) - (glyph.fAdvanceY >> a lignShift)
443 + SK_FixedHalf, //d1g.fHalfSampleY, 444 + SK_FixedHalf, //d1g.fHalfSampleY,
444 fontScaler); 445 fontScaler);
445 } 446 }
446 pos += scalarsPerPosition; 447 pos += scalarsPerPosition;
447 } 448 }
448 } 449 }
449 450
450 this->finish(); 451 this->finish();
451 } 452 }
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.cpp ('k') | src/gpu/GrTextStrike.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698