Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
sksl
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
8
#include "
src/sksl/SkSLOutputStream.h
"
9
10
#include <
stdio.h
>
11
#include <memory>
12
13
namespace
SkSL
{
14
15
void
OutputStream::writeString
(
const
std::string&
s
) {
16
this->
write
(s.c_str(),
s
.size());
17
}
18
19
void
OutputStream::printf
(
const
char
format
[], ...) {
20
va_list
args
;
21
va_start(
args
,
format
);
22
this->
appendVAList
(format,
args
);
23
va_end(
args
);
24
}
25
26
void
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
SkSLOutputStream.h
SkSL::OutputStream::writeString
void writeString(const std::string &s)
Definition
SkSLOutputStream.cpp:15
SkSL::OutputStream::write
virtual void write(const void *s, size_t size)=0
SkSL::OutputStream::printf
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition
SkSLOutputStream.cpp:19
SkSL::OutputStream::appendVAList
void void appendVAList(const char format[], va_list args) SK_PRINTF_LIKE(2
Definition
SkSLOutputStream.cpp:26
s
struct MyStruct s
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition
fl_event_channel.h:89
buffer
static const uint8_t buffer[]
Definition
fl_pixel_buffer_texture_test.cc:44
format
uint32_t uint32_t * format
Definition
fl_texture_registrar_test.cc:41
length
size_t length
Definition
key_event_handler.cc:41
SkSL
Definition
SkCapabilities.h:15
copy
Definition
copy.py:1
stdio.h
Generated on Fri Apr 26 2024 06:17:34 for Flutter Engine by
1.9.8