| 121 | } |
| 122 | |
| 123 | sk_sp<SkData> ShaderCache::load(const SkData& key) { |
| 124 | auto keyByteViewUnowned = Valdi::BytesView(nullptr, static_cast<const Byte*>(key.data()), key.size()); |
| 125 | auto loadResult = loadShaderFromDisk(keyByteViewUnowned); |
| 126 | if (loadResult.failure()) { |
| 127 | return nullptr; |
| 128 | } else { |
| 129 | auto result = loadResult.moveValue(); |
| 130 | // TODO(rjaber): Data copy is temporary; Skia expects the returned SkData pointer to be 4 bytes aligned. By |
| 131 | // doing the copy, we rely on SkData being correctly aligned on creation. |
| 132 | return snap::drawing::skDataFromBytes(result, snap::drawing::DataConversionModeAlwaysCopy); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | } // namespace snap::drawing |
nothing calls this directly
no test coverage detected