Bitmap_rowBytesAsPixels.cpp 562 B

12345678910111213
  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=03a9e08082a23a98de17c3e24871d61a
  5. REG_FIDDLE(Bitmap_rowBytesAsPixels, 256, 256, true, 0) {
  6. void draw(SkCanvas* canvas) {
  7. SkBitmap bitmap;
  8. for (int rowBytes : { 4, 5, 6, 7, 8} ) {
  9. bitmap.setInfo(SkImageInfo::MakeN32(1, 1, kPremul_SkAlphaType), rowBytes);
  10. SkDebugf("rowBytes: %d rowBytesAsPixels: %d\n", rowBytes, bitmap.rowBytesAsPixels());
  11. }
  12. }
  13. } // END FIDDLE