Minor changes to XPS device.
authorbungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 1 Oct 2013 15:03:18 +0000 (15:03 +0000)
committerbungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 1 Oct 2013 15:03:18 +0000 (15:03 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@11552 2bbb7eff-a529-9590-31e7-b0007b416f81

src/device/xps/SkXPSDevice.cpp
src/utils/win/SkIStream.cpp

index 0881a0f..f837655 100644 (file)
@@ -2051,6 +2051,7 @@ HRESULT SkXPSDevice::CreateTypefaceUse(const SkPaint& paint,
     SkTScopedComPtr<IStream> fontStream;
     int ttcIndex;
     SkStream* fontData = typeface->openStream(&ttcIndex);
+    //TODO: cannot handle FON fonts.
     HRM(SkIStream::CreateFromSkStream(fontData, true, &fontStream),
         "Could not create font stream.");
 
@@ -2286,6 +2287,7 @@ void SkXPSDevice::drawText(const SkDraw& d,
     HRV(CreateTypefaceUse(paint, &typeface));
 
     SkDraw myDraw(d);
+    myDraw.fMatrix = &SkMatrix::I();
     SkXPSDrawProcs procs;
     text_draw_init(paint, text, byteLen, *typeface->glyphsUsed, myDraw, procs);
 
@@ -2336,6 +2338,7 @@ void SkXPSDevice::drawPosText(const SkDraw& d,
     HRV(CreateTypefaceUse(paint, &typeface));
 
     SkDraw myDraw(d);
+    myDraw.fMatrix = &SkMatrix::I();
     SkXPSDrawProcs procs;
     text_draw_init(paint, text, byteLen, *typeface->glyphsUsed, myDraw, procs);
 
@@ -2411,6 +2414,9 @@ SkBaseDevice* SkXPSDevice::onCreateCompatibleDevice(SkBitmap::Config config,
                                                     int width, int height,
                                                     bool isOpaque,
                                                     Usage usage) {
+
+//Conditional for bug compatibility with PDF device.
+#if 0
     if (SkBaseDevice::kGeneral_Usage == usage) {
         return NULL;
         SK_CRASH();
@@ -2420,7 +2426,7 @@ SkBaseDevice* SkXPSDevice::onCreateCompatibleDevice(SkBitmap::Config config,
         //dev->BeginCanvas(s, s, SkMatrix::I());
         //return dev;
     }
-
+#endif
     return new SkXPSDevice(this->fXpsFactory.get());
 }
 
index 182d9a8..0386ea7 100644 (file)
@@ -122,6 +122,9 @@ HRESULT SkIStream::CreateFromSkStream(SkStream* stream
                                     , bool unrefOnRelease
                                     , IStream ** ppStream)
 {
+    if (NULL == stream) {
+        return E_INVALIDARG;
+    }
     *ppStream = new SkIStream(stream, unrefOnRelease);
     return S_OK;
 }