1 /* 2 * Copyright 2021 Google LLC 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 #include "gm/gm.h" 9 #include "include/core/SkCanvas.h" 10 #include "include/core/SkPaint.h" 11 12 namespace skiagm { 13 14 // This is just for bootstrapping Graphite. 15 class GraphiteStartGM : public GM { 16 public: GraphiteStartGM()17 GraphiteStartGM() { 18 this->setBGColor(0xFFCCCCCC); 19 } 20 21 protected: onShortName()22 SkString onShortName() override { 23 return SkString("graphitestart"); 24 } 25 onISize()26 SkISize onISize() override { 27 return SkISize::Make(256, 256); 28 } 29 onDraw(SkCanvas * canvas)30 void onDraw(SkCanvas* canvas) override { 31 SkPaint p1, p2, p3; 32 33 p1.setColor(SK_ColorRED); 34 p2.setColor(SK_ColorGREEN); 35 p3.setColor(SK_ColorBLUE); 36 37 canvas->drawRect({10, 10, 100, 100}, p1); 38 canvas->drawRect({50, 50, 150, 150}, p2); 39 canvas->drawRect({100, 100, 200, 200}, p3); 40 } 41 }; 42 43 ////////////////////////////////////////////////////////////////////////////// 44 45 DEF_GM(return new GraphiteStartGM;) 46 47 } // namespace skiagm 48