Flutter Engine
The Flutter Engine
SkSLOutputStream.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2019 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
9
10#include <stdio.h>
11#include <memory>
12
13namespace SkSL {
14
15void OutputStream::writeString(const std::string& s) {
16 this->write(s.c_str(), s.size());
17}
18
19void OutputStream::printf(const char format[], ...) {
20 va_list args;
22 this->appendVAList(format, args);
23 va_end(args);
24}
25
26void OutputStream::appendVAList(const char format[], va_list args) {
27 char buffer[kBufferSize];
28 va_list copy;
29 va_copy(copy, args);
30 int length = vsnprintf(buffer, kBufferSize, format, args);
31 if (length > (int) kBufferSize) {
32 std::unique_ptr<char[]> bigBuffer(new char[length + 1]);
33 vsnprintf(bigBuffer.get(), length + 1, format, copy);
34 this->write(bigBuffer.get(), length);
35 } else {
36 this->write(buffer, length);
37 }
38 va_end(copy);
39}
40
41} // namespace SkSL
static void copy(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:31
void writeString(const std::string &s)
virtual void write(const void *s, size_t size)=0
void printf(const char format[],...) SK_PRINTF_LIKE(2
void void appendVAList(const char format[], va_list args) SK_PRINTF_LIKE(2
struct MyStruct s
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
size_t length
Definition: copy.py:1
va_start(args, format)
va_end(args)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126