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 "SkTypes.h" | 8 #include "SkTypes.h" |
9 #if defined(SK_BUILD_FOR_WIN32) | 9 #if defined(SK_BUILD_FOR_WIN32) |
10 | 10 |
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 , fXpsGlyphs(xpsGlyphs) { } | 2088 , fXpsGlyphs(xpsGlyphs) { } |
2089 | 2089 |
2090 void operator()(const SkGlyph& glyph, SkPoint position, SkPoint) { | 2090 void operator()(const SkGlyph& glyph, SkPoint position, SkPoint) { |
2091 SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0); | 2091 SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0); |
2092 | 2092 |
2093 SkScalar x = position.fX; | 2093 SkScalar x = position.fX; |
2094 SkScalar y = position.fY; | 2094 SkScalar y = position.fY; |
2095 | 2095 |
2096 XPS_GLYPH_INDEX* xpsGlyph = fXpsGlyphs->append(); | 2096 XPS_GLYPH_INDEX* xpsGlyph = fXpsGlyphs->append(); |
2097 uint16_t glyphID = glyph.getGlyphID(); | 2097 uint16_t glyphID = glyph.getGlyphID(); |
2098 fGlyphUse->setBit(glyphID, true); | 2098 fGlyphUse->set(glyphID); |
2099 xpsGlyph->index = glyphID; | 2099 xpsGlyph->index = glyphID; |
2100 if (1 == fXpsGlyphs->count()) { | 2100 if (1 == fXpsGlyphs->count()) { |
2101 xpsGlyph->advanceWidth = 0.0f; | 2101 xpsGlyph->advanceWidth = 0.0f; |
2102 xpsGlyph->horizontalOffset = SkScalarToFloat(x) * fCentemPerUnit; | 2102 xpsGlyph->horizontalOffset = SkScalarToFloat(x) * fCentemPerUnit; |
2103 xpsGlyph->verticalOffset = SkScalarToFloat(y) * -fCentemPerUnit; | 2103 xpsGlyph->verticalOffset = SkScalarToFloat(y) * -fCentemPerUnit; |
2104 } | 2104 } |
2105 else { | 2105 else { |
2106 const XPS_GLYPH_INDEX& first = (*fXpsGlyphs)[0]; | 2106 const XPS_GLYPH_INDEX& first = (*fXpsGlyphs)[0]; |
2107 xpsGlyph->advanceWidth = 0.0f; | 2107 xpsGlyph->advanceWidth = 0.0f; |
2108 xpsGlyph->horizontalOffset = (SkScalarToFloat(x) * fCentemPerUnit) | 2108 xpsGlyph->horizontalOffset = (SkScalarToFloat(x) * fCentemPerUnit) |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2277 //SkXPSDevice* dev = new SkXPSDevice(this); | 2277 //SkXPSDevice* dev = new SkXPSDevice(this); |
2278 //SkSize s = SkSize::Make(width, height); | 2278 //SkSize s = SkSize::Make(width, height); |
2279 //dev->BeginCanvas(s, s, SkMatrix::I()); | 2279 //dev->BeginCanvas(s, s, SkMatrix::I()); |
2280 //return dev; | 2280 //return dev; |
2281 } | 2281 } |
2282 #endif | 2282 #endif |
2283 return new SkXPSDevice(this->fXpsFactory.get()); | 2283 return new SkXPSDevice(this->fXpsFactory.get()); |
2284 } | 2284 } |
2285 | 2285 |
2286 #endif//defined(SK_BUILD_FOR_WIN32) | 2286 #endif//defined(SK_BUILD_FOR_WIN32) |
OLD | NEW |