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

Side by Side Diff: src/gpu/text/GrTextContext.cpp

Issue 1699073004: Delete GrTextContext (Closed) Base URL: https://skia.googlesource.com/skia.git@sever-the-cord
Patch Set: nits Created 4 years, 10 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/text/GrTextContext.h ('k') | src/gpu/text/GrTextUtils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2010 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "GrTextContext.h"
9 #include "GrFontScaler.h"
10
11 #include "SkGlyphCache.h"
12
13 bool GrTextContext::ShouldDisableLCD(const SkPaint& paint) {
14 if (!SkXfermode::AsMode(paint.getXfermode(), nullptr) ||
15 paint.getMaskFilter() ||
16 paint.getRasterizer() ||
17 paint.getPathEffect() ||
18 paint.isFakeBoldText() ||
19 paint.getStyle() != SkPaint::kFill_Style)
20 {
21 return true;
22 }
23 return false;
24 }
25
26 uint32_t GrTextContext::FilterTextFlags(const SkSurfaceProps& surfaceProps, cons t SkPaint& paint) {
27 uint32_t flags = paint.getFlags();
28
29 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) {
30 return flags;
31 }
32
33 if (kUnknown_SkPixelGeometry == surfaceProps.pixelGeometry() || ShouldDisabl eLCD(paint)) {
34 flags &= ~SkPaint::kLCDRenderText_Flag;
35 flags |= SkPaint::kGenA8FromLCD_Flag;
36 }
37
38 return flags;
39 }
40
41 static void GlyphCacheAuxProc(void* data) {
42 GrFontScaler* scaler = (GrFontScaler*)data;
43 SkSafeUnref(scaler);
44 }
45
46 GrFontScaler* GrTextContext::GetGrFontScaler(SkGlyphCache* cache) {
47 void* auxData;
48 GrFontScaler* scaler = nullptr;
49
50 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) {
51 scaler = (GrFontScaler*)auxData;
52 }
53 if (nullptr == scaler) {
54 scaler = new GrFontScaler(cache);
55 cache->setAuxProc(GlyphCacheAuxProc, scaler);
56 }
57
58 return scaler;
59 }
OLDNEW
« no previous file with comments | « src/gpu/text/GrTextContext.h ('k') | src/gpu/text/GrTextUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698