2 * Copyright 2015 Google Inc.
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
10 #ifndef HelloWorld_DEFINED
11 #define HelloWorld_DEFINED
13 #include "SkSurface.h"
21 class HelloWorldWindow : public SkOSWindow {
27 HelloWorldWindow(void* hwnd);
28 virtual ~HelloWorldWindow() override;
30 // Changes the device type of the object.
33 DeviceType getDeviceType() const { return fType; }
36 SkSurface* createSurface() override {
37 if (kGPU_DeviceType == fType) {
38 SkSurfaceProps props(INHERITED::getSurfaceProps());
39 return SkSurface::NewRenderTargetDirect(fRenderTarget, &props);
41 static const SkImageInfo info = SkImageInfo::MakeN32Premul(
42 SkScalarRoundToInt(this->width()), SkScalarRoundToInt(this->height()));
43 return fSurface = SkSurface::NewRaster(info);
46 void draw(SkCanvas* canvas) override;
47 void drawContents(SkCanvas* canvas);
49 void onSizeChange() override;
52 bool findNextMatch(); // Set example to the first one that matches FLAGS_match.
54 void setUpRenderTarget();
55 bool onHandleChar(SkUnichar unichar) override;
56 void tearDownBackend();
59 SkScalar fRotationAngle;
65 GrRenderTarget* fRenderTarget;
66 AttachmentInfo fAttachmentInfo;
67 const GrGLInterface* fInterface;
69 typedef SkOSWindow INHERITED;