Debian Codegraph @

docs/examples/Bitmap_ComputeIsOpaque.cpp

raw
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(Bitmap_ComputeIsOpaque, 256, 256, true, 0) {
5 void draw(SkCanvas* canvas) {
6 SkBitmap bitmap;
7 bitmap.setInfo(SkImageInfo::Make(2, 2, kN32_SkColorType, kPremul_SkAlphaType));
8 for (int index = 0; index < 2; ++index) {
9 bitmap.allocPixels();
10 bitmap.eraseColor(0x00000000);
11 SkDebugf("computeIsOpaque: %s\n", SkBitmap::ComputeIsOpaque(bitmap) ? "true" : "false");
12 bitmap.eraseColor(0xFFFFFFFF);
13 SkDebugf("computeIsOpaque: %s\n", SkBitmap::ComputeIsOpaque(bitmap) ? "true" : "false");
14 bitmap.setInfo(bitmap.info().makeAlphaType(kOpaque_SkAlphaType));
15 }
16 }
17 } // END FIDDLE