xref: /aosp_15_r20/external/skia/docs/examples/Pixmap_bounds.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Worker // Copyright 2019 Google LLC.
2*c8dee2aaSAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3*c8dee2aaSAndroid Build Coastguard Worker #include "tools/fiddle/examples.h"
4*c8dee2aaSAndroid Build Coastguard Worker REG_FIDDLE(Pixmap_bounds, 256, 256, true, 0) {
draw(SkCanvas * canvas)5*c8dee2aaSAndroid Build Coastguard Worker void draw(SkCanvas* canvas) {
6*c8dee2aaSAndroid Build Coastguard Worker     for (int width : { 0, 2 } ) {
7*c8dee2aaSAndroid Build Coastguard Worker         for (int height : { 0, 2 } ) {
8*c8dee2aaSAndroid Build Coastguard Worker              SkPixmap pixmap(SkImageInfo::MakeA8(width, height), nullptr, width);
9*c8dee2aaSAndroid Build Coastguard Worker              SkDebugf("width: %d height: %d empty: %s\n", width, height,
10*c8dee2aaSAndroid Build Coastguard Worker                       pixmap.bounds().isEmpty() ? "true" : "false");
11*c8dee2aaSAndroid Build Coastguard Worker         }
12*c8dee2aaSAndroid Build Coastguard Worker     }
13*c8dee2aaSAndroid Build Coastguard Worker }
14*c8dee2aaSAndroid Build Coastguard Worker }  // END FIDDLE
15