| 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(Surface_notifyContentWillChange, 256, 256, true, 0) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
auto surface = SkSurfaces::Raster(SkImageInfo::MakeN32Premul(1, 1)); |
| 7 |
for (int i = 0; i < 3; ++i) { |
| 8 |
SkDebugf("surface generationID: %u\n", surface->generationID()); |
| 9 |
if (0 == i) { |
| 10 |
surface->getCanvas()->drawColor(SK_ColorBLACK); |
| 11 |
} else { |
| 12 |
surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode); |
| 13 |
} |
| 14 |
} |
| 15 |
} |
| 16 |
} // END FIDDLE |