skia2/gm/tinybitmap.cpp
John Stiles 1cf2c8d6ec Enable ClangTidy flag modernize-use-override.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-override.html

Adds override (introduced in C++11) to overridden virtual functions and
removes virtual from those functions as it is not required.

virtual on non base class implementations was used to help indicate to
the user that a function was virtual. C++ compilers did not use the
presence of this to signify an overridden function.

Change-Id: If66d8919358f72a4035190caf8d7569268037a9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310160
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-14 10:54:45 +00:00

39 lines
1.1 KiB
C++

/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColorPriv.h"
#include "include/core/SkPaint.h"
#include "include/core/SkShader.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/core/SkTileMode.h"
namespace {
class TinyBitmapGM : public skiagm::GM {
void onOnceBeforeDraw() override { this->setBGColor(0xFFDDDDDD); }
SkString onShortName() override { return SkString("tinybitmap"); }
SkISize onISize() override { return SkISize::Make(100, 100); }
void onDraw(SkCanvas* canvas) override {
SkBitmap bm;
bm.allocN32Pixels(1, 1);
*bm.getAddr32(0, 0) = SkPackARGB32(0x80, 0x80, 0, 0);
SkPaint paint;
paint.setAlphaf(0.5f);
paint.setShader(bm.makeShader(SkTileMode::kRepeat, SkTileMode::kMirror));
canvas->drawPaint(paint);
}
};
} // namespace
DEF_GM( return new TinyBitmapGM; )