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