Add xps device to skia.
http://codereview.appspot.com/5076041/


git-svn-id: http://skia.googlecode.com/svn/trunk@2437 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/utils/win/SkTScopedComPtr.h b/include/utils/win/SkTScopedComPtr.h
index e0d1634..b9be037 100644
--- a/include/utils/win/SkTScopedComPtr.h
+++ b/include/utils/win/SkTScopedComPtr.h
@@ -6,13 +6,20 @@
  * found in the LICENSE file.
  */
 
-
 #ifndef SkSkTScopedPtr_DEFINED
 #define SkSkTScopedPtr_DEFINED
 
+#include "SkTypes.h"
 #include "SkTemplates.h"
 
 template<typename T>
+class SkBlockComRef : public T {
+private:
+    virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0;
+    virtual ULONG STDMETHODCALLTYPE Release(void) = 0;
+};
+
+template<typename T>
 class SkTScopedComPtr : SkNoncopyable {
 private:
     T *fPtr;
@@ -23,7 +30,9 @@
         this->reset();
     }
     T &operator*() const { return *fPtr; }
-    T *operator->() const { return fPtr; }
+    SkBlockComRef<T> *operator->() const {
+        return static_cast<SkBlockComRef<T>*>(fPtr);
+    }
     /**
      * Returns the address of the underlying pointer.
      * This is dangerous -- it breaks encapsulation and the reference escapes.
@@ -38,6 +47,18 @@
             this->fPtr = NULL;
         }
     }
+    
+    void swap(SkTScopedComPtr<T>& that) {
+        T* temp = this->fPtr;
+        this->fPtr = that.fPtr;
+        that.fPtr = temp;
+    }
+    
+    T* release() {
+        T* temp = this->fPtr;
+        this->fPtr = NULL;
+        return temp;
+    }
 };
 
 #endif