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

Side by Side Diff: src/core/SkDevice.cpp

Issue 718913003: Observe surface LCD settings in SkBaseDevice::drawTextBlob() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: adopting Mike's comment Created 6 years, 1 month 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/core/SkCanvas.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 2011 Google Inc. 2 * Copyright 2011 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 "SkDevice.h" 8 #include "SkDevice.h"
9 #include "SkDeviceProperties.h" 9 #include "SkDeviceProperties.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 SkPaint runPaint = paint; 123 SkPaint runPaint = paint;
124 124
125 SkTextBlob::RunIterator it(blob); 125 SkTextBlob::RunIterator it(blob);
126 while (!it.done()) { 126 while (!it.done()) {
127 size_t textLen = it.glyphCount() * sizeof(uint16_t); 127 size_t textLen = it.glyphCount() * sizeof(uint16_t);
128 const SkPoint& offset = it.offset(); 128 const SkPoint& offset = it.offset();
129 // applyFontToPaint() always overwrites the exact same attributes, 129 // applyFontToPaint() always overwrites the exact same attributes,
130 // so it is safe to not re-seed the paint. 130 // so it is safe to not re-seed the paint.
131 it.applyFontToPaint(&runPaint); 131 it.applyFontToPaint(&runPaint);
132 runPaint.setFlags(this->filterTextFlags(runPaint));
132 133
133 switch (it.positioning()) { 134 switch (it.positioning()) {
134 case SkTextBlob::kDefault_Positioning: 135 case SkTextBlob::kDefault_Positioning:
135 this->drawText(draw, it.glyphs(), textLen, x + offset.x(), y + offse t.y(), runPaint); 136 this->drawText(draw, it.glyphs(), textLen, x + offset.x(), y + offse t.y(), runPaint);
136 break; 137 break;
137 case SkTextBlob::kHorizontal_Positioning: 138 case SkTextBlob::kHorizontal_Positioning:
138 this->drawPosText(draw, it.glyphs(), textLen, it.pos(), 1, 139 this->drawPosText(draw, it.glyphs(), textLen, it.pos(), 1,
139 SkPoint::Make(x, y + offset.y()), runPaint); 140 SkPoint::Make(x, y + offset.y()), runPaint);
140 break; 141 break;
141 case SkTextBlob::kFull_Positioning: 142 case SkTextBlob::kFull_Positioning:
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 205 }
205 206
206 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S kMatrix*, 207 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S kMatrix*,
207 const SkPaint*) { 208 const SkPaint*) {
208 // The base class doesn't perform any accelerated picture rendering 209 // The base class doesn't perform any accelerated picture rendering
209 return false; 210 return false;
210 } 211 }
211 212
212 //////////////////////////////////////////////////////////////////////////////// ////////// 213 //////////////////////////////////////////////////////////////////////////////// //////////
213 214
214 bool SkBaseDevice::shouldDisableLCD(const SkPaint& paint) const { 215 uint32_t SkBaseDevice::filterTextFlags(const SkPaint& paint) const {
216 uint32_t flags = paint.getFlags();
217
215 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { 218 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) {
216 return false; 219 return flags;
217 } 220 }
218 221
219 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry()) { 222 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry()
220 return true; 223 || this->onShouldDisableLCD(paint)) {
224
225 flags &= ~SkPaint::kLCDRenderText_Flag;
226 flags |= SkPaint::kGenA8FromLCD_Flag;
221 } 227 }
222 228
223 return this->onShouldDisableLCD(paint); 229 return flags;
224 } 230 }
225 231
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698