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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
| 11 #include "SkFontDescriptor.h" |
11 #include "SkFontHost.h" | 12 #include "SkFontHost.h" |
12 #include "SkGraphics.h" | 13 #include "SkGraphics.h" |
13 #include "SkPaint.h" | 14 #include "SkPaint.h" |
14 #include "SkPoint.h" | 15 #include "SkPoint.h" |
15 #include "SkRect.h" | 16 #include "SkRect.h" |
16 #include "SkStream.h" | 17 #include "SkStream.h" |
17 #include "SkTypeface.h" | 18 #include "SkTypeface.h" |
18 #include "SkTypes.h" | 19 #include "SkTypes.h" |
19 #include "Test.h" | 20 #include "Test.h" |
20 | 21 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 92 |
92 SkTypeface* origTypeface = paint.getTypeface(); | 93 SkTypeface* origTypeface = paint.getTypeface(); |
93 SkAutoTUnref<SkTypeface> aur; | 94 SkAutoTUnref<SkTypeface> aur; |
94 if (NULL == origTypeface) { | 95 if (NULL == origTypeface) { |
95 origTypeface = aur.reset(SkTypeface::RefDefault()); | 96 origTypeface = aur.reset(SkTypeface::RefDefault()); |
96 } | 97 } |
97 | 98 |
98 int ttcIndex; | 99 int ttcIndex; |
99 SkAutoTUnref<SkStream> fontData(origTypeface->openStream(&ttcIndex)); | 100 SkAutoTUnref<SkStream> fontData(origTypeface->openStream(&ttcIndex)); |
100 SkTypeface* streamTypeface = SkTypeface::CreateFromStream(fontData); | 101 SkTypeface* streamTypeface = SkTypeface::CreateFromStream(fontData); |
| 102 |
| 103 SkFontDescriptor desc; |
| 104 bool isLocalStream = false; |
| 105 streamTypeface->getFontDescriptor(&desc, &isLocalStream); |
| 106 REPORTER_ASSERT(reporter, isLocalStream); |
| 107 |
101 SkSafeUnref(paint.setTypeface(streamTypeface)); | 108 SkSafeUnref(paint.setTypeface(streamTypeface)); |
102 drawBG(&streamCanvas); | 109 drawBG(&streamCanvas); |
103 streamCanvas.drawPosText("A", 1, &point, paint); | 110 streamCanvas.drawPosText("A", 1, &point, paint); |
104 | 111 |
105 REPORTER_ASSERT(reporter, | 112 REPORTER_ASSERT(reporter, |
106 compare(origBitmap, origRect, streamBitmap, streamRect))
; | 113 compare(origBitmap, origRect, streamBitmap, streamRect))
; |
107 } | 114 } |
108 //Make sure the typeface is deleted and removed. | 115 //Make sure the typeface is deleted and removed. |
109 SkGraphics::PurgeFontCache(); | 116 SkGraphics::PurgeFontCache(); |
110 } | 117 } |
OLD | NEW |