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

Side by Side Diff: src/device/xps/SkXPSDevice.cpp

Issue 14873006: XPS ttc handling. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Remove experimental non-GUID GUID code. Created 7 years, 7 months 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 | Annotate | Revision Log
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 #ifndef UNICODE 8 #ifndef UNICODE
9 #define UNICODE 9 #define UNICODE
10 #endif 10 #endif
11 #ifndef _UNICODE 11 #ifndef _UNICODE
12 #define _UNICODE 12 #define _UNICODE
13 #endif 13 #endif
14 #include "SkTypes.h" 14 #include "SkTypes.h"
15 #include <ObjBase.h> 15 #include <ObjBase.h>
16 #include <XpsObjectModel.h> 16 #include <XpsObjectModel.h>
17 #include <T2EmbApi.h> 17 #include <T2EmbApi.h>
18 #include <FontSub.h> 18 #include <FontSub.h>
19 19
20 #include "SkColor.h" 20 #include "SkColor.h"
21 #include "SkConstexprMath.h" 21 #include "SkConstexprMath.h"
22 #include "SkData.h" 22 #include "SkData.h"
23 #include "SkDraw.h" 23 #include "SkDraw.h"
24 #include "SkDrawProcs.h" 24 #include "SkDrawProcs.h"
25 #include "SkEndian.h"
25 #include "SkFontHost.h" 26 #include "SkFontHost.h"
26 #include "SkGlyphCache.h" 27 #include "SkGlyphCache.h"
27 #include "SkHRESULT.h" 28 #include "SkHRESULT.h"
28 #include "SkImageEncoder.h" 29 #include "SkImageEncoder.h"
29 #include "SkIStream.h" 30 #include "SkIStream.h"
30 #include "SkMaskFilter.h" 31 #include "SkMaskFilter.h"
31 #include "SkPaint.h" 32 #include "SkPaint.h"
32 #include "SkPoint.h" 33 #include "SkPoint.h"
33 #include "SkRasterizer.h" 34 #include "SkRasterizer.h"
35 #include "SkSFNTHeader.h"
34 #include "SkShader.h" 36 #include "SkShader.h"
35 #include "SkSize.h" 37 #include "SkSize.h"
36 #include "SkStream.h" 38 #include "SkStream.h"
37 #include "SkTDArray.h" 39 #include "SkTDArray.h"
38 #include "SkTLazy.h" 40 #include "SkTLazy.h"
39 #include "SkTScopedComPtr.h" 41 #include "SkTScopedComPtr.h"
42 #include "SkTTCFHeader.h"
40 #include "SkTypefacePriv.h" 43 #include "SkTypefacePriv.h"
41 #include "SkUtils.h" 44 #include "SkUtils.h"
42 #include "SkXPSDevice.h" 45 #include "SkXPSDevice.h"
43 46
44 //Windows defines a FLOAT type, 47 //Windows defines a FLOAT type,
45 //make it clear when converting a scalar that this is what is wanted. 48 //make it clear when converting a scalar that this is what is wanted.
46 #define SkScalarToFLOAT(n) SkScalarToFloat(n) 49 #define SkScalarToFLOAT(n) SkScalarToFloat(n)
47 50
48 //Dummy representation of a GUID from create_id. 51 //Dummy representation of a GUID from create_id.
49 #define L_GUID_ID L"XXXXXXXXsXXXXsXXXXsXXXXsXXXXXXXXXXXX" 52 #define L_GUID_ID L"XXXXXXXXsXXXXsXXXXsXXXXsXXXXXXXXXXXX"
(...skipping 23 matching lines...) Expand all
73 guid.Data4[0], 76 guid.Data4[0],
74 guid.Data4[1], 77 guid.Data4[1],
75 sep, 78 sep,
76 guid.Data4[2], 79 guid.Data4[2],
77 guid.Data4[3], 80 guid.Data4[3],
78 guid.Data4[4], 81 guid.Data4[4],
79 guid.Data4[5], 82 guid.Data4[5],
80 guid.Data4[6], 83 guid.Data4[6],
81 guid.Data4[7]); 84 guid.Data4[7]);
82 } 85 }
86
83 /** 87 /**
84 Creates a GUID based id and places it into buffer. 88 Creates a GUID based id and places it into buffer.
85 buffer should have space for at least GUID_ID_LEN wide characters. 89 buffer should have space for at least GUID_ID_LEN wide characters.
86 The string will always be wchar null terminated. 90 The string will always be wchar null terminated.
87 XXXXXXXXsXXXXsXXXXsXXXXsXXXXXXXXXXXX0 91 XXXXXXXXsXXXXsXXXXsXXXXsXXXXXXXXXXXX0
88 The string may begin with a digit, 92 The string may begin with a digit,
89 and so may not be suitable as a bare resource key. 93 and so may not be suitable as a bare resource key.
90 */ 94 */
91 static HRESULT create_id(wchar_t* buffer, size_t bufferSize, 95 static HRESULT create_id(wchar_t* buffer, size_t bufferSize,
92 wchar_t sep = '-') { 96 wchar_t sep = '-') {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 IXpsOMImageResource** image) { 176 IXpsOMImageResource** image) {
173 SkTScopedComPtr<IXpsOMThumbnailGenerator> thumbnailGenerator; 177 SkTScopedComPtr<IXpsOMThumbnailGenerator> thumbnailGenerator;
174 HRM(CoCreateInstance( 178 HRM(CoCreateInstance(
175 CLSID_XpsOMThumbnailGenerator, 179 CLSID_XpsOMThumbnailGenerator,
176 NULL, 180 NULL,
177 CLSCTX_INPROC_SERVER, 181 CLSCTX_INPROC_SERVER,
178 IID_PPV_ARGS(&thumbnailGenerator)), 182 IID_PPV_ARGS(&thumbnailGenerator)),
179 "Could not create thumbnail generator."); 183 "Could not create thumbnail generator.");
180 184
181 SkTScopedComPtr<IOpcPartUri> partUri; 185 SkTScopedComPtr<IOpcPartUri> partUri;
182 static const size_t size = SK_MAX( 186 static const size_t size = SkTUMax<
183 SK_ARRAY_COUNT(L"/Documents/1/Metadata/.png") + SK_DIGITS_IN(pageNum), 187 SK_ARRAY_COUNT(L"/Documents/1/Metadata/.png") + SK_DIGITS_IN(pageNum),
184 SK_ARRAY_COUNT(L"/Metadata/" L_GUID_ID L".png") 188 SK_ARRAY_COUNT(L"/Metadata/" L_GUID_ID L".png")
185 ); 189 >::value;
186 wchar_t buffer[size]; 190 wchar_t buffer[size];
187 if (pageNum > 0) { 191 if (pageNum > 0) {
188 swprintf_s(buffer, size, L"/Documents/1/Metadata/%u.png", pageNum); 192 swprintf_s(buffer, size, L"/Documents/1/Metadata/%u.png", pageNum);
189 } else { 193 } else {
190 wchar_t id[GUID_ID_LEN]; 194 wchar_t id[GUID_ID_LEN];
191 HR(create_id(id, GUID_ID_LEN)); 195 HR(create_id(id, GUID_ID_LEN));
192 swprintf_s(buffer, size, L"/Metadata/%s.png", id); 196 swprintf_s(buffer, size, L"/Metadata/%s.png", id);
193 } 197 }
194 HRM(this->fXpsFactory->CreatePartUri(buffer, &partUri), 198 HRM(this->fXpsFactory->CreatePartUri(buffer, &partUri),
195 "Could not create thumbnail part uri."); 199 "Could not create thumbnail part uri.");
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 331
328 return true; 332 return true;
329 } 333 }
330 334
331 static HRESULT subset_typeface(SkXPSDevice::TypefaceUse* current) { 335 static HRESULT subset_typeface(SkXPSDevice::TypefaceUse* current) {
332 //CreateFontPackage wants unsigned short. 336 //CreateFontPackage wants unsigned short.
333 //Microsoft, Y U NO stdint.h? 337 //Microsoft, Y U NO stdint.h?
334 SkTDArray<unsigned short> keepList; 338 SkTDArray<unsigned short> keepList;
335 current->glyphsUsed->exportTo(&keepList); 339 current->glyphsUsed->exportTo(&keepList);
336 340
341 int ttcCount = (current->ttcIndex + 1);
342
337 //The following are declared with the types required by CreateFontPackage. 343 //The following are declared with the types required by CreateFontPackage.
338 unsigned char *puchFontPackageBuffer; 344 unsigned char *fontPackageBufferRaw = NULL;
339 unsigned long pulFontPackageBufferSize; 345 unsigned long fontPackageBufferSize;
340 unsigned long pulBytesWritten; 346 unsigned long bytesWritten;
341 unsigned long result = CreateFontPackage( 347 unsigned long result = CreateFontPackage(
342 (unsigned char *) current->fontData->getMemoryBase(), 348 (unsigned char *) current->fontData->getMemoryBase(),
343 (unsigned long) current->fontData->getLength(), 349 (unsigned long) current->fontData->getLength(),
344 &puchFontPackageBuffer, 350 &fontPackageBufferRaw,
345 &pulFontPackageBufferSize, 351 &fontPackageBufferSize,
346 &pulBytesWritten, 352 &bytesWritten,
347 TTFCFP_FLAGS_SUBSET | TTFCFP_FLAGS_GLYPHLIST,// | TTFCFP_FLAGS_TTC, 353 TTFCFP_FLAGS_SUBSET | TTFCFP_FLAGS_GLYPHLIST | (ttcCount > 0 ? TTFCFP_FL AGS_TTC : 0),
348 0,//TTC index 354 current->ttcIndex,
349 TTFCFP_SUBSET, 355 TTFCFP_SUBSET,
350 0, 356 0,
351 0, 357 0,
352 0, 358 0,
353 keepList.begin(), 359 keepList.begin(),
354 keepList.count(), 360 keepList.count(),
355 sk_malloc_throw, 361 sk_malloc_throw,
356 sk_realloc_throw, 362 sk_realloc_throw,
357 sk_free, 363 sk_free,
358 NULL); 364 NULL);
365 SkAutoTFree<unsigned char> fontPackageBuffer(fontPackageBufferRaw);
359 if (result != NO_ERROR) { 366 if (result != NO_ERROR) {
360 SkDEBUGF(("CreateFontPackage Error %lu", result)); 367 SkDEBUGF(("CreateFontPackage Error %lu", result));
361 return E_UNEXPECTED; 368 return E_UNEXPECTED;
362 } 369 }
363 370
364 SkMemoryStream* newStream = new SkMemoryStream; 371 // If it was originally a ttc, keep it a ttc.
365 newStream->setMemoryOwned(puchFontPackageBuffer, pulBytesWritten); 372 // CreateFontPackage over-allocates, realloc usually decreases the size subs tantially.
373 size_t extra;
374 if (ttcCount > 0) {
375 // Create space for a ttc header.
376 extra = sizeof(SkTTCFHeader) + (ttcCount * sizeof(SK_OT_ULONG));
377 fontPackageBuffer.set((unsigned char *)sk_realloc_throw(fontPackageBuffe r.get(),
378 bytesWritten + e xtra));
379 //overlap is certain, use memmove
380 memmove(fontPackageBuffer.get() + extra, fontPackageBuffer.get(), bytesW ritten);
381
382 // Write the ttc header.
383 SkTTCFHeader* ttcfHeader = (SkTTCFHeader*)fontPackageBuffer.get();
384 ttcfHeader->ttcTag = SkTTCFHeader::TAG;
385 ttcfHeader->version = SkTTCFHeader::version_1;
386 ttcfHeader->numOffsets = SkEndian_SwapBE32(ttcCount);
387 SK_OT_ULONG* offsetPtr = SkTAfter<SK_OT_ULONG>(ttcfHeader);
388 for (int i = 0; i < ttcCount; ++i, ++offsetPtr) {
389 *offsetPtr = SkEndian_SwapBE32(extra);
390 }
391
392 // Fix up offsets in sfnt table entries.
393 SkSFNTHeader* sfntHeader = (SkSFNTHeader*)(fontPackageBuffer.get() + ext ra);
394 int numTables = SkEndian_SwapBE16(sfntHeader->numTables);
395 SkSFNTHeader::TableDirectoryEntry* tableDirectory =
396 SkTAfter<SkSFNTHeader::TableDirectoryEntry>(sfntHeader);
397 for (int i = 0; i < numTables; ++i, ++tableDirectory) {
398 tableDirectory->offset = SkEndian_SwapBE32(
399 SkEndian_SwapBE32(tableDirectory->offset) + extra);
400 }
401 } else {
402 extra = 0;
403 fontPackageBuffer.set((unsigned char *)sk_realloc_throw(fontPackageBuffe r.get(),
404 bytesWritten));
405 }
406
407 SkAutoTUnref<SkMemoryStream> newStream(new SkMemoryStream());
408 newStream->setMemoryOwned(fontPackageBuffer.detach(), bytesWritten + extra);
409
366 SkTScopedComPtr<IStream> newIStream; 410 SkTScopedComPtr<IStream> newIStream;
367 SkIStream::CreateFromSkStream(newStream, true, &newIStream); 411 SkIStream::CreateFromSkStream(newStream.detach(), true, &newIStream);
368 412
369 XPS_FONT_EMBEDDING embedding; 413 XPS_FONT_EMBEDDING embedding;
370 HRM(current->xpsFont->GetEmbeddingOption(&embedding), 414 HRM(current->xpsFont->GetEmbeddingOption(&embedding),
371 "Could not get embedding option from font."); 415 "Could not get embedding option from font.");
372 416
373 SkTScopedComPtr<IOpcPartUri> partUri; 417 SkTScopedComPtr<IOpcPartUri> partUri;
374 HRM(current->xpsFont->GetPartName(&partUri), 418 HRM(current->xpsFont->GetPartName(&partUri),
375 "Could not get part uri from font."); 419 "Could not get part uri from font.");
376 420
377 HRM(current->xpsFont->SetContent( 421 HRM(current->xpsFont->SetContent(
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 return S_OK; 2071 return S_OK;
2028 } 2072 }
2029 } 2073 }
2030 } 2074 }
2031 2075
2032 //TODO: create glyph only fonts 2076 //TODO: create glyph only fonts
2033 //and let the host deal with what kind of font we're looking at. 2077 //and let the host deal with what kind of font we're looking at.
2034 XPS_FONT_EMBEDDING embedding = XPS_FONT_EMBEDDING_RESTRICTED; 2078 XPS_FONT_EMBEDDING embedding = XPS_FONT_EMBEDDING_RESTRICTED;
2035 2079
2036 SkTScopedComPtr<IStream> fontStream; 2080 SkTScopedComPtr<IStream> fontStream;
2037 SkStream* fontData = typeface->openStream(NULL); 2081 int ttcIndex;
2082 SkStream* fontData = typeface->openStream(&ttcIndex);
2038 HRM(SkIStream::CreateFromSkStream(fontData, true, &fontStream), 2083 HRM(SkIStream::CreateFromSkStream(fontData, true, &fontStream),
2039 "Could not create font stream."); 2084 "Could not create font stream.");
2040 2085
2041 const size_t size = 2086 const size_t size =
2042 SK_ARRAY_COUNT(L"/Resources/Fonts/" L_GUID_ID L".odttf"); 2087 SK_ARRAY_COUNT(L"/Resources/Fonts/" L_GUID_ID L".odttf");
2043 wchar_t buffer[size]; 2088 wchar_t buffer[size];
2044 wchar_t id[GUID_ID_LEN]; 2089 wchar_t id[GUID_ID_LEN];
2045 HR(create_id(id, GUID_ID_LEN)); 2090 HR(create_id(id, GUID_ID_LEN));
2046 swprintf_s(buffer, size, L"/Resources/Fonts/%s.odttf", id); 2091 swprintf_s(buffer, size, L"/Resources/Fonts/%s.odttf", id);
2047 2092
2048 SkTScopedComPtr<IOpcPartUri> partUri; 2093 SkTScopedComPtr<IOpcPartUri> partUri;
2049 HRM(this->fXpsFactory->CreatePartUri(buffer, &partUri), 2094 HRM(this->fXpsFactory->CreatePartUri(buffer, &partUri),
2050 "Could not create font resource part uri."); 2095 "Could not create font resource part uri.");
2051 2096
2052 SkTScopedComPtr<IXpsOMFontResource> xpsFontResource; 2097 SkTScopedComPtr<IXpsOMFontResource> xpsFontResource;
2053 HRM(this->fXpsFactory->CreateFontResource(fontStream.get(), 2098 HRM(this->fXpsFactory->CreateFontResource(fontStream.get(),
2054 embedding, 2099 embedding,
2055 partUri.get(), 2100 partUri.get(),
2056 FALSE, 2101 FALSE,
2057 &xpsFontResource), 2102 &xpsFontResource),
2058 "Could not create font resource."); 2103 "Could not create font resource.");
2059 2104
2105 //TODO: change openStream to return -1 for non-ttc, get rid of this.
2106 uint8_t* data = (uint8_t*)fontData->getMemoryBase();
2107 bool isTTC = (data &&
2108 fontData->getLength() >= sizeof(SkTTCFHeader) &&
2109 ((SkTTCFHeader*)data)->ttcTag == SkTTCFHeader::TAG);
2110
2060 TypefaceUse& newTypefaceUse = this->fTypefaces.push_back(); 2111 TypefaceUse& newTypefaceUse = this->fTypefaces.push_back();
2061 newTypefaceUse.typefaceId = typefaceID; 2112 newTypefaceUse.typefaceId = typefaceID;
2113 newTypefaceUse.ttcIndex = isTTC ? ttcIndex : -1;
2062 newTypefaceUse.fontData = fontData; 2114 newTypefaceUse.fontData = fontData;
2063 newTypefaceUse.xpsFont = xpsFontResource.release(); 2115 newTypefaceUse.xpsFont = xpsFontResource.release();
2064 2116
2065 SkAutoGlyphCache agc = SkAutoGlyphCache(paint, NULL, &SkMatrix::I()); 2117 SkAutoGlyphCache agc = SkAutoGlyphCache(paint, NULL, &SkMatrix::I());
2066 SkGlyphCache* glyphCache = agc.getCache(); 2118 SkGlyphCache* glyphCache = agc.getCache();
2067 unsigned int glyphCount = glyphCache->getGlyphCount(); 2119 unsigned int glyphCount = glyphCache->getGlyphCount();
2068 newTypefaceUse.glyphsUsed = new SkBitSet(glyphCount); 2120 newTypefaceUse.glyphsUsed = new SkBitSet(glyphCount);
2069 2121
2070 *typefaceUse = &newTypefaceUse; 2122 *typefaceUse = &newTypefaceUse;
2071 return S_OK; 2123 return S_OK;
2072 } 2124 }
2073 2125
2074 HRESULT SkXPSDevice::AddGlyphs(const SkDraw& d, 2126 HRESULT SkXPSDevice::AddGlyphs(const SkDraw& d,
2075 IXpsOMObjectFactory* xpsFactory, 2127 IXpsOMObjectFactory* xpsFactory,
2076 IXpsOMCanvas* canvas, 2128 IXpsOMCanvas* canvas,
2077 IXpsOMFontResource* font, 2129 TypefaceUse* font,
2078 LPCWSTR text, 2130 LPCWSTR text,
2079 XPS_GLYPH_INDEX* xpsGlyphs, 2131 XPS_GLYPH_INDEX* xpsGlyphs,
2080 UINT32 xpsGlyphsLen, 2132 UINT32 xpsGlyphsLen,
2081 XPS_POINT *origin, 2133 XPS_POINT *origin,
2082 FLOAT fontSize, 2134 FLOAT fontSize,
2083 XPS_STYLE_SIMULATION sims, 2135 XPS_STYLE_SIMULATION sims,
2084 const SkMatrix& transform, 2136 const SkMatrix& transform,
2085 const SkPaint& paint) { 2137 const SkPaint& paint) {
2086 SkTScopedComPtr<IXpsOMGlyphs> glyphs; 2138 SkTScopedComPtr<IXpsOMGlyphs> glyphs;
2087 HRM(xpsFactory->CreateGlyphs(font, &glyphs), "Could not create glyphs."); 2139 HRM(xpsFactory->CreateGlyphs(font->xpsFont, &glyphs), "Could not create glyp hs.");
2140 HRM(glyphs->SetFontFaceIndex(font->ttcIndex), "Could not set glyph font face index.");
2088 2141
2089 //XPS uses affine transformations for everything... 2142 //XPS uses affine transformations for everything...
2090 //...except positioning text. 2143 //...except positioning text.
2091 bool useCanvasForClip; 2144 bool useCanvasForClip;
2092 if ((transform.getType() & ~SkMatrix::kTranslate_Mask) == 0) { 2145 if ((transform.getType() & ~SkMatrix::kTranslate_Mask) == 0) {
2093 origin->x += SkScalarToFLOAT(transform.getTranslateX()); 2146 origin->x += SkScalarToFLOAT(transform.getTranslateX());
2094 origin->y += SkScalarToFLOAT(transform.getTranslateY()); 2147 origin->y += SkScalarToFLOAT(transform.getTranslateY());
2095 useCanvasForClip = false; 2148 useCanvasForClip = false;
2096 } else { 2149 } else {
2097 SkTScopedComPtr<IXpsOMMatrixTransform> xpsMatrixToUse; 2150 SkTScopedComPtr<IXpsOMMatrixTransform> xpsMatrixToUse;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 XPS_POINT origin = { 2328 XPS_POINT origin = {
2276 procs.xpsGlyphs[0].horizontalOffset / procs.centemPerUnit, 2329 procs.xpsGlyphs[0].horizontalOffset / procs.centemPerUnit,
2277 procs.xpsGlyphs[0].verticalOffset / -procs.centemPerUnit, 2330 procs.xpsGlyphs[0].verticalOffset / -procs.centemPerUnit,
2278 }; 2331 };
2279 procs.xpsGlyphs[0].horizontalOffset = 0.0f; 2332 procs.xpsGlyphs[0].horizontalOffset = 0.0f;
2280 procs.xpsGlyphs[0].verticalOffset = 0.0f; 2333 procs.xpsGlyphs[0].verticalOffset = 0.0f;
2281 2334
2282 HRV(AddGlyphs(d, 2335 HRV(AddGlyphs(d,
2283 this->fXpsFactory.get(), 2336 this->fXpsFactory.get(),
2284 this->fCurrentXpsCanvas.get(), 2337 this->fCurrentXpsCanvas.get(),
2285 typeface->xpsFont, 2338 typeface,
2286 NULL, 2339 NULL,
2287 procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(), 2340 procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(),
2288 &origin, 2341 &origin,
2289 SkScalarToFLOAT(paint.getTextSize()), 2342 SkScalarToFLOAT(paint.getTextSize()),
2290 XPS_STYLE_SIMULATION_NONE, 2343 XPS_STYLE_SIMULATION_NONE,
2291 *d.fMatrix, 2344 *d.fMatrix,
2292 paint)); 2345 paint));
2293 } 2346 }
2294 2347
2295 void SkXPSDevice::drawPosText(const SkDraw& d, 2348 void SkXPSDevice::drawPosText(const SkDraw& d,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2327 XPS_POINT origin = { 2380 XPS_POINT origin = {
2328 procs.xpsGlyphs[0].horizontalOffset / procs.centemPerUnit, 2381 procs.xpsGlyphs[0].horizontalOffset / procs.centemPerUnit,
2329 procs.xpsGlyphs[0].verticalOffset / -procs.centemPerUnit, 2382 procs.xpsGlyphs[0].verticalOffset / -procs.centemPerUnit,
2330 }; 2383 };
2331 procs.xpsGlyphs[0].horizontalOffset = 0.0f; 2384 procs.xpsGlyphs[0].horizontalOffset = 0.0f;
2332 procs.xpsGlyphs[0].verticalOffset = 0.0f; 2385 procs.xpsGlyphs[0].verticalOffset = 0.0f;
2333 2386
2334 HRV(AddGlyphs(d, 2387 HRV(AddGlyphs(d,
2335 this->fXpsFactory.get(), 2388 this->fXpsFactory.get(),
2336 this->fCurrentXpsCanvas.get(), 2389 this->fCurrentXpsCanvas.get(),
2337 typeface->xpsFont, 2390 typeface,
2338 NULL, 2391 NULL,
2339 procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(), 2392 procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(),
2340 &origin, 2393 &origin,
2341 SkScalarToFLOAT(paint.getTextSize()), 2394 SkScalarToFLOAT(paint.getTextSize()),
2342 XPS_STYLE_SIMULATION_NONE, 2395 XPS_STYLE_SIMULATION_NONE,
2343 *d.fMatrix, 2396 *d.fMatrix,
2344 paint)); 2397 paint));
2345 } 2398 }
2346 2399
2347 void SkXPSDevice::drawTextOnPath(const SkDraw& d, const void* text, size_t len, 2400 void SkXPSDevice::drawTextOnPath(const SkDraw& d, const void* text, size_t len,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 IID_PPV_ARGS(&this->fXpsFactory)), 2464 IID_PPV_ARGS(&this->fXpsFactory)),
2412 "Could not create factory for layer."); 2465 "Could not create factory for layer.");
2413 2466
2414 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), 2467 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas),
2415 "Could not create canvas for layer."); 2468 "Could not create canvas for layer.");
2416 } 2469 }
2417 2470
2418 bool SkXPSDevice::allowImageFilter(SkImageFilter*) { 2471 bool SkXPSDevice::allowImageFilter(SkImageFilter*) {
2419 return false; 2472 return false;
2420 } 2473 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698