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

Side by Side Diff: src/fonts/SkRandomScalerContext.cpp

Issue 1264843003: Revert of Add BW masks to random scaler context (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | « gm/textblobrandomfont.cpp ('k') | no next file » | 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 2015 Google Inc. 2 * Copyright 2015 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 "SkRandomScalerContext.h" 8 #include "SkRandomScalerContext.h"
9 #include "SkGlyph.h" 9 #include "SkGlyph.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 void SkRandomScalerContext::generateAdvance(SkGlyph* glyph) { 58 void SkRandomScalerContext::generateAdvance(SkGlyph* glyph) {
59 fProxy->getAdvance(glyph); 59 fProxy->getAdvance(glyph);
60 } 60 }
61 61
62 void SkRandomScalerContext::generateMetrics(SkGlyph* glyph) { 62 void SkRandomScalerContext::generateMetrics(SkGlyph* glyph) {
63 // Here we will change the mask format of the glyph 63 // Here we will change the mask format of the glyph
64 // NOTE this is being overridden by the base class 64 // NOTE this is being overridden by the base class
65 SkMask::Format format; 65 SkMask::Format format;
66 switch (glyph->getGlyphID() % 4) { 66 switch (glyph->getGlyphID() % 3) {
67 case 0: 67 case 0:
68 format = SkMask::kLCD16_Format; 68 format = SkMask::kLCD16_Format;
69 break; 69 break;
70 case 1: 70 case 1:
71 format = SkMask::kA8_Format; 71 format = SkMask::kA8_Format;
72 break; 72 break;
73 case 2: 73 case 2:
74 format = SkMask::kARGB32_Format; 74 format = SkMask::kARGB32_Format;
75 break; 75 break;
76 case 3:
77 format = SkMask::kBW_Format;
78 break;
79 } 76 }
80 77
81 fProxy->getMetrics(glyph); 78 fProxy->getMetrics(glyph);
82 79
83 glyph->fMaskFormat = format; 80 glyph->fMaskFormat = format;
84 if (fFakeIt) { 81 if (fFakeIt) {
85 return; 82 return;
86 } 83 }
87 if (SkMask::kARGB32_Format == format) { 84 if (SkMask::kARGB32_Format == format) {
88 SkPath path; 85 SkPath path;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 break; 125 break;
129 default: 126 default:
130 break; 127 break;
131 } 128 }
132 } 129 }
133 } 130 }
134 } 131 }
135 132
136 void SkRandomScalerContext::generateImage(const SkGlyph& glyph) { 133 void SkRandomScalerContext::generateImage(const SkGlyph& glyph) {
137 SkMask::Format format = (SkMask::Format)glyph.fMaskFormat; 134 SkMask::Format format = (SkMask::Format)glyph.fMaskFormat;
138 switch (glyph.getGlyphID() % 4) { 135 switch (glyph.getGlyphID() % 3) {
139 case 0: 136 case 0:
140 format = SkMask::kLCD16_Format; 137 format = SkMask::kLCD16_Format;
141 break; 138 break;
142 case 1: 139 case 1:
143 format = SkMask::kA8_Format; 140 format = SkMask::kA8_Format;
144 break; 141 break;
145 case 2: 142 case 2:
146 format = SkMask::kARGB32_Format; 143 format = SkMask::kARGB32_Format;
147 break; 144 break;
148 case 3:
149 format = SkMask::kBW_Format;
150 break;
151 } 145 }
152 const_cast<SkGlyph&>(glyph).fMaskFormat = format; 146 const_cast<SkGlyph&>(glyph).fMaskFormat = format;
153 147
154 // if the format is ARGB, we just draw the glyph from path ourselves. Other wise, we force 148 // if the format is ARGB, we just draw the glyph from path ourselves. Other wise, we force
155 // our proxy context to generate the image from paths. 149 // our proxy context to generate the image from paths.
156 if (!fFakeIt) { 150 if (!fFakeIt) {
157 if (SkMask::kARGB32_Format == glyph.fMaskFormat) { 151 if (SkMask::kARGB32_Format == glyph.fMaskFormat) {
158 SkPath path; 152 SkPath path;
159 fProxy->getPath(glyph, &path); 153 fProxy->getPath(glyph, &path);
160 154
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 243
250 int SkRandomTypeface::onGetTableTags(SkFontTableTag tags[]) const { 244 int SkRandomTypeface::onGetTableTags(SkFontTableTag tags[]) const {
251 return fProxy->getTableTags(tags); 245 return fProxy->getTableTags(tags);
252 } 246 }
253 247
254 size_t SkRandomTypeface::onGetTableData(SkFontTableTag tag, size_t offset, 248 size_t SkRandomTypeface::onGetTableData(SkFontTableTag tag, size_t offset,
255 size_t length, void* data) const { 249 size_t length, void* data) const {
256 return fProxy->getTableData(tag, offset, length, data); 250 return fProxy->getTableData(tag, offset, length, data);
257 } 251 }
258 252
OLDNEW
« no previous file with comments | « gm/textblobrandomfont.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698