Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: gm/selftest.cpp

Issue 12381038: gm self-test: use a pathologically simple test case instead of dashing2 (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: tiny_comment_change Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 /**
9 * Pathologically simple drawing tests, designed to generate consistent
10 * output images across platforms for gm/tests/run.sh
11 */
12
13 #include "gm.h"
14 #include "SkCanvas.h"
15 #include "SkPaint.h"
16
17 class SelfTestGM : public skiagm::GM {
18 public:
19 SelfTestGM(const char name[], SkColor color) : fName(name), fColor(color) {}
20 const static int kWidth = 300;
21 const static int kHeight = 200;
22
23 protected:
24 SkString onShortName() {
25 return fName;
26 }
27
28 SkISize onISize() { return skiagm::make_isize(kWidth, kHeight); }
29
30 virtual void onDraw(SkCanvas* canvas) {
31 SkPaint paint;
32 paint.setStyle(SkPaint::kFill_Style);
33 paint.setColor(fColor);
34 canvas->drawRectCoords(0, 0, SkIntToScalar(kWidth), SkIntToScalar(kHeigh t), paint);
35 }
36
37 private:
38 const SkString fName;
39 const SkColor fColor;
40 };
41
42 //////////////////////////////////////////////////////////////////////////////
43
44 static skiagm::GM* F1(void*) { return new SelfTestGM("selftest1", SK_ColorGREEN) ; }
45 static skiagm::GM* F2(void*) { return new SelfTestGM("selftest2", SK_ColorBLUE); }
46
47 static skiagm::GMRegistry gR1(F1);
48 static skiagm::GMRegistry gR2(F2);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698