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

Unified Diff: skia/ext/vector_platform_device_cairo_linux.cc

Issue 7193040: Revert 91504 - Stop using deprecated factory API for SkDevice (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 5 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/vector_platform_device_cairo_linux.h ('k') | skia/ext/vector_platform_device_emf_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/vector_platform_device_cairo_linux.cc
===================================================================
--- skia/ext/vector_platform_device_cairo_linux.cc (revision 91504)
+++ skia/ext/vector_platform_device_cairo_linux.cc (working copy)
@@ -68,10 +68,20 @@
namespace skia {
+SkDevice* VectorPlatformDeviceCairoFactory::newDevice(SkCanvas* ignored,
+ SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ bool isForLayer) {
+ SkASSERT(config == SkBitmap::kARGB_8888_Config);
+ return CreateDevice(NULL, width, height, isOpaque);
+}
+
// static
-PlatformDevice* VectorPlatformDeviceCairo::CreateDevice(cairo_t* context,
- int width, int height,
- bool isOpaque) {
+PlatformDevice* VectorPlatformDeviceCairoFactory::CreateDevice(cairo_t* context,
+ int width,
+ int height,
+ bool isOpaque) {
// TODO(myhuang): Here we might also have similar issues as those on Windows
// (vector_canvas_win.cc, http://crbug.com/18382 & http://crbug.com/18383).
// Please note that is_opaque is true when we use this class for printing.
@@ -80,10 +90,22 @@
return BitmapPlatformDevice::Create(width, height, isOpaque);
}
+ PlatformDevice* device =
+ VectorPlatformDeviceCairo::create(context, width, height);
+ return device;
+}
+
+VectorPlatformDeviceCairo* VectorPlatformDeviceCairo::create(
+ PlatformSurface context,
+ int width,
+ int height) {
SkASSERT(cairo_status(context) == CAIRO_STATUS_SUCCESS);
SkASSERT(width > 0);
SkASSERT(height > 0);
+ // TODO(myhuang): Can we get rid of the bitmap? In this vectorial device,
+ // the content of this bitmap might be meaningless. However, it does occupy
+ // lots of memory space.
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
@@ -107,19 +129,15 @@
cairo_destroy(context_);
}
+SkDeviceFactory* VectorPlatformDeviceCairo::onNewDeviceFactory() {
+ return SkNEW(VectorPlatformDeviceCairoFactory);
+}
+
PlatformDevice::PlatformSurface
VectorPlatformDeviceCairo::BeginPlatformPaint() {
return context_;
}
-SkDevice* VectorPlatformDeviceCairo::onCreateCompatibleDevice(
- SkBitmap::Config config,
- int width, int height,
- bool isOpaque, Usage) {
- SkASSERT(config == SkBitmap::kARGB_8888_Config);
- return CreateDevice(NULL, width, height, isOpaque);
-}
-
uint32_t VectorPlatformDeviceCairo::getDeviceCapabilities() {
return SkDevice::getDeviceCapabilities() | kVector_Capability;
}
« no previous file with comments | « skia/ext/vector_platform_device_cairo_linux.h ('k') | skia/ext/vector_platform_device_emf_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698