| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "Resources.h" | 8 #include "Resources.h" |
| 9 #include "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 292 } |
| 293 | 293 |
| 294 static void TestPictureTypefaceSerialization(skiatest::Reporter* reporter) { | 294 static void TestPictureTypefaceSerialization(skiatest::Reporter* reporter) { |
| 295 // Load typeface form file. | 295 // Load typeface form file. |
| 296 // This test cannot run if there is no resource path. | 296 // This test cannot run if there is no resource path. |
| 297 SkString resourcePath = GetResourcePath(); | 297 SkString resourcePath = GetResourcePath(); |
| 298 if (resourcePath.isEmpty()) { | 298 if (resourcePath.isEmpty()) { |
| 299 SkDebugf("Could not run fontstream test because resourcePath not specifi
ed."); | 299 SkDebugf("Could not run fontstream test because resourcePath not specifi
ed."); |
| 300 return; | 300 return; |
| 301 } | 301 } |
| 302 SkString filename = SkOSPath::SkPathJoin(resourcePath.c_str(), "test.ttc"); | 302 SkString filename = SkOSPath::Join(resourcePath.c_str(), "test.ttc"); |
| 303 SkTypeface* typeface = SkTypeface::CreateFromFile(filename.c_str()); | 303 SkTypeface* typeface = SkTypeface::CreateFromFile(filename.c_str()); |
| 304 if (!typeface) { | 304 if (!typeface) { |
| 305 SkDebugf("Could not run fontstream test because test.ttc not found."); | 305 SkDebugf("Could not run fontstream test because test.ttc not found."); |
| 306 return; | 306 return; |
| 307 } | 307 } |
| 308 | 308 |
| 309 // Create a paint with the typeface we loaded. | 309 // Create a paint with the typeface we loaded. |
| 310 SkPaint paint; | 310 SkPaint paint; |
| 311 paint.setColor(SK_ColorGRAY); | 311 paint.setColor(SK_ColorGRAY); |
| 312 paint.setTextSize(SkIntToScalar(30)); | 312 paint.setTextSize(SkIntToScalar(30)); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 | 491 |
| 492 // Deserialize picture | 492 // Deserialize picture |
| 493 SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size); | 493 SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size); |
| 494 SkAutoTUnref<SkPicture> readPict( | 494 SkAutoTUnref<SkPicture> readPict( |
| 495 SkPicture::CreateFromBuffer(reader)); | 495 SkPicture::CreateFromBuffer(reader)); |
| 496 REPORTER_ASSERT(reporter, NULL != readPict.get()); | 496 REPORTER_ASSERT(reporter, NULL != readPict.get()); |
| 497 } | 497 } |
| 498 | 498 |
| 499 TestPictureTypefaceSerialization(reporter); | 499 TestPictureTypefaceSerialization(reporter); |
| 500 } | 500 } |
| OLD | NEW |