OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 SkDWriteFontFileStream_DEFINED | 8 #ifndef SkDWriteFontFileStream_DEFINED |
9 #define SkDWriteFontFileStream_DEFINED | 9 #define SkDWriteFontFileStream_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 | 12 |
13 #include "SkStream.h" | 13 #include "SkStream.h" |
14 #include "SkTScopedComPtr.h" | 14 #include "SkTScopedComPtr.h" |
15 | 15 |
16 #include <dwrite.h> | 16 #include <dwrite.h> |
17 | 17 |
18 /** | 18 /** |
19 * An SkStream backed by an IDWriteFontFileStream. | 19 * An SkStream backed by an IDWriteFontFileStream. |
20 * This allows Skia code to read an IDWriteFontFileStream. | 20 * This allows Skia code to read an IDWriteFontFileStream. |
21 */ | 21 */ |
22 class SkDWriteFontFileStream : public SkStreamMemory { | 22 class SkDWriteFontFileStream : public SkStreamMemory { |
23 public: | 23 public: |
24 explicit SkDWriteFontFileStream(IDWriteFontFileStream* fontFileStream); | 24 explicit SkDWriteFontFileStream(IDWriteFontFileStream* fontFileStream); |
25 virtual ~SkDWriteFontFileStream(); | 25 virtual ~SkDWriteFontFileStream(); |
26 | 26 |
27 virtual size_t read(void* buffer, size_t size) SK_OVERRIDE; | 27 size_t read(void* buffer, size_t size) SK_OVERRIDE; |
28 virtual bool isAtEnd() const SK_OVERRIDE; | 28 bool isAtEnd() const SK_OVERRIDE; |
29 virtual bool rewind() SK_OVERRIDE; | 29 bool rewind() SK_OVERRIDE; |
30 virtual SkDWriteFontFileStream* duplicate() const SK_OVERRIDE; | 30 SkDWriteFontFileStream* duplicate() const SK_OVERRIDE; |
31 virtual size_t getPosition() const SK_OVERRIDE; | 31 size_t getPosition() const SK_OVERRIDE; |
32 virtual bool seek(size_t position) SK_OVERRIDE; | 32 bool seek(size_t position) SK_OVERRIDE; |
33 virtual bool move(long offset) SK_OVERRIDE; | 33 bool move(long offset) SK_OVERRIDE; |
34 virtual SkDWriteFontFileStream* fork() const SK_OVERRIDE; | 34 SkDWriteFontFileStream* fork() const SK_OVERRIDE; |
35 virtual size_t getLength() const SK_OVERRIDE; | 35 size_t getLength() const SK_OVERRIDE; |
36 virtual const void* getMemoryBase() SK_OVERRIDE; | 36 const void* getMemoryBase() SK_OVERRIDE; |
37 | 37 |
38 private: | 38 private: |
39 SkTScopedComPtr<IDWriteFontFileStream> fFontFileStream; | 39 SkTScopedComPtr<IDWriteFontFileStream> fFontFileStream; |
40 size_t fPos; | 40 size_t fPos; |
41 const void* fLockedMemory; | 41 const void* fLockedMemory; |
42 void* fFragmentLock; | 42 void* fFragmentLock; |
43 }; | 43 }; |
44 | 44 |
45 /** | 45 /** |
46 * An IDWriteFontFileStream backed by an SkStream. | 46 * An IDWriteFontFileStream backed by an SkStream. |
(...skipping 21 matching lines...) Expand all Loading... |
68 | 68 |
69 private: | 69 private: |
70 explicit SkDWriteFontFileStreamWrapper(SkStream* stream); | 70 explicit SkDWriteFontFileStreamWrapper(SkStream* stream); |
71 virtual ~SkDWriteFontFileStreamWrapper() { } | 71 virtual ~SkDWriteFontFileStreamWrapper() { } |
72 | 72 |
73 ULONG fRefCount; | 73 ULONG fRefCount; |
74 SkAutoTUnref<SkStream> fStream; | 74 SkAutoTUnref<SkStream> fStream; |
75 SkMutex fStreamMutex; | 75 SkMutex fStreamMutex; |
76 }; | 76 }; |
77 #endif | 77 #endif |
OLD | NEW |