diff options
Diffstat (limited to 'include/utils/SkGLCanvas.h')
-rw-r--r-- | include/utils/SkGLCanvas.h | 69 |
1 files changed, 21 insertions, 48 deletions
diff --git a/include/utils/SkGLCanvas.h b/include/utils/SkGLCanvas.h index 40fc52d556..87c81ff5a2 100644 --- a/include/utils/SkGLCanvas.h +++ b/include/utils/SkGLCanvas.h @@ -18,62 +18,35 @@ #define SkGLCanvas_DEFINED #include "SkCanvas.h" +#include "SkGLDevice.h" -#ifdef SK_BUILD_FOR_MAC - #include <OpenGL/gl.h> -#elif defined(ANDROID) - #include <GLES/gl.h> -#endif - -class SkGLDevice; -class SkGLClipIter; - +// Deprecated. You should now use SkGLDevice and SkGLDeviceFactory with +// SkCanvas. class SkGLCanvas : public SkCanvas { public: - // notice, we do NOT allow the SkCanvas(bitmap) constructor, since that - // does not create a SkGLDevice, which we require - SkGLCanvas(); - virtual ~SkGLCanvas(); - - // overrides from SkCanvas - - virtual bool getViewport(SkIPoint*) const; - virtual bool setViewport(int width, int height); - - virtual SkDevice* createDevice(SkBitmap::Config, int width, int height, - bool isOpaque, bool isForLayer); - - // settings for the global texture cache - - static size_t GetTextureCacheMaxCount(); - static void SetTextureCacheMaxCount(size_t count); + SkGLCanvas() : SkCanvas(SkNEW(SkGLDeviceFactory)) {} - static size_t GetTextureCacheMaxSize(); - static void SetTextureCacheMaxSize(size_t size); - - /** Call glDeleteTextures for all textures (including those for text) - This should be called while the gl-context is still valid. Its purpose - is to free up gl resources. Note that if a bitmap or text is drawn after - this call, new caches will be created. - */ - static void DeleteAllTextures(); - - /** Forget all textures without calling delete (including those for text). - This should be called if the gl-context has changed, and the texture - IDs that have been cached are no longer valid. - */ - static void AbandonAllTextures(); + static size_t GetTextureCacheMaxCount() { + return SkGLDevice::GetTextureCacheMaxCount(); + } + static void SetTextureCacheMaxCount(size_t count) { + SkGLDevice::SetTextureCacheMaxCount(count); + } -private: - SkIPoint fViewportSize; + static size_t GetTextureCacheMaxSize() { + return SkGLDevice::GetTextureCacheMaxSize(); + } + static void SetTextureCacheMaxSize(size_t size) { + SkGLDevice::SetTextureCacheMaxSize(size); + } - // need to disallow this guy - virtual SkDevice* setBitmapDevice(const SkBitmap& bitmap) { - sk_throw(); - return NULL; + static void DeleteAllTextures() { + SkGLDevice::DeleteAllTextures(); } - typedef SkCanvas INHERITED; + static void AbandonAllTextures() { + SkGLDevice::AbandonAllTextures(); + } }; #endif |