Redelivering r3555 to re-add run-time switching between ANGLE and native opengl
http://codereview.appspot.com/5969044/
git-svn-id: http://skia.googlecode.com/svn/trunk@3578 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleApp.h b/samplecode/SampleApp.h
index 94f663f..ba404da 100644
--- a/samplecode/SampleApp.h
+++ b/samplecode/SampleApp.h
@@ -36,6 +36,9 @@
kRaster_DeviceType,
kPicture_DeviceType,
kGPU_DeviceType,
+#if SK_ANGLE
+ kANGLE_DeviceType,
+#endif
kNullGPU_DeviceType
};
/**
@@ -47,12 +50,9 @@
*/
class DeviceManager : public SkRefCnt {
public:
- // called at end of SampleWindow cons
- virtual void init(SampleWindow* win, bool useAltContext) = 0;
+ virtual void setUpBackend(SampleWindow* win) = 0;
- // called when selecting a new device type
- // can disallow a device type by returning false.
- virtual bool supportsDeviceType(DeviceType dType) = 0;
+ virtual void tearDownBackend(SampleWindow* win) = 0;
// called before drawing. should install correct device
// type on the canvas. Will skip drawing if returns false.
@@ -71,7 +71,7 @@
virtual void windowSizeChanged(SampleWindow* win) = 0;
// return the GrContext backing gpu devices
- virtual GrContext* getGrContext(DeviceType dType) = 0;
+ virtual GrContext* getGrContext() = 0;
};
SampleWindow(void* hwnd, int argc, char** argv, DeviceManager*);
@@ -85,7 +85,7 @@
void toggleFPS();
void showOverview();
- GrContext* getGrContext() const { return fDevManager->getGrContext(fDeviceType); }
+ GrContext* getGrContext() const { return fDevManager->getGrContext(); }
void setZoomCenter(float x, float y);
void changeZoomLevel(float delta);
@@ -100,6 +100,8 @@
SkData* getPDFData() { return fPDFData; }
void postInvalDelay();
+ DeviceType getDeviceType() const { return fDeviceType; }
+
protected:
virtual void onDraw(SkCanvas* canvas);
virtual bool onHandleKey(SkKey key);