aboutsummaryrefslogtreecommitdiffstats
path: root/include/utils
diff options
context:
space:
mode:
authortedbo <tedbo@google.com>2010-11-10 17:07:37 -0800
committertedbo <tedbo@google.com>2010-11-11 09:21:15 -0800
commit20ab88413000fcc8668eeab25d9cb714097d0c45 (patch)
tree6510be768788bfe613b3061b1dbda0b848378b74 /include/utils
parent25c9ae8253171f35b9a14dd2adc5775929330e7b (diff)
downloadexternal_skia-20ab88413000fcc8668eeab25d9cb714097d0c45.zip
external_skia-20ab88413000fcc8668eeab25d9cb714097d0c45.tar.gz
external_skia-20ab88413000fcc8668eeab25d9cb714097d0c45.tar.bz2
Skia: Merge upstream patch series that refactors SkCanvas to avoid subclassing.
This change merges upstream Skia revisions r604,r605,r618, and r623. The patch series refactors SkCanvas so that backends don't need to override it. The r623 patch was upstreamed explicitly so that this series can be made into a clean patch for Android to avoid merge conflicts in the future. The log messages from the original commits are as follows: * r604: http://code.google.com/p/skia/source/detail?r=604 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. * r605: http://code.google.com/p/skia/source/detail?r=605 Fix a memory leak in the new Canvas/Device workflow. The previous change made it difficult to inherit from SkCanvas without leaking memory. By making SkDeviceFactory not reference counted, the right thing happens more naturally, just NewCanvas : public SkCanvas(new NewDeviceFactory()) {...} * r618: http://code.google.com/p/skia/source/detail?r=618 Move the device capability method to SkDevice. These are not the capabilities of the factory, but of the device. Additionally, it is more often needed when you have a device then when you have a factory, which caused creating of a new factory. * r623: http://code.google.com/p/skia/source/detail?r=623 Remove include of SkGLDevice.h from SkGLCanvas.h The '#include "SkGLDevice.h"' from include/core/SkDevice.h requires internal Skia code to be added to the include search paths when using the deprecated API. This change adds back SkGLCanvas.cpp to avoid exposing SkGLDevice.h to the public API. The change also includes an explicit virtual destructor on SkDeviceFactory to silence a -Wnon-virtual-dtor warning and allow for -Werror. Change-Id: I3442e2801c1d8d8c9cb2a20259f15bc870c393dc
Diffstat (limited to 'include/utils')
-rw-r--r--include/utils/SkGLCanvas.h47
1 files changed, 3 insertions, 44 deletions
diff --git a/include/utils/SkGLCanvas.h b/include/utils/SkGLCanvas.h
index 40fc52d..eb99527 100644
--- a/include/utils/SkGLCanvas.h
+++ b/include/utils/SkGLCanvas.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 The Android Open Source Project
+ * Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,31 +19,11 @@
#include "SkCanvas.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);
@@ -51,30 +31,9 @@ public:
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();
-
-private:
- SkIPoint fViewportSize;
-
- // need to disallow this guy
- virtual SkDevice* setBitmapDevice(const SkBitmap& bitmap) {
- sk_throw();
- return NULL;
- }
-
- typedef SkCanvas INHERITED;
};
#endif
-