Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(890)

Unified Diff: skia/ext/platform_canvas.cc

Issue 6987019: Revert 86625 - This change implements a first pass in the effort to remove the dependency of Plat... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/ext/platform_canvas.h ('k') | skia/ext/platform_canvas_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/platform_canvas.cc
===================================================================
--- skia/ext/platform_canvas.cc (revision 86628)
+++ skia/ext/platform_canvas.cc (working copy)
@@ -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() {
@@ -21,6 +29,10 @@
return NULL;
}
+PlatformDevice& PlatformCanvas::getTopPlatformDevice() const {
+ return *GetTopPlatformDevice(this);
+}
+
// static
size_t PlatformCanvas::StrideForWidth(unsigned width) {
return 4 * width;
@@ -39,32 +51,18 @@
return new PlatformCanvas(width, height, is_opaque);
}
-SkDevice* GetTopDevice(const SkCanvas& canvas) {
- SkCanvas::LayerIter iter(const_cast<SkCanvas*>(&canvas), false);
- return iter.device();
-}
-
bool SupportsPlatformPaint(const SkCanvas* canvas) {
- // TODO(alokp): Rename IsNativeFontRenderingAllowed after removing these
- // calls from WebKit.
- return IsNativeFontRenderingAllowed(GetTopDevice(*canvas));
+ // TODO(alokp): Rename PlatformDevice::IsNativeFontRenderingAllowed after
+ // removing these calls from WebKit.
+ return GetTopPlatformDevice(canvas)->IsNativeFontRenderingAllowed();
}
-PlatformSurface BeginPlatformPaint(SkCanvas* canvas) {
- return BeginPlatformPaint(GetTopDevice(*canvas));
+PlatformDevice::PlatformSurface BeginPlatformPaint(SkCanvas* canvas) {
+ return GetTopPlatformDevice(canvas)->BeginPlatformPaint();
}
void EndPlatformPaint(SkCanvas* canvas) {
- EndPlatformPaint(GetTopDevice(*canvas));
+ GetTopPlatformDevice(canvas)->EndPlatformPaint();
}
-void DrawToNativeContext(SkCanvas* canvas, PlatformSurface context, int x,
- int y, const PlatformRect* src_rect) {
- DrawToNativeContext(GetTopDevice(*canvas), context, x, y, src_rect);
-}
-
-void MakeOpaque(SkCanvas* canvas, int x, int y, int width, int height) {
- MakeOpaque(GetTopDevice(*canvas), x, y, width, height);
-}
-
} // namespace skia
« no previous file with comments | « skia/ext/platform_canvas.h ('k') | skia/ext/platform_canvas_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698