OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Computer, Inc. | 2 * Copyright (C) 2007 Apple Computer, Inc. |
3 * Copyright (c) 2007, 2008, 2009, Google Inc. All rights reserved. | 3 * Copyright (c) 2007, 2008, 2009, Google Inc. All rights reserved. |
4 * Copyright (C) 2010 Company 100, Inc. | 4 * Copyright (C) 2010 Company 100, Inc. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
8 * met: | 8 * met: |
9 * | 9 * |
10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 PassOwnPtr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer*
buffer) | 62 PassOwnPtr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer*
buffer) |
63 { | 63 { |
64 ASSERT_ARG(buffer, buffer); | 64 ASSERT_ARG(buffer, buffer); |
65 | 65 |
66 OpenTypeSanitizer sanitizer(buffer); | 66 OpenTypeSanitizer sanitizer(buffer); |
67 RefPtr<SharedBuffer> transcodeBuffer = sanitizer.sanitize(); | 67 RefPtr<SharedBuffer> transcodeBuffer = sanitizer.sanitize(); |
68 if (!transcodeBuffer) | 68 if (!transcodeBuffer) |
69 return nullptr; // validation failed. | 69 return nullptr; // validation failed. |
70 buffer = transcodeBuffer.get(); | 70 buffer = transcodeBuffer.get(); |
71 | 71 |
72 RefPtr<SkMemoryStream> stream = adoptRef(new SkMemoryStream(buffer->getAsSkD
ata().get())); | 72 SkMemoryStream* stream = new SkMemoryStream(buffer->getAsSkData().get()); |
73 RefPtr<SkTypeface> typeface = adoptRef(SkTypeface::CreateFromStream(stream.g
et())); | 73 RefPtr<SkTypeface> typeface = adoptRef(SkTypeface::CreateFromStream(stream))
; |
74 if (!typeface) | 74 if (!typeface) |
75 return nullptr; | 75 return nullptr; |
76 | 76 |
77 return adoptPtr(new FontCustomPlatformData(typeface.release())); | 77 return adoptPtr(new FontCustomPlatformData(typeface.release())); |
78 } | 78 } |
79 | 79 |
80 bool FontCustomPlatformData::supportsFormat(const String& format) | 80 bool FontCustomPlatformData::supportsFormat(const String& format) |
81 { | 81 { |
82 return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "o
pentype") || OpenTypeSanitizer::supportsFormat(format); | 82 return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "o
pentype") || OpenTypeSanitizer::supportsFormat(format); |
83 } | 83 } |
84 | 84 |
85 } // namespace blink | 85 } // namespace blink |
OLD | NEW |