summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 16:55:51 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 16:55:51 +0000
commit31bc68d88ec4895d63af2c8a422a881154733a81 (patch)
tree12bbe0cfc76df657b6794b25bd2253bed8cfbac6
parent56ab759058f6d8fca079efbe0d61dc984216aea7 (diff)
downloadchromium_src-31bc68d88ec4895d63af2c8a422a881154733a81.zip
chromium_src-31bc68d88ec4895d63af2c8a422a881154733a81.tar.gz
chromium_src-31bc68d88ec4895d63af2c8a422a881154733a81.tar.bz2
Added skia::SupportsPlatformPaint for webkit to query whether it can use native API to draw on a particular canvas.
Review URL: http://codereview.chromium.org/6820037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81107 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--skia/ext/platform_canvas.cc8
-rw-r--r--skia/ext/platform_canvas.h5
2 files changed, 13 insertions, 0 deletions
diff --git a/skia/ext/platform_canvas.cc b/skia/ext/platform_canvas.cc
index 36f0e94..1ba6313 100644
--- a/skia/ext/platform_canvas.cc
+++ b/skia/ext/platform_canvas.cc
@@ -45,6 +45,14 @@ SkCanvas* CreateBitmapCanvas(int width, int height, bool is_opaque) {
return new PlatformCanvas(width, height, is_opaque);
}
+bool SupportsPlatformPaint(const SkCanvas* canvas) {
+ // All of our devices should be our special PlatformDevice.
+ PlatformDevice* device = static_cast<PlatformDevice*>(canvas->getDevice());
+ // TODO(alokp): Rename PlatformDevice::IsNativeFontRenderingAllowed after
+ // removing these calls from WebKit.
+ return device->IsNativeFontRenderingAllowed();
+}
+
PlatformDevice::PlatformSurface BeginPlatformPaint(SkCanvas* canvas) {
// All of our devices should be our special PlatformDevice.
PlatformDevice* device = static_cast<PlatformDevice*>(canvas->getDevice());
diff --git a/skia/ext/platform_canvas.h b/skia/ext/platform_canvas.h
index c4d9222..24f613a 100644
--- a/skia/ext/platform_canvas.h
+++ b/skia/ext/platform_canvas.h
@@ -119,6 +119,11 @@ class SK_API PlatformCanvas : public SkCanvas {
// transparency: this will enable some optimizations.
SK_API SkCanvas* CreateBitmapCanvas(int width, int height, bool is_opaque);
+// Returns true if native platform routines can be used to draw on the
+// given canvas. If this function returns false, BeginPlatformPaint will
+// return NULL PlatformSurface.
+SK_API bool SupportsPlatformPaint(const SkCanvas* canvas);
+
// These calls should surround calls to platform drawing routines, the
// surface returned here can be used with the native platform routines.
//