Bitmap_isNull.cpp 657 B

1234567891011121314
  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=211ec89418011aa6e54aa2cc9567e003
  5. REG_FIDDLE(Bitmap_isNull, 256, 256, true, 0) {
  6. void draw(SkCanvas* canvas) {
  7. SkBitmap bitmap;
  8. SkDebugf("empty bitmap does %shave pixels\n", bitmap.isNull() ? "not " : "");
  9. bitmap.setInfo(SkImageInfo::MakeA8(8, 8));
  10. SkDebugf("bitmap with dimensions does %shave pixels\n", bitmap.isNull() ? "not " : "");
  11. bitmap.allocPixels();
  12. SkDebugf("allocated bitmap does %shave pixels\n", bitmap.isNull() ? "not " : "");
  13. }
  14. } // END FIDDLE