Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
I
IMGRender
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
IMGRender
Commits
74bf1ba9
Commit
74bf1ba9
authored
Aug 01, 2022
by
Linshizhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update example: pass width and height as arguments to skia_svg_render
parent
543fd0db
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
skia_svg_render.cc
examples/skia_svg_render.cc
+5
-5
No files found.
examples/skia_svg_render.cc
View file @
74bf1ba9
...
@@ -15,19 +15,19 @@
...
@@ -15,19 +15,19 @@
#include "include/gpu/gl/GrGLTypes.h"
#include "include/gpu/gl/GrGLTypes.h"
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
const
int
width
=
1920
;
const
int
width
=
atoi
(
argv
[
3
])
;
const
int
height
=
1080
;
const
int
height
=
atoi
(
argv
[
4
])
;
const
int
pixelBytes
=
4
;
const
int
pixelBytes
=
4
;
if
(
argc
<
3
)
{
if
(
argc
<
5
)
{
std
::
cout
<<
"Usage: skia_svg_render input_svg_path output_png_path
\n
"
;
std
::
cout
<<
"Usage: skia_svg_render input_svg_path output_png_path
width height
\n
"
;
return
1
;
return
1
;
}
}
SkImageInfo
imgInfo
=
SkImageInfo
::
Make
(
SkImageInfo
imgInfo
=
SkImageInfo
::
Make
(
width
,
height
,
kBGRA_8888_SkColorType
,
kOpaque_SkAlphaType
);
width
,
height
,
kBGRA_8888_SkColorType
,
kOpaque_SkAlphaType
);
size_t
size
=
1920
*
1080
*
4
;
size_t
size
=
width
*
height
*
4
;
uint8_t
*
buffer
=
new
uint8_t
[
size
];
uint8_t
*
buffer
=
new
uint8_t
[
size
];
auto
canvas
=
SkCanvas
::
MakeRasterDirect
(
auto
canvas
=
SkCanvas
::
MakeRasterDirect
(
imgInfo
,
buffer
,
imgInfo
.
width
()
*
pixelBytes
);
imgInfo
,
buffer
,
imgInfo
.
width
()
*
pixelBytes
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment