• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 Google LLC.
2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3 #include "tools/fiddle/examples.h"
4 REG_FIDDLE(Region_readFromMemory, 256, 100, false, 0) {
draw(SkCanvas * canvas)5 void draw(SkCanvas* canvas) {
6     SkRegion region({20, 20, 80, 80});
7     size_t size = region.writeToMemory(nullptr);
8     sk_sp<SkData> data = SkData::MakeUninitialized(size);
9     region.writeToMemory(data->writable_data());
10     SkRegion copy;
11     copy.readFromMemory(data->data(), data->size());
12     canvas->drawRegion(copy, SkPaint());
13 }
14 }  // END FIDDLE
15