aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/utils
diff options
context:
space:
mode:
authorGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-10-13 22:13:05 +0000
committerGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-10-13 22:13:05 +0000
commit8d84fac294682647694b0d2d8a87ac2bd19b6aab (patch)
tree2bfd3dea3c5c79bf42003ce620a51069526f28f0 /include/utils
parent60eaa398ebdded0fb7957724c170baabef811e17 (diff)
Refactor SkCanvas so that backends don't need to override it.
Methods or classes that should go away are marked deprecated. The only thing I know of that breaks backward compatibility is SkCanvas((SkDevice*)NULL), but that is fairly unlikely to occur in the wild because that constructor had a default value of NULL. Review URL: http://codereview.appspot.com/2103045 git-svn-id: http://skia.googlecode.com/svn/trunk@604 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/utils')
-rw-r--r--include/utils/SkGLCanvas.h69
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