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 #ifndef UNICODE | 8 #ifndef UNICODE |
9 #define UNICODE | 9 #define UNICODE |
10 #endif | 10 #endif |
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2158 procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(), | 2158 procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(), |
2159 &origin, | 2159 &origin, |
2160 SkScalarToFLOAT(paint.getTextSize()), | 2160 SkScalarToFLOAT(paint.getTextSize()), |
2161 XPS_STYLE_SIMULATION_NONE, | 2161 XPS_STYLE_SIMULATION_NONE, |
2162 *d.fMatrix, | 2162 *d.fMatrix, |
2163 paint)); | 2163 paint)); |
2164 } | 2164 } |
2165 | 2165 |
2166 void SkXPSDevice::drawPosText(const SkDraw& d, | 2166 void SkXPSDevice::drawPosText(const SkDraw& d, |
2167 const void* text, size_t byteLen, | 2167 const void* text, size_t byteLen, |
2168 const SkScalar pos[], int scalarsPerPos, | 2168 const SkScalar pos[], |
2169 const SkPoint& offset, const SkPaint& paint) { | 2169 SkScalar constY, int scalarsPerPos, |
| 2170 const SkPaint& paint) { |
2170 if (byteLen < 1) return; | 2171 if (byteLen < 1) return; |
2171 | 2172 |
2172 if (text_must_be_pathed(paint, *d.fMatrix)) { | 2173 if (text_must_be_pathed(paint, *d.fMatrix)) { |
2173 SkPath path; | 2174 SkPath path; |
2174 //TODO: make this work, Draw currently does not handle as well. | 2175 //TODO: make this work, Draw currently does not handle as well. |
2175 //paint.getTextPath(text, byteLength, x, y, &path); | 2176 //paint.getTextPath(text, byteLength, x, y, &path); |
2176 //this->drawPath(d, path, paint, NULL, true); | 2177 //this->drawPath(d, path, paint, NULL, true); |
2177 //TODO: add automation "text" | 2178 //TODO: add automation "text" |
2178 return; | 2179 return; |
2179 } | 2180 } |
2180 | 2181 |
2181 TypefaceUse* typeface; | 2182 TypefaceUse* typeface; |
2182 HRV(CreateTypefaceUse(paint, &typeface)); | 2183 HRV(CreateTypefaceUse(paint, &typeface)); |
2183 | 2184 |
2184 SkDraw myDraw(d); | 2185 SkDraw myDraw(d); |
2185 myDraw.fMatrix = &SkMatrix::I(); | 2186 myDraw.fMatrix = &SkMatrix::I(); |
2186 SkXPSDrawProcs procs; | 2187 SkXPSDrawProcs procs; |
2187 text_draw_init(paint, text, byteLen, *typeface->glyphsUsed, myDraw, procs); | 2188 text_draw_init(paint, text, byteLen, *typeface->glyphsUsed, myDraw, procs); |
2188 | 2189 |
2189 myDraw.drawPosText(static_cast<const char*>(text), byteLen, pos, scalarsPerP
os, offset, paint); | 2190 myDraw.drawPosText(static_cast<const char*>(text), byteLen, |
| 2191 pos, constY, scalarsPerPos, |
| 2192 paint); |
2190 | 2193 |
2191 // SkDraw may have clipped out the glyphs, so we need to check | 2194 // SkDraw may have clipped out the glyphs, so we need to check |
2192 if (procs.xpsGlyphs.count() == 0) { | 2195 if (procs.xpsGlyphs.count() == 0) { |
2193 return; | 2196 return; |
2194 } | 2197 } |
2195 | 2198 |
2196 XPS_POINT origin = { | 2199 XPS_POINT origin = { |
2197 procs.xpsGlyphs[0].horizontalOffset / procs.centemPerUnit, | 2200 procs.xpsGlyphs[0].horizontalOffset / procs.centemPerUnit, |
2198 procs.xpsGlyphs[0].verticalOffset / -procs.centemPerUnit, | 2201 procs.xpsGlyphs[0].verticalOffset / -procs.centemPerUnit, |
2199 }; | 2202 }; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2274 IID_PPV_ARGS(&this->fXpsFactory)), | 2277 IID_PPV_ARGS(&this->fXpsFactory)), |
2275 "Could not create factory for layer."); | 2278 "Could not create factory for layer."); |
2276 | 2279 |
2277 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), | 2280 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), |
2278 "Could not create canvas for layer."); | 2281 "Could not create canvas for layer."); |
2279 } | 2282 } |
2280 | 2283 |
2281 bool SkXPSDevice::allowImageFilter(const SkImageFilter*) { | 2284 bool SkXPSDevice::allowImageFilter(const SkImageFilter*) { |
2282 return false; | 2285 return false; |
2283 } | 2286 } |
OLD | NEW |