| 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 #include "SkTypes.h" | 7 #include "SkTypes.h" |
| 8 | 8 |
| 9 #include "Test.h" | 9 #include "Test.h" |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 return true; | 65 return true; |
| 66 } | 66 } |
| 67 | 67 |
| 68 static void test_fontHostStream(skiatest::Reporter* reporter) { | 68 static void test_fontHostStream(skiatest::Reporter* reporter) { |
| 69 | 69 |
| 70 { | 70 { |
| 71 SkPaint paint; | 71 SkPaint paint; |
| 72 paint.setColor(SK_ColorGRAY); | 72 paint.setColor(SK_ColorGRAY); |
| 73 paint.setTextSize(SkIntToScalar(30)); | 73 paint.setTextSize(SkIntToScalar(30)); |
| 74 | 74 |
| 75 paint.setTypeface(SkTypeface::CreateFromName("Georgia", SkTypeface::kNor
mal))->unref(); | 75 SkTypeface* fTypeface = SkTypeface::CreateFromName("Georgia", |
| 76 SkTypeface::kNormal); |
| 77 SkSafeUnref(paint.setTypeface(fTypeface)); |
| 76 | 78 |
| 77 SkIRect origRect = SkIRect::MakeWH(64, 64); | 79 SkIRect origRect = SkIRect::MakeWH(64, 64); |
| 78 SkBitmap origBitmap; | 80 SkBitmap origBitmap; |
| 79 create(&origBitmap, origRect, SkBitmap::kARGB_8888_Config); | 81 create(&origBitmap, origRect, SkBitmap::kARGB_8888_Config); |
| 80 SkCanvas origCanvas(origBitmap); | 82 SkCanvas origCanvas(origBitmap); |
| 81 | 83 |
| 82 SkIRect streamRect = SkIRect::MakeWH(64, 64); | 84 SkIRect streamRect = SkIRect::MakeWH(64, 64); |
| 83 SkBitmap streamBitmap; | 85 SkBitmap streamBitmap; |
| 84 create(&streamBitmap, streamRect, SkBitmap::kARGB_8888_Config); | 86 create(&streamBitmap, streamRect, SkBitmap::kARGB_8888_Config); |
| 85 SkCanvas streamCanvas(streamBitmap); | 87 SkCanvas streamCanvas(streamBitmap); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 105 | 107 |
| 106 REPORTER_ASSERT(reporter, | 108 REPORTER_ASSERT(reporter, |
| 107 compare(origBitmap, origRect, streamBitmap, streamRect))
; | 109 compare(origBitmap, origRect, streamBitmap, streamRect))
; |
| 108 } | 110 } |
| 109 //Make sure the typeface is deleted and removed. | 111 //Make sure the typeface is deleted and removed. |
| 110 SkGraphics::PurgeFontCache(); | 112 SkGraphics::PurgeFontCache(); |
| 111 } | 113 } |
| 112 | 114 |
| 113 #include "TestClassDef.h" | 115 #include "TestClassDef.h" |
| 114 DEFINE_TESTCLASS("FontHost::CreateTypefaceFromStream", FontHostStreamTestClass,
test_fontHostStream) | 116 DEFINE_TESTCLASS("FontHost::CreateTypefaceFromStream", FontHostStreamTestClass,
test_fontHostStream) |
| OLD | NEW |