2 * Copyright 2011 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
9 #include "include/core/SkBitmap.h"
10 #include "include/core/SkCanvas.h"
11 #include "include/core/SkColorPriv.h"
12 #include "include/core/SkPaint.h"
13 #include "include/core/SkShader.h"
14 #include "include/core/SkSize.h"
15 #include "include/core/SkString.h"
16 #include "include/core/SkTileMode.h"
19 class TinyBitmapGM : public skiagm::GM {
20 void onOnceBeforeDraw() override { this->setBGColor(0xFFDDDDDD); }
22 SkString onShortName() override { return SkString("tinybitmap"); }
24 SkISize onISize() override { return SkISize::Make(100, 100); }
26 void onDraw(SkCanvas* canvas) override {
28 bm.allocN32Pixels(1, 1);
29 *bm.getAddr32(0, 0) = SkPackARGB32(0x80, 0x80, 0, 0);
31 paint.setAlphaf(0.5f);
32 paint.setShader(bm.makeShader(SkTileMode::kRepeat, SkTileMode::kMirror,
33 SkSamplingOptions()));
34 canvas->drawPaint(paint);
39 DEF_GM( return new TinyBitmapGM; )