Commit 74bf1ba9 authored by Linshizhi's avatar Linshizhi

update example: pass width and height as arguments to skia_svg_render

parent 543fd0db
......@@ -15,19 +15,19 @@
#include "include/gpu/gl/GrGLTypes.h"
int main(int argc, char *argv[]) {
const int width = 1920;
const int height = 1080;
const int width = atoi(argv[3]);
const int height = atoi(argv[4]);
const int pixelBytes = 4;
if (argc < 3) {
std::cout << "Usage: skia_svg_render input_svg_path output_png_path\n";
if (argc < 5) {
std::cout << "Usage: skia_svg_render input_svg_path output_png_path width height\n";
return 1;
}
SkImageInfo imgInfo = SkImageInfo::Make(
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];
auto canvas = SkCanvas::MakeRasterDirect(
imgInfo, buffer, imgInfo.width() * pixelBytes);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment