summaryrefslogtreecommitdiffstats
path: root/skia/ext/platform_canvas.cc
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 19:59:12 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 19:59:12 +0000
commitd89140dc2e7e84bd8ee0baebbee79e0c2793f677 (patch)
tree228fd8d27a25de89f24086d74ba3c40c5abc7b5b /skia/ext/platform_canvas.cc
parent9ee7208282528778676429e7104ce004a1d1ea8c (diff)
downloadchromium_src-d89140dc2e7e84bd8ee0baebbee79e0c2793f677.zip
chromium_src-d89140dc2e7e84bd8ee0baebbee79e0c2793f677.tar.gz
chromium_src-d89140dc2e7e84bd8ee0baebbee79e0c2793f677.tar.bz2
Chromium does native painting on a very specific device - a device retrieved through a layer iterator. This device is neither SkCanvas::getDevice() or SkCanvas::getTopDevice(). We changed it to do native painting on SkCanvas::getDevice() in r80955 which resulted in numerous regressions. This patch reverts to using the same device used pre r80955.
BUG=78891 Review URL: http://codereview.chromium.org/6826040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81143 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/platform_canvas.cc')
-rw-r--r--skia/ext/platform_canvas.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/skia/ext/platform_canvas.cc b/skia/ext/platform_canvas.cc
index 1ba6313..dfb40f7 100644
--- a/skia/ext/platform_canvas.cc
+++ b/skia/ext/platform_canvas.cc
@@ -7,6 +7,14 @@
#include "skia/ext/bitmap_platform_device.h"
#include "third_party/skia/include/core/SkTypes.h"
+namespace {
+skia::PlatformDevice* GetTopPlatformDevice(const SkCanvas* canvas) {
+ // All of our devices should be our special PlatformDevice.
+ SkCanvas::LayerIter iter(const_cast<SkCanvas*>(canvas), false);
+ return static_cast<skia::PlatformDevice*>(iter.device());
+}
+}
+
namespace skia {
PlatformCanvas::PlatformCanvas()
@@ -22,9 +30,7 @@ SkDevice* PlatformCanvas::setBitmapDevice(const SkBitmap&) {
}
PlatformDevice& PlatformCanvas::getTopPlatformDevice() const {
- // All of our devices should be our special PlatformDevice.
- SkCanvas::LayerIter iter(const_cast<PlatformCanvas*>(this), false);
- return *static_cast<PlatformDevice*>(iter.device());
+ return *GetTopPlatformDevice(this);
}
// static
@@ -46,23 +52,17 @@ SkCanvas* CreateBitmapCanvas(int width, int height, bool 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();
+ return GetTopPlatformDevice(canvas)->IsNativeFontRenderingAllowed();
}
PlatformDevice::PlatformSurface BeginPlatformPaint(SkCanvas* canvas) {
- // All of our devices should be our special PlatformDevice.
- PlatformDevice* device = static_cast<PlatformDevice*>(canvas->getDevice());
- return device->BeginPlatformPaint();
+ return GetTopPlatformDevice(canvas)->BeginPlatformPaint();
}
void EndPlatformPaint(SkCanvas* canvas) {
- // All of our devices should be our special PlatformDevice.
- PlatformDevice* device = static_cast<PlatformDevice*>(canvas->getDevice());
- device->EndPlatformPaint();
+ GetTopPlatformDevice(canvas)->EndPlatformPaint();
}
} // namespace skia