OLD | NEW |
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 "SkColorFilter.h" | 8 #include "SkColorFilter.h" |
9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
11 #include "SkDrawFilter.h" | 11 #include "SkDrawFilter.h" |
12 #include "SkImage_Base.h" | 12 #include "SkImage_Base.h" |
13 #include "SkMetaData.h" | 13 #include "SkMetaData.h" |
14 #include "SkNinePatchIter.h" | 14 #include "SkNinePatchIter.h" |
15 #include "SkPatchUtils.h" | 15 #include "SkPatchUtils.h" |
16 #include "SkPathMeasure.h" | 16 #include "SkPathMeasure.h" |
17 #include "SkRasterClip.h" | 17 #include "SkRasterClip.h" |
18 #include "SkRSXform.h" | 18 #include "SkRSXform.h" |
19 #include "SkShader.h" | 19 #include "SkShader.h" |
20 #include "SkTextBlob.h" | 20 #include "SkTextBlobRunIterator.h" |
21 #include "SkTextToPathIter.h" | 21 #include "SkTextToPathIter.h" |
22 | 22 |
23 SkBaseDevice::SkBaseDevice(const SkSurfaceProps& surfaceProps) | 23 SkBaseDevice::SkBaseDevice(const SkSurfaceProps& surfaceProps) |
24 : fSurfaceProps(surfaceProps) | 24 : fSurfaceProps(surfaceProps) |
25 #ifdef SK_DEBUG | 25 #ifdef SK_DEBUG |
26 , fAttachedToCanvas(false) | 26 , fAttachedToCanvas(false) |
27 #endif | 27 #endif |
28 { | 28 { |
29 fOrigin.setZero(); | 29 fOrigin.setZero(); |
30 fMetaData = nullptr; | 30 fMetaData = nullptr; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 data.fTexCoords, data.fColors, xmode, data.fIndices,
data.fIndexCount, | 96 data.fTexCoords, data.fColors, xmode, data.fIndices,
data.fIndexCount, |
97 paint); | 97 paint); |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 void SkBaseDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob* blob, SkSc
alar x, SkScalar y, | 101 void SkBaseDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob* blob, SkSc
alar x, SkScalar y, |
102 const SkPaint &paint, SkDrawFilter* drawFilter)
{ | 102 const SkPaint &paint, SkDrawFilter* drawFilter)
{ |
103 | 103 |
104 SkPaint runPaint = paint; | 104 SkPaint runPaint = paint; |
105 | 105 |
106 SkTextBlob::RunIterator it(blob); | 106 SkTextBlobRunIterator it(blob); |
107 for (;!it.done(); it.next()) { | 107 for (;!it.done(); it.next()) { |
108 size_t textLen = it.glyphCount() * sizeof(uint16_t); | 108 size_t textLen = it.glyphCount() * sizeof(uint16_t); |
109 const SkPoint& offset = it.offset(); | 109 const SkPoint& offset = it.offset(); |
110 // applyFontToPaint() always overwrites the exact same attributes, | 110 // applyFontToPaint() always overwrites the exact same attributes, |
111 // so it is safe to not re-seed the paint for this reason. | 111 // so it is safe to not re-seed the paint for this reason. |
112 it.applyFontToPaint(&runPaint); | 112 it.applyFontToPaint(&runPaint); |
113 | 113 |
114 if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Typ
e)) { | 114 if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Typ
e)) { |
115 // A false return from filter() means we should abort the current dr
aw. | 115 // A false return from filter() means we should abort the current dr
aw. |
116 runPaint = paint; | 116 runPaint = paint; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() | 412 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() |
413 || this->onShouldDisableLCD(paint)) { | 413 || this->onShouldDisableLCD(paint)) { |
414 | 414 |
415 flags &= ~SkPaint::kLCDRenderText_Flag; | 415 flags &= ~SkPaint::kLCDRenderText_Flag; |
416 flags |= SkPaint::kGenA8FromLCD_Flag; | 416 flags |= SkPaint::kGenA8FromLCD_Flag; |
417 } | 417 } |
418 | 418 |
419 return flags; | 419 return flags; |
420 } | 420 } |
421 | 421 |
OLD | NEW |