aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/sk_tool_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/sk_tool_utils.cpp')
-rw-r--r--tools/sk_tool_utils.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp
index 4c4474cc57..f0672070f1 100644
--- a/tools/sk_tool_utils.cpp
+++ b/tools/sk_tool_utils.cpp
@@ -144,6 +144,12 @@ void write_pixels(SkCanvas* canvas, const SkBitmap& bitmap, int x, int y,
canvas->writePixels(info, tmp.getPixels(), tmp.rowBytes(), x, y);
}
+void write_pixels(SkSurface* surface, const SkBitmap& src, int x, int y,
+ SkColorType colorType, SkAlphaType alphaType) {
+ const SkImageInfo info = SkImageInfo::Make(src.width(), src.height(), colorType, alphaType);
+ surface->writePixels({info, src.getPixels(), src.rowBytes()}, x, y);
+}
+
sk_sp<SkShader> create_checkerboard_shader(SkColor c1, SkColor c2, int size) {
SkBitmap bm;
bm.allocPixels(SkImageInfo::MakeS32(2 * size, 2 * size, kPremul_SkAlphaType));