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

Unified Diff: skia/ext/vector_platform_device_linux.cc

Issue 3590011: Update use of SkCanvas and SkDevice to match change in Skia (Closed)
Patch Set: Bump deps again to bring in fix for memory leak Created 10 years, 2 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_linux.h ('k') | skia/ext/vector_platform_device_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_linux.cc
diff --git a/skia/ext/vector_platform_device_linux.cc b/skia/ext/vector_platform_device_linux.cc
index cbe465dbdce77bd5085e953bf7073309d0511699..6eae954935fc46017e950ab9259aab1661715aed 100644
--- a/skia/ext/vector_platform_device_linux.cc
+++ b/skia/ext/vector_platform_device_linux.cc
@@ -12,13 +12,13 @@
#include <map>
+#include "base/logging.h"
+#include "base/singleton.h"
+#include "skia/ext/bitmap_platform_device.h"
#include "third_party/skia/include/core/SkFontHost.h"
#include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/core/SkTypeface.h"
-#include "base/logging.h"
-#include "base/singleton.h"
-
namespace {
struct FontInfo {
@@ -65,6 +65,31 @@ bool IsContextValid(cairo_t* context) {
namespace skia {
+SkDevice* SkVectorPlatformDeviceFactory::newDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ bool isForLayer) {
+ SkASSERT(config == SkBitmap::kARGB_8888_Config);
+ return CreateDevice(NULL, width, height, isOpaque);
+}
+
+// static
+SkDevice* SkVectorPlatformDeviceFactory::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.
+ // Fallback to bitmap when context is NULL.
+ if (!isOpaque || NULL == context) {
+ return BitmapPlatformDevice::Create(width, height, isOpaque);
+ }
+
+ PlatformDevice* device =
+ VectorPlatformDevice::create(context, width, height);
+ return device;
+}
+
VectorPlatformDevice* VectorPlatformDevice::create(PlatformSurface context,
int width, int height) {
SkASSERT(cairo_status(context) == CAIRO_STATUS_SUCCESS);
« no previous file with comments | « skia/ext/vector_platform_device_linux.h ('k') | skia/ext/vector_platform_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698