Region_quickContains_2.cpp 741 B

1234567891011121314151617
  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. // HASH=eb6d290887e1a3a0b051b4d7b012f5e1
  5. REG_FIDDLE(Region_quickContains_2, 256, 256, true, 0) {
  6. void draw(SkCanvas* canvas) {
  7. auto debugster = [](const char* label, SkRegion& region) -> void {
  8. SkDebugf("%s: %s\n", label, region.quickContains(2, 2, 3, 3) ? "true" : "false");
  9. };
  10. SkRegion region({1, 2, 3, 4});
  11. debugster("quickContains 1", region);
  12. region.op({1, 4, 3, 6}, SkRegion::kUnion_Op);
  13. debugster("quickContains 2", region);
  14. region.op({1, 7, 3, 8}, SkRegion::kUnion_Op);
  15. debugster("quickContains 3", region);
  16. }
  17. } // END FIDDLE