summaryrefslogtreecommitdiff
path: root/chromium/skia
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2013-12-11 21:33:03 +0100
committerAndras Becsi <andras.becsi@digia.com>2013-12-13 12:34:07 +0100
commitf2a33ff9cbc6d19943f1c7fbddd1f23d23975577 (patch)
tree0586a32aa390ade8557dfd6b4897f43a07449578 /chromium/skia
parent5362912cdb5eea702b68ebe23702468d17c3017a (diff)
downloadqtwebengine-chromium-f2a33ff9cbc6d19943f1c7fbddd1f23d23975577.tar.gz
Update Chromium to branch 1650 (31.0.1650.63)
Change-Id: I57d8c832eaec1eb2364e0a8e7352a6dd354db99f Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'chromium/skia')
-rw-r--r--chromium/skia/OWNERS2
-rw-r--r--chromium/skia/config/SkUserConfig.h6
-rw-r--r--chromium/skia/ext/SkDiscardableMemory_chrome.cc49
-rw-r--r--chromium/skia/ext/SkDiscardableMemory_chrome.h33
-rw-r--r--chromium/skia/ext/analysis_canvas.cc5
-rw-r--r--chromium/skia/ext/analysis_canvas.h16
-rw-r--r--chromium/skia/ext/benchmarking_canvas.cc11
-rw-r--r--chromium/skia/ext/bitmap_platform_device_android.cc6
-rw-r--r--chromium/skia/ext/bitmap_platform_device_android.h10
-rw-r--r--chromium/skia/ext/bitmap_platform_device_linux.cc8
-rw-r--r--chromium/skia/ext/bitmap_platform_device_linux.h10
-rw-r--r--chromium/skia/ext/bitmap_platform_device_mac.cc28
-rw-r--r--chromium/skia/ext/bitmap_platform_device_mac.h15
-rw-r--r--chromium/skia/ext/bitmap_platform_device_win.cc12
-rw-r--r--chromium/skia/ext/bitmap_platform_device_win.h14
-rw-r--r--chromium/skia/ext/lazy_pixel_ref_utils.cc15
-rw-r--r--chromium/skia/ext/platform_canvas.cc4
-rw-r--r--chromium/skia/ext/platform_canvas.h6
-rw-r--r--chromium/skia/ext/platform_canvas_unittest.cc4
-rw-r--r--chromium/skia/ext/platform_device.cc6
-rw-r--r--chromium/skia/ext/platform_device.h38
-rw-r--r--chromium/skia/ext/platform_device_mac.cc2
-rw-r--r--chromium/skia/ext/skia_utils_mac.mm4
-rw-r--r--chromium/skia/ext/vector_canvas.cc6
-rw-r--r--chromium/skia/ext/vector_canvas.h5
-rw-r--r--chromium/skia/ext/vector_canvas_unittest.cc5
-rw-r--r--chromium/skia/ext/vector_platform_device_emf_win.cc17
-rw-r--r--chromium/skia/ext/vector_platform_device_emf_win.h23
-rw-r--r--chromium/skia/ext/vector_platform_device_skia.cc2
-rw-r--r--chromium/skia/ext/vector_platform_device_skia.h3
-rw-r--r--chromium/skia/skia.gyp5
-rw-r--r--chromium/skia/skia_chrome.gypi4
-rw-r--r--chromium/skia/skia_library.gypi74
-rw-r--r--chromium/skia/skia_library_opts.gyp4
-rw-r--r--chromium/skia/skia_test_expectations.txt33
35 files changed, 284 insertions, 201 deletions
diff --git a/chromium/skia/OWNERS b/chromium/skia/OWNERS
index fe892fd24cf..4f480790615 100644
--- a/chromium/skia/OWNERS
+++ b/chromium/skia/OWNERS
@@ -5,7 +5,7 @@ bungeman@google.com
djsollen@google.com
edisonn@google.com
epoger@google.com
-fmalita@google.com
+fmalita@chromium.org
junov@chromium.org
jvanverth@google.com
reed@google.com
diff --git a/chromium/skia/config/SkUserConfig.h b/chromium/skia/config/SkUserConfig.h
index a0cb64f941c..77a9af97a66 100644
--- a/chromium/skia/config/SkUserConfig.h
+++ b/chromium/skia/config/SkUserConfig.h
@@ -123,12 +123,6 @@
#define SK_SFNTLY_SUBSETTER \
"third_party/sfntly/cpp/src/sample/chromium/font_subsetter.h"
-/* Define this to remove dimension checks on bitmaps. Not all blits will be
- correct yet, so this is mostly for debugging the implementation.
- */
-//#define SK_ALLOW_OVER_32K_BITMAPS
-
-
/* To write debug messages to a console, skia will call SkDebugf(...) following
printf conventions (e.g. const char* format, ...). If you want to redirect
this to something other than printf, define yours here
diff --git a/chromium/skia/ext/SkDiscardableMemory_chrome.cc b/chromium/skia/ext/SkDiscardableMemory_chrome.cc
new file mode 100644
index 00000000000..2e78788febc
--- /dev/null
+++ b/chromium/skia/ext/SkDiscardableMemory_chrome.cc
@@ -0,0 +1,49 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "SkDiscardableMemory_chrome.h"
+
+SkDiscardableMemoryChrome::SkDiscardableMemoryChrome()
+ : discardable_(new base::DiscardableMemory()) {
+}
+
+SkDiscardableMemoryChrome::~SkDiscardableMemoryChrome() {
+}
+
+bool SkDiscardableMemoryChrome::lock() {
+ base::LockDiscardableMemoryStatus status = discardable_->Lock();
+ switch (status) {
+ case base::DISCARDABLE_MEMORY_SUCCESS:
+ return true;
+ case base::DISCARDABLE_MEMORY_PURGED:
+ discardable_->Unlock();
+ return false;
+ default:
+ discardable_.reset();
+ return false;
+ }
+}
+
+void* SkDiscardableMemoryChrome::data() {
+ return discardable_->Memory();
+}
+
+void SkDiscardableMemoryChrome::unlock() {
+ discardable_->Unlock();
+}
+
+bool SkDiscardableMemoryChrome::InitializeAndLock(size_t bytes) {
+ return discardable_->InitializeAndLock(bytes);
+}
+
+SkDiscardableMemory* SkDiscardableMemory::Create(size_t bytes) {
+ if (!base::DiscardableMemory::Supported()) {
+ return NULL;
+ }
+ scoped_ptr<SkDiscardableMemoryChrome> discardable(
+ new SkDiscardableMemoryChrome());
+ if (discardable->InitializeAndLock(bytes))
+ return discardable.release();
+ return NULL;
+}
diff --git a/chromium/skia/ext/SkDiscardableMemory_chrome.h b/chromium/skia/ext/SkDiscardableMemory_chrome.h
new file mode 100644
index 00000000000..13dfef83dc8
--- /dev/null
+++ b/chromium/skia/ext/SkDiscardableMemory_chrome.h
@@ -0,0 +1,33 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_
+#define SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_
+
+#include "base/memory/discardable_memory.h"
+#include "base/memory/scoped_ptr.h"
+#include "third_party/skia/src/core/SkDiscardableMemory.h"
+
+// This class implements the SkDiscardableMemory interface using
+// base::DiscardableMemory.
+class SK_API SkDiscardableMemoryChrome : public SkDiscardableMemory {
+public:
+ SkDiscardableMemoryChrome();
+ virtual ~SkDiscardableMemoryChrome();
+
+ // Initialize the SkDiscardableMemoryChrome object and lock the memory.
+ // Returns true on success. No memory is allocated if this call returns
+ // false. This call should only be called once.
+ bool InitializeAndLock(size_t bytes);
+
+ // Implementation of SkDiscardableMemory interface.
+ virtual bool lock() OVERRIDE;
+ virtual void* data() OVERRIDE;
+ virtual void unlock() OVERRIDE;
+
+private:
+ scoped_ptr<base::DiscardableMemory> discardable_;
+};
+
+#endif // SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_
diff --git a/chromium/skia/ext/analysis_canvas.cc b/chromium/skia/ext/analysis_canvas.cc
index a2d397c89db..9db42f17ab6 100644
--- a/chromium/skia/ext/analysis_canvas.cc
+++ b/chromium/skia/ext/analysis_canvas.cc
@@ -212,7 +212,8 @@ void AnalysisDevice::drawBitmapRect(const SkDraw& draw,
const SkBitmap& bitmap,
const SkRect* src_or_null,
const SkRect& dst,
- const SkPaint& paint) {
+ const SkPaint& paint,
+ SkCanvas::DrawBitmapRectFlags flags) {
// Call drawRect to determine transparency,
// but reset solid color to false.
drawRect(draw, dst, paint);
@@ -282,7 +283,7 @@ void AnalysisDevice::drawVertices(const SkDraw& draw,
}
void AnalysisDevice::drawDevice(const SkDraw& draw,
- SkDevice* device,
+ SkBaseDevice* device,
int x,
int y,
const SkPaint& paint) {
diff --git a/chromium/skia/ext/analysis_canvas.h b/chromium/skia/ext/analysis_canvas.h
index 5db1540e6af..78d72ff9381 100644
--- a/chromium/skia/ext/analysis_canvas.h
+++ b/chromium/skia/ext/analysis_canvas.h
@@ -6,8 +6,8 @@
#define SKIA_EXT_ANALYSIS_CANVAS_H_
#include "base/compiler_specific.h"
+#include "third_party/skia/include/core/SkBitmapDevice.h"
#include "third_party/skia/include/core/SkCanvas.h"
-#include "third_party/skia/include/core/SkDevice.h"
#include "third_party/skia/include/core/SkPicture.h"
namespace skia {
@@ -58,7 +58,10 @@ class SK_API AnalysisCanvas : public SkCanvas, public SkDrawPictureCallback {
int force_not_transparent_stack_level_;
};
-class SK_API AnalysisDevice : public SkDevice {
+// TODO(robertphillips): Once Skia's SkBaseDevice API is refactored to
+// remove the bitmap-specific entry points, it might make sense for this
+// to be derived from SkBaseDevice (rather than SkBitmapDevice)
+class SK_API AnalysisDevice : public SkBitmapDevice {
public:
AnalysisDevice(const SkBitmap& bitmap);
virtual ~AnalysisDevice();
@@ -70,7 +73,7 @@ class SK_API AnalysisDevice : public SkDevice {
void SetForceNotTransparent(bool flag);
protected:
- // SkDevice overrides.
+ // SkBaseDevice overrides.
virtual void clear(SkColor color) OVERRIDE;
virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) OVERRIDE;
virtual void drawPoints(const SkDraw& draw,
@@ -102,7 +105,8 @@ class SK_API AnalysisDevice : public SkDevice {
const SkBitmap& bitmap,
const SkRect* src_or_null,
const SkRect& dst,
- const SkPaint& paint) OVERRIDE;
+ const SkPaint& paint,
+ SkCanvas::DrawBitmapRectFlags flags) OVERRIDE;
virtual void drawText(const SkDraw& draw,
const void* text,
size_t len,
@@ -142,13 +146,13 @@ class SK_API AnalysisDevice : public SkDevice {
int index_count,
const SkPaint& paint) OVERRIDE;
virtual void drawDevice(const SkDraw& draw,
- SkDevice* device,
+ SkBaseDevice* device,
int x,
int y,
const SkPaint& paint) OVERRIDE;
private:
- typedef SkDevice INHERITED;
+ typedef SkBitmapDevice INHERITED;
bool is_forced_not_solid_;
bool is_forced_not_transparent_;
diff --git a/chromium/skia/ext/benchmarking_canvas.cc b/chromium/skia/ext/benchmarking_canvas.cc
index d83252b4c55..557827f37cb 100644
--- a/chromium/skia/ext/benchmarking_canvas.cc
+++ b/chromium/skia/ext/benchmarking_canvas.cc
@@ -6,7 +6,7 @@
#include "base/logging.h"
#include "base/time/time.h"
#include "skia/ext/benchmarking_canvas.h"
-#include "third_party/skia/include/core/SkDevice.h"
+#include "third_party/skia/include/core/SkBitmapDevice.h"
#include "third_party/skia/include/utils/SkProxyCanvas.h"
namespace skia {
@@ -25,8 +25,8 @@ class TimingCanvas : public SkProxyCanvas {
public:
TimingCanvas(int width, int height, const BenchmarkingCanvas* track_canvas)
: tracking_canvas_(track_canvas) {
- skia::RefPtr<SkDevice> device = skia::AdoptRef(
- SkNEW_ARGS(SkDevice, (SkBitmap::kARGB_8888_Config, width, height)));
+ skia::RefPtr<SkBaseDevice> device = skia::AdoptRef(
+ SkNEW_ARGS(SkBitmapDevice, (SkBitmap::kARGB_8888_Config, width, height)));
canvas_ = skia::AdoptRef(SkNEW_ARGS(SkCanvas, (device.get())));
setProxy(canvas_.get());
@@ -122,9 +122,10 @@ public:
virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
const SkRect& dst,
- const SkPaint* paint = NULL) OVERRIDE {
+ const SkPaint* paint,
+ DrawBitmapRectFlags flags) OVERRIDE {
AutoStamper stamper(this);
- SkProxyCanvas::drawBitmapRectToRect(bitmap, src, dst, paint);
+ SkProxyCanvas::drawBitmapRectToRect(bitmap, src, dst, paint, flags);
}
virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
diff --git a/chromium/skia/ext/bitmap_platform_device_android.cc b/chromium/skia/ext/bitmap_platform_device_android.cc
index 8a29586abcb..32f447f4ac3 100644
--- a/chromium/skia/ext/bitmap_platform_device_android.cc
+++ b/chromium/skia/ext/bitmap_platform_device_android.cc
@@ -46,14 +46,14 @@ BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height,
}
BitmapPlatformDevice::BitmapPlatformDevice(const SkBitmap& bitmap)
- : SkDevice(bitmap) {
+ : SkBitmapDevice(bitmap) {
SetPlatformDevice(this, this);
}
BitmapPlatformDevice::~BitmapPlatformDevice() {
}
-SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
+SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
SkBitmap::Config config, int width, int height, bool isOpaque,
Usage /*usage*/) {
SkASSERT(config == SkBitmap::kARGB_8888_Config);
@@ -76,7 +76,7 @@ void BitmapPlatformDevice::DrawToNativeContext(
SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque,
uint8_t* data, OnFailureType failureType) {
- skia::RefPtr<SkDevice> dev = skia::AdoptRef(
+ skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef(
BitmapPlatformDevice::Create(width, height, is_opaque, data));
return CreateCanvas(dev, failureType);
}
diff --git a/chromium/skia/ext/bitmap_platform_device_android.h b/chromium/skia/ext/bitmap_platform_device_android.h
index b5755cb4b0b..4e1735f1f5a 100644
--- a/chromium/skia/ext/bitmap_platform_device_android.h
+++ b/chromium/skia/ext/bitmap_platform_device_android.h
@@ -12,13 +12,13 @@
namespace skia {
// -----------------------------------------------------------------------------
-// For now we just use SkBitmap for SkDevice
+// For now we just use SkBitmap for SkBitmapDevice
//
// This is all quite ok for test_shell. In the future we will want to use
// shared memory between the renderer and the main process at least. In this
// case we'll probably create the buffer from a precreated region of memory.
// -----------------------------------------------------------------------------
-class BitmapPlatformDevice : public SkDevice, public PlatformDevice {
+class BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice {
public:
// Construct a BitmapPlatformDevice. |is_opaque| should be set if the caller
// knows the bitmap will be completely opaque and allows some optimizations.
@@ -47,9 +47,9 @@ class BitmapPlatformDevice : public SkDevice, public PlatformDevice {
const PlatformRect* src_rect) OVERRIDE;
protected:
- virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
- int height, bool isOpaque,
- Usage usage) OVERRIDE;
+ virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
+ int height, bool isOpaque,
+ Usage usage) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice);
diff --git a/chromium/skia/ext/bitmap_platform_device_linux.cc b/chromium/skia/ext/bitmap_platform_device_linux.cc
index c9a02148d8e..af26806fd30 100644
--- a/chromium/skia/ext/bitmap_platform_device_linux.cc
+++ b/chromium/skia/ext/bitmap_platform_device_linux.cc
@@ -133,11 +133,11 @@ BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height,
}
// The device will own the bitmap, which corresponds to also owning the pixel
-// data. Therefore, we do not transfer ownership to the SkDevice's bitmap.
+// data. Therefore, we do not transfer ownership to the SkBitmapDevice's bitmap.
BitmapPlatformDevice::BitmapPlatformDevice(
const SkBitmap& bitmap,
BitmapPlatformDeviceData* data)
- : SkDevice(bitmap),
+ : SkBitmapDevice(bitmap),
data_(data) {
SetPlatformDevice(this, this);
}
@@ -145,7 +145,7 @@ BitmapPlatformDevice::BitmapPlatformDevice(
BitmapPlatformDevice::~BitmapPlatformDevice() {
}
-SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
+SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
SkBitmap::Config config, int width, int height, bool isOpaque,
Usage /*usage*/) {
SkASSERT(config == SkBitmap::kARGB_8888_Config);
@@ -180,7 +180,7 @@ void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform,
SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque,
uint8_t* data, OnFailureType failureType) {
- skia::RefPtr<SkDevice> dev = skia::AdoptRef(
+ skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef(
BitmapPlatformDevice::Create(width, height, is_opaque, data));
return CreateCanvas(dev, failureType);
}
diff --git a/chromium/skia/ext/bitmap_platform_device_linux.h b/chromium/skia/ext/bitmap_platform_device_linux.h
index e1f9a75c850..048092e076f 100644
--- a/chromium/skia/ext/bitmap_platform_device_linux.h
+++ b/chromium/skia/ext/bitmap_platform_device_linux.h
@@ -56,7 +56,7 @@ namespace skia {
// shared memory between the renderer and the main process at least. In this
// case we'll probably create the buffer from a precreated region of memory.
// -----------------------------------------------------------------------------
-class BitmapPlatformDevice : public SkDevice, public PlatformDevice {
+class BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice {
// A reference counted cairo surface
class BitmapPlatformDeviceData;
@@ -86,7 +86,7 @@ class BitmapPlatformDevice : public SkDevice, public PlatformDevice {
static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
uint8_t* data);
- // Overridden from SkDevice:
+ // Overridden from SkBaseDevice:
virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region,
const SkClipStack&) OVERRIDE;
@@ -96,9 +96,9 @@ class BitmapPlatformDevice : public SkDevice, public PlatformDevice {
const PlatformRect* src_rect) OVERRIDE;
protected:
- virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
- int height, bool isOpaque,
- Usage usage) OVERRIDE;
+ virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
+ int height, bool isOpaque,
+ Usage usage) OVERRIDE;
private:
static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
diff --git a/chromium/skia/ext/bitmap_platform_device_mac.cc b/chromium/skia/ext/bitmap_platform_device_mac.cc
index b7b05e50a3c..66298b28f05 100644
--- a/chromium/skia/ext/bitmap_platform_device_mac.cc
+++ b/chromium/skia/ext/bitmap_platform_device_mac.cc
@@ -125,15 +125,17 @@ BitmapPlatformDevice* BitmapPlatformDevice::Create(CGContextRef context,
return NULL;
SkBitmap bitmap;
+ // TODO: verify that the CG Context's pixels will have tight rowbytes or pass in the correct
+ // rowbytes for the case when context != NULL.
bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
- if (bitmap.allocPixels() != true)
- return NULL;
- void* data = NULL;
+ void* data;
if (context) {
data = CGBitmapContextGetData(context);
bitmap.setPixels(data);
} else {
+ if (!bitmap.allocPixels())
+ return NULL;
data = bitmap.getPixels();
}
@@ -193,10 +195,10 @@ BitmapPlatformDevice* BitmapPlatformDevice::CreateWithData(uint8_t* data,
}
// The device will own the bitmap, which corresponds to also owning the pixel
-// data. Therefore, we do not transfer ownership to the SkDevice's bitmap.
+// data. Therefore, we do not transfer ownership to the SkBitmapDevice's bitmap.
BitmapPlatformDevice::BitmapPlatformDevice(
const skia::RefPtr<BitmapPlatformDeviceData>& data, const SkBitmap& bitmap)
- : SkDevice(bitmap),
+ : SkBitmapDevice(bitmap),
data_(data) {
SetPlatformDevice(this, this);
}
@@ -246,17 +248,13 @@ void BitmapPlatformDevice::DrawToNativeContext(CGContextRef context, int x,
data_->ReleaseBitmapContext();
}
-const SkBitmap& BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) {
- // Not needed in CoreGraphics
- return *bitmap;
-}
-
-SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
+SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
SkBitmap::Config config, int width, int height, bool isOpaque,
Usage /*usage*/) {
SkASSERT(config == SkBitmap::kARGB_8888_Config);
- SkDevice* bitmap_device = BitmapPlatformDevice::CreateAndClear(width, height,
- isOpaque);
+ SkBaseDevice* bitmap_device = BitmapPlatformDevice::CreateAndClear(width,
+ height,
+ isOpaque);
return bitmap_device;
}
@@ -264,14 +262,14 @@ SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
SkCanvas* CreatePlatformCanvas(CGContextRef ctx, int width, int height,
bool is_opaque, OnFailureType failureType) {
- skia::RefPtr<SkDevice> dev = skia::AdoptRef(
+ skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef(
BitmapPlatformDevice::Create(ctx, width, height, is_opaque));
return CreateCanvas(dev, failureType);
}
SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque,
uint8_t* data, OnFailureType failureType) {
- skia::RefPtr<SkDevice> dev = skia::AdoptRef(
+ skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef(
BitmapPlatformDevice::CreateWithData(data, width, height, is_opaque));
return CreateCanvas(dev, failureType);
}
diff --git a/chromium/skia/ext/bitmap_platform_device_mac.h b/chromium/skia/ext/bitmap_platform_device_mac.h
index a1c5894086e..07b008419c4 100644
--- a/chromium/skia/ext/bitmap_platform_device_mac.h
+++ b/chromium/skia/ext/bitmap_platform_device_mac.h
@@ -26,7 +26,7 @@ namespace skia {
// For us, that other bitmap will become invalid as soon as the device becomes
// invalid, which may lead to subtle bugs. Therefore, DO NOT ASSIGN THE
// DEVICE'S PIXEL DATA TO ANOTHER BITMAP, make sure you copy instead.
-class SK_API BitmapPlatformDevice : public SkDevice, public PlatformDevice {
+class SK_API BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice {
public:
// Creates a BitmapPlatformDevice instance. |is_opaque| should be set if the
// caller knows the bitmap will be completely opaque and allows some
@@ -55,7 +55,7 @@ class SK_API BitmapPlatformDevice : public SkDevice, public PlatformDevice {
virtual void DrawToNativeContext(CGContextRef context, int x, int y,
const CGRect* src_rect) OVERRIDE;
- // SkDevice overrides
+ // SkBaseDevice overrides
virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region,
const SkClipStack&) OVERRIDE;
@@ -68,14 +68,9 @@ class SK_API BitmapPlatformDevice : public SkDevice, public PlatformDevice {
BitmapPlatformDevice(const skia::RefPtr<BitmapPlatformDeviceData>& data,
const SkBitmap& bitmap);
- // Flushes the CoreGraphics context so that the pixel data can be accessed
- // directly by Skia. Overridden from SkDevice, this is called when Skia
- // starts accessing pixel data.
- virtual const SkBitmap& onAccessBitmap(SkBitmap*) OVERRIDE;
-
- virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
- int height, bool isOpaque,
- Usage usage) OVERRIDE;
+ virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
+ int height, bool isOpaque,
+ Usage usage) OVERRIDE;
// Data associated with this device, guaranteed non-null.
skia::RefPtr<BitmapPlatformDeviceData> data_;
diff --git a/chromium/skia/ext/bitmap_platform_device_win.cc b/chromium/skia/ext/bitmap_platform_device_win.cc
index 201866aa17e..0088403bbc2 100644
--- a/chromium/skia/ext/bitmap_platform_device_win.cc
+++ b/chromium/skia/ext/bitmap_platform_device_win.cc
@@ -207,11 +207,11 @@ BitmapPlatformDevice* BitmapPlatformDevice::CreateAndClear(int width,
}
// The device will own the HBITMAP, which corresponds to also owning the pixel
-// data. Therefore, we do not transfer ownership to the SkDevice's bitmap.
+// data. Therefore, we do not transfer ownership to the SkBitmapDevice's bitmap.
BitmapPlatformDevice::BitmapPlatformDevice(
const skia::RefPtr<BitmapPlatformDeviceData>& data,
const SkBitmap& bitmap)
- : SkDevice(bitmap),
+ : SkBitmapDevice(bitmap),
data_(data) {
// The data object is already ref'ed for us by create().
SkDEBUGCODE(begin_paint_count_ = 0);
@@ -293,15 +293,15 @@ void BitmapPlatformDevice::DrawToNativeContext(HDC dc, int x, int y,
data_->ReleaseBitmapDC();
}
-const SkBitmap& BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) {
+const SkBitmap& BitmapPlatformDevice::onAccessBitmap() {
// FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI
// operation has occurred on our DC.
if (data_->IsBitmapDCCreated())
GdiFlush();
- return *bitmap;
+ return SkBitmapDevice::onAccessBitmap();
}
-SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
+SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
SkBitmap::Config config, int width, int height, bool isOpaque, Usage) {
SkASSERT(config == SkBitmap::kARGB_8888_Config);
return BitmapPlatformDevice::CreateAndClear(width, height, isOpaque);
@@ -314,7 +314,7 @@ SkCanvas* CreatePlatformCanvas(int width,
bool is_opaque,
HANDLE shared_section,
OnFailureType failureType) {
- skia::RefPtr<SkDevice> dev = skia::AdoptRef(
+ skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef(
BitmapPlatformDevice::Create(width, height, is_opaque, shared_section));
return CreateCanvas(dev, failureType);
}
diff --git a/chromium/skia/ext/bitmap_platform_device_win.h b/chromium/skia/ext/bitmap_platform_device_win.h
index c896c0aaae7..1261e51b6c5 100644
--- a/chromium/skia/ext/bitmap_platform_device_win.h
+++ b/chromium/skia/ext/bitmap_platform_device_win.h
@@ -26,7 +26,7 @@ namespace skia {
// For us, that other bitmap will become invalid as soon as the device becomes
// invalid, which may lead to subtle bugs. Therefore, DO NOT ASSIGN THE
// DEVICE'S PIXEL DATA TO ANOTHER BITMAP, make sure you copy instead.
-class SK_API BitmapPlatformDevice : public SkDevice, public PlatformDevice {
+class SK_API BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice {
public:
// Factory function. is_opaque should be set if the caller knows the bitmap
// will be completely opaque and allows some optimizations.
@@ -60,19 +60,19 @@ class SK_API BitmapPlatformDevice : public SkDevice, public PlatformDevice {
const RECT* src_rect) OVERRIDE;
// Loads the given transform and clipping region into the HDC. This is
- // overridden from SkDevice.
+ // overridden from SkBaseDevice.
virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region,
const SkClipStack&) OVERRIDE;
protected:
// Flushes the Windows device context so that the pixel data can be accessed
- // directly by Skia. Overridden from SkDevice, this is called when Skia
+ // directly by Skia. Overridden from SkBaseDevice, this is called when Skia
// starts accessing pixel data.
- virtual const SkBitmap& onAccessBitmap(SkBitmap* bitmap) OVERRIDE;
+ virtual const SkBitmap& onAccessBitmap() OVERRIDE;
- virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
- int height, bool isOpaque,
- Usage usage) OVERRIDE;
+ virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
+ int height, bool isOpaque,
+ Usage usage) OVERRIDE;
private:
// Reference counted data that can be shared between multiple devices. This
diff --git a/chromium/skia/ext/lazy_pixel_ref_utils.cc b/chromium/skia/ext/lazy_pixel_ref_utils.cc
index 67371c9035e..00ccda22fa2 100644
--- a/chromium/skia/ext/lazy_pixel_ref_utils.cc
+++ b/chromium/skia/ext/lazy_pixel_ref_utils.cc
@@ -4,10 +4,12 @@
#include "skia/ext/lazy_pixel_ref_utils.h"
+#include <algorithm>
+
#include "skia/ext/lazy_pixel_ref.h"
+#include "third_party/skia/include/core/SkBitmapDevice.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkData.h"
-#include "third_party/skia/include/core/SkDevice.h"
#include "third_party/skia/include/core/SkDraw.h"
#include "third_party/skia/include/core/SkPixelRef.h"
#include "third_party/skia/include/core/SkRRect.h"
@@ -44,10 +46,10 @@ class LazyPixelRefSet {
std::vector<LazyPixelRefUtils::PositionLazyPixelRef>* pixel_refs_;
};
-class GatherPixelRefDevice : public SkDevice {
+class GatherPixelRefDevice : public SkBitmapDevice {
public:
GatherPixelRefDevice(const SkBitmap& bm, LazyPixelRefSet* lazy_pixel_ref_set)
- : SkDevice(bm), lazy_pixel_ref_set_(lazy_pixel_ref_set) {}
+ : SkBitmapDevice(bm), lazy_pixel_ref_set_(lazy_pixel_ref_set) {}
virtual void clear(SkColor color) SK_OVERRIDE {}
virtual void writePixels(const SkBitmap& bitmap,
@@ -153,7 +155,8 @@ class GatherPixelRefDevice : public SkDevice {
const SkBitmap& bitmap,
const SkRect* src_or_null,
const SkRect& dst,
- const SkPaint& paint) SK_OVERRIDE {
+ const SkPaint& paint,
+ SkCanvas::DrawBitmapRectFlags flags) SK_OVERRIDE {
SkRect bitmap_rect = SkRect::MakeWH(bitmap.width(), bitmap.height());
SkMatrix matrix;
matrix.setRectToRect(bitmap_rect, dst, SkMatrix::kFill_ScaleToFit);
@@ -314,7 +317,7 @@ class GatherPixelRefDevice : public SkDevice {
draw, SkCanvas::kPolygon_PointMode, vertex_count, verts, paint);
}
virtual void drawDevice(const SkDraw&,
- SkDevice*,
+ SkBaseDevice*,
int x,
int y,
const SkPaint&) SK_OVERRIDE {}
@@ -348,7 +351,7 @@ class GatherPixelRefDevice : public SkDevice {
class NoSaveLayerCanvas : public SkCanvas {
public:
- NoSaveLayerCanvas(SkDevice* device) : INHERITED(device) {}
+ NoSaveLayerCanvas(SkBaseDevice* device) : INHERITED(device) {}
// Turn saveLayer() into save() for speed, should not affect correctness.
virtual int saveLayer(const SkRect* bounds,
diff --git a/chromium/skia/ext/platform_canvas.cc b/chromium/skia/ext/platform_canvas.cc
index 6a2548100bc..f0d1717c6a6 100644
--- a/chromium/skia/ext/platform_canvas.cc
+++ b/chromium/skia/ext/platform_canvas.cc
@@ -9,7 +9,7 @@
namespace skia {
-SkDevice* GetTopDevice(const SkCanvas& canvas) {
+SkBaseDevice* GetTopDevice(const SkCanvas& canvas) {
return canvas.getTopDevice(true);
}
@@ -64,7 +64,7 @@ size_t PlatformCanvasStrideForWidth(unsigned width) {
return 4 * width;
}
-SkCanvas* CreateCanvas(const skia::RefPtr<SkDevice>& device, OnFailureType failureType) {
+SkCanvas* CreateCanvas(const skia::RefPtr<SkBaseDevice>& device, OnFailureType failureType) {
if (!device) {
if (CRASH_ON_FAILURE == failureType)
SK_CRASH();
diff --git a/chromium/skia/ext/platform_canvas.h b/chromium/skia/ext/platform_canvas.h
index 9e2bc823794..85ad85e535c 100644
--- a/chromium/skia/ext/platform_canvas.h
+++ b/chromium/skia/ext/platform_canvas.h
@@ -74,7 +74,7 @@ static inline SkCanvas* CreatePlatformCanvas(int width,
return CreatePlatformCanvas(width, height, is_opaque, 0, CRASH_ON_FAILURE);
}
-SK_API SkCanvas* CreateCanvas(const skia::RefPtr<SkDevice>& device,
+SK_API SkCanvas* CreateCanvas(const skia::RefPtr<SkBaseDevice>& device,
OnFailureType failure_type);
static inline SkCanvas* CreateBitmapCanvas(int width,
@@ -95,7 +95,7 @@ static inline SkCanvas* TryCreateBitmapCanvas(int width,
// alignment reasons we may wish to increase that.
SK_API size_t PlatformCanvasStrideForWidth(unsigned width);
-// Returns the SkDevice pointer of the topmost rect with a non-empty
+// Returns the SkBaseDevice pointer of the topmost rect with a non-empty
// clip. In practice, this is usually either the top layer or nothing, since
// we usually set the clip to new layers when we make them.
//
@@ -106,7 +106,7 @@ SK_API size_t PlatformCanvasStrideForWidth(unsigned width);
//
// Danger: the resulting device should not be saved. It will be invalidated
// by the next call to save() or restore().
-SK_API SkDevice* GetTopDevice(const SkCanvas& canvas);
+SK_API SkBaseDevice* GetTopDevice(const SkCanvas& canvas);
// Returns true if native platform routines can be used to draw on the
// given canvas. If this function returns false, BeginPlatformPaint will
diff --git a/chromium/skia/ext/platform_canvas_unittest.cc b/chromium/skia/ext/platform_canvas_unittest.cc
index 7595bcaca2b..d0d83dd3130 100644
--- a/chromium/skia/ext/platform_canvas_unittest.cc
+++ b/chromium/skia/ext/platform_canvas_unittest.cc
@@ -33,7 +33,7 @@ namespace {
bool VerifyRect(const PlatformCanvas& canvas,
uint32_t canvas_color, uint32_t rect_color,
int x, int y, int w, int h) {
- SkDevice* device = skia::GetTopDevice(canvas);
+ SkBaseDevice* device = skia::GetTopDevice(canvas);
const SkBitmap& bitmap = device->accessBitmap(false);
SkAutoLockPixels lock(bitmap);
@@ -72,7 +72,7 @@ bool IsOfColor(const SkBitmap& bitmap, int x, int y, uint32_t color) {
bool VerifyRoundedRect(const PlatformCanvas& canvas,
uint32_t canvas_color, uint32_t rect_color,
int x, int y, int w, int h) {
- SkDevice* device = skia::GetTopDevice(canvas);
+ SkBaseDevice* device = skia::GetTopDevice(canvas);
const SkBitmap& bitmap = device->accessBitmap(false);
SkAutoLockPixels lock(bitmap);
diff --git a/chromium/skia/ext/platform_device.cc b/chromium/skia/ext/platform_device.cc
index c7f156516f9..ae720dfb45a 100644
--- a/chromium/skia/ext/platform_device.cc
+++ b/chromium/skia/ext/platform_device.cc
@@ -33,12 +33,12 @@ bool GetBoolMetaData(const SkCanvas& canvas, const char* key) {
} // namespace
-void SetPlatformDevice(SkDevice* device, PlatformDevice* platform_behaviour) {
+void SetPlatformDevice(SkBaseDevice* device, PlatformDevice* platform_behaviour) {
SkMetaData& meta_data = device->getMetaData();
meta_data.setPtr(kDevicePlatformBehaviour, platform_behaviour);
}
-PlatformDevice* GetPlatformDevice(SkDevice* device) {
+PlatformDevice* GetPlatformDevice(SkBaseDevice* device) {
if (device) {
SkMetaData& meta_data = device->getMetaData();
PlatformDevice* device_behaviour = NULL;
@@ -50,7 +50,7 @@ PlatformDevice* GetPlatformDevice(SkDevice* device) {
}
SkMetaData& getMetaData(const SkCanvas& canvas) {
- SkDevice* device = canvas.getDevice();
+ SkBaseDevice* device = canvas.getDevice();
DCHECK(device != NULL);
return device->getMetaData();
}
diff --git a/chromium/skia/ext/platform_device.h b/chromium/skia/ext/platform_device.h
index 4ac3aee5657..d46b5d47a3c 100644
--- a/chromium/skia/ext/platform_device.h
+++ b/chromium/skia/ext/platform_device.h
@@ -13,7 +13,7 @@
#endif
#include "third_party/skia/include/core/SkColor.h"
-#include "third_party/skia/include/core/SkDevice.h"
+#include "third_party/skia/include/core/SkBitmapDevice.h"
#include "third_party/skia/include/core/SkPreConfig.h"
class SkMatrix;
@@ -50,29 +50,27 @@ typedef CGRect PlatformRect;
#endif
// The following routines provide accessor points for the functionality
-// exported by the various PlatformDevice ports. The PlatformDevice, and
-// BitmapPlatformDevice classes inherit directly from SkDevice, which is no
-// longer a supported usage-pattern for skia. In preparation of the removal of
-// these classes, all calls to PlatformDevice::* should be routed through these
+// exported by the various PlatformDevice ports.
+// All calls to PlatformDevice::* should be routed through these
// helper functions.
// Bind a PlatformDevice instance, |platform_device| to |device|. Subsequent
// calls to the functions exported below will forward the request to the
// corresponding method on the bound PlatformDevice instance. If no
-// PlatformDevice has been bound to the SkDevice passed, then the routines are
-// NOPS.
-SK_API void SetPlatformDevice(SkDevice* device,
+// PlatformDevice has been bound to the SkBaseDevice passed, then the
+// routines are NOPS.
+SK_API void SetPlatformDevice(SkBaseDevice* device,
PlatformDevice* platform_device);
-SK_API PlatformDevice* GetPlatformDevice(SkDevice* device);
+SK_API PlatformDevice* GetPlatformDevice(SkBaseDevice* device);
#if defined(OS_WIN)
// Initializes the default settings and colors in a device context.
SK_API void InitializeDC(HDC context);
#elif defined(OS_MACOSX)
-// Returns the CGContext that backing the SkDevice. Forwards to the bound
+// Returns the CGContext that backing the SkBaseDevice. Forwards to the bound
// PlatformDevice. Returns NULL if no PlatformDevice is bound.
-SK_API CGContextRef GetBitmapContext(SkDevice* device);
+SK_API CGContextRef GetBitmapContext(SkBaseDevice* device);
#endif
// Following routines are used in print preview workflow to mark the draft mode
@@ -86,14 +84,18 @@ SK_API void SetIsPreviewMetafile(const SkCanvas& canvas, bool is_preview);
SK_API bool IsPreviewMetafile(const SkCanvas& canvas);
#endif
-// A SkDevice is basically a wrapper around SkBitmap that provides a surface for
-// SkCanvas to draw into. PlatformDevice provides a surface Windows can also
-// write to. It also provides functionality to play well with GDI drawing
-// functions. This class is abstract and must be subclassed. It provides the
-// basic interface to implement it either with or without a bitmap backend.
+// A SkBitmapDevice is basically a wrapper around SkBitmap that provides a
+// surface for SkCanvas to draw into. PlatformDevice provides a surface
+// Windows can also write to. It also provides functionality to play well
+// with GDI drawing functions. This class is abstract and must be subclassed.
+// It provides the basic interface to implement it either with or without
+// a bitmap backend.
//
-// PlatformDevice provides an interface which sub-classes of SkDevice can also
-// provide to allow for drawing by the native platform into the device.
+// PlatformDevice provides an interface which sub-classes of SkBaseDevice can
+// also provide to allow for drawing by the native platform into the device.
+// TODO(robertphillips): Once the bitmap-specific entry points are removed
+// from SkBaseDevice it might make sense for PlatformDevice to be derived
+// from it.
class SK_API PlatformDevice {
public:
virtual ~PlatformDevice() {}
diff --git a/chromium/skia/ext/platform_device_mac.cc b/chromium/skia/ext/platform_device_mac.cc
index 6ff017d5cd7..f66372bfe77 100644
--- a/chromium/skia/ext/platform_device_mac.cc
+++ b/chromium/skia/ext/platform_device_mac.cc
@@ -14,7 +14,7 @@
namespace skia {
-CGContextRef GetBitmapContext(SkDevice* device) {
+CGContextRef GetBitmapContext(SkBaseDevice* device) {
PlatformDevice* platform_device = GetPlatformDevice(device);
if (platform_device)
return platform_device->GetBitmapContext();
diff --git a/chromium/skia/ext/skia_utils_mac.mm b/chromium/skia/ext/skia_utils_mac.mm
index 213bb00e498..50217d00599 100644
--- a/chromium/skia/ext/skia_utils_mac.mm
+++ b/chromium/skia/ext/skia_utils_mac.mm
@@ -192,7 +192,7 @@ SkBitmap CGImageToSkBitmap(CGImageRef image) {
int width = CGImageGetWidth(image);
int height = CGImageGetHeight(image);
- scoped_ptr<SkDevice> device(
+ scoped_ptr<SkBaseDevice> device(
skia::BitmapPlatformDevice::Create(NULL, width, height, false));
CGContextRef context = skia::GetBitmapContext(device.get());
@@ -362,7 +362,7 @@ foundRight:
}
CGContextRef SkiaBitLocker::cgContext() {
- SkDevice* device = canvas_->getTopDevice();
+ SkBaseDevice* device = canvas_->getTopDevice();
DCHECK(device);
if (!device)
return 0;
diff --git a/chromium/skia/ext/vector_canvas.cc b/chromium/skia/ext/vector_canvas.cc
index 9de6b3d0c59..13025eb94bf 100644
--- a/chromium/skia/ext/vector_canvas.cc
+++ b/chromium/skia/ext/vector_canvas.cc
@@ -7,7 +7,7 @@
namespace skia {
-VectorCanvas::VectorCanvas(SkDevice* device)
+VectorCanvas::VectorCanvas(SkBaseDevice* device)
: PlatformCanvas(device) {
}
@@ -30,8 +30,8 @@ SkDrawFilter* VectorCanvas::setDrawFilter(SkDrawFilter* filter) {
}
bool VectorCanvas::IsTopDeviceVectorial() const {
- SkDevice* device = GetTopDevice(*this);
- return device->getDeviceCapabilities() & SkDevice::kVector_Capability;
+ SkBaseDevice* device = GetTopDevice(*this);
+ return device->getDeviceCapabilities() & SkBaseDevice::kVector_Capability;
}
} // namespace skia
diff --git a/chromium/skia/ext/vector_canvas.h b/chromium/skia/ext/vector_canvas.h
index e7a67fce9d2..66ef216ca59 100644
--- a/chromium/skia/ext/vector_canvas.h
+++ b/chromium/skia/ext/vector_canvas.h
@@ -8,7 +8,8 @@
#include "base/compiler_specific.h"
#include "skia/ext/platform_canvas.h"
-class SkDevice;
+// TODO(robertphillips): change this to "class SkBaseDevice;"
+#include "third_party/skia/include/core/SkDevice.h"
namespace skia {
@@ -19,7 +20,7 @@ namespace skia {
class SK_API VectorCanvas : public PlatformCanvas {
public:
// Ownership of |device| is transfered to VectorCanvas.
- explicit VectorCanvas(SkDevice* device);
+ explicit VectorCanvas(SkBaseDevice* device);
virtual ~VectorCanvas();
virtual SkBounder* setBounder(SkBounder* bounder) OVERRIDE;
diff --git a/chromium/skia/ext/vector_canvas_unittest.cc b/chromium/skia/ext/vector_canvas_unittest.cc
index a087aedf5d2..b12363329b9 100644
--- a/chromium/skia/ext/vector_canvas_unittest.cc
+++ b/chromium/skia/ext/vector_canvas_unittest.cc
@@ -86,7 +86,7 @@ class Image {
// Creates the image from the given filename on disk.
explicit Image(const base::FilePath& filename) : ignore_alpha_(true) {
std::string compressed;
- file_util::ReadFileToString(filename, &compressed);
+ base::ReadFileToString(filename, &compressed);
EXPECT_TRUE(compressed.size());
SkBitmap bitmap;
@@ -335,8 +335,7 @@ void LoadPngFileToSkBitmap(const base::FilePath& filename,
SkBitmap* bitmap,
bool is_opaque) {
std::string compressed;
- file_util::ReadFileToString(base::MakeAbsoluteFilePath(filename),
- &compressed);
+ base::ReadFileToString(base::MakeAbsoluteFilePath(filename), &compressed);
ASSERT_TRUE(compressed.size());
ASSERT_TRUE(gfx::PNGCodec::Decode(
diff --git a/chromium/skia/ext/vector_platform_device_emf_win.cc b/chromium/skia/ext/vector_platform_device_emf_win.cc
index 958ff8f4094..fe1ba2927db 100644
--- a/chromium/skia/ext/vector_platform_device_emf_win.cc
+++ b/chromium/skia/ext/vector_platform_device_emf_win.cc
@@ -22,7 +22,7 @@ namespace skia {
do { if (paint.isNoDrawAnnotation()) { return; } } while (0)
// static
-SkDevice* VectorPlatformDeviceEmf::CreateDevice(
+SkBaseDevice* VectorPlatformDeviceEmf::CreateDevice(
int width, int height, bool is_opaque, HANDLE shared_section) {
if (!is_opaque) {
// TODO(maruel): http://crbug.com/18382 When restoring a semi-transparent
@@ -46,7 +46,7 @@ SkDevice* VectorPlatformDeviceEmf::CreateDevice(
// SkScalarRound(value) as SkScalarRound(value * 10). Safari is already
// doing the same for text rendering.
SkASSERT(shared_section);
- SkDevice* device = VectorPlatformDeviceEmf::create(
+ SkBaseDevice* device = VectorPlatformDeviceEmf::create(
reinterpret_cast<HDC>(shared_section), width, height);
return device;
}
@@ -65,7 +65,7 @@ static void FillBitmapInfoHeader(int width, int height, BITMAPINFOHEADER* hdr) {
hdr->biClrImportant = 0;
}
-SkDevice* VectorPlatformDeviceEmf::create(HDC dc, int width, int height) {
+SkBaseDevice* VectorPlatformDeviceEmf::create(HDC dc, int width, int height) {
InitializeDC(dc);
// Link the SkBitmap to the current selected bitmap in the device context.
@@ -100,7 +100,7 @@ SkDevice* VectorPlatformDeviceEmf::create(HDC dc, int width, int height) {
}
VectorPlatformDeviceEmf::VectorPlatformDeviceEmf(HDC dc, const SkBitmap& bitmap)
- : SkDevice(bitmap),
+ : SkBitmapDevice(bitmap),
hdc_(dc),
previous_brush_(NULL),
previous_pen_(NULL) {
@@ -118,7 +118,7 @@ HDC VectorPlatformDeviceEmf::BeginPlatformPaint() {
}
uint32_t VectorPlatformDeviceEmf::getDeviceCapabilities() {
- return SkDevice::getDeviceCapabilities() | kVector_Capability;
+ return SkBitmapDevice::getDeviceCapabilities() | kVector_Capability;
}
void VectorPlatformDeviceEmf::drawPaint(const SkDraw& draw,
@@ -265,7 +265,8 @@ void VectorPlatformDeviceEmf::drawBitmapRect(const SkDraw& draw,
const SkBitmap& bitmap,
const SkRect* src,
const SkRect& dst,
- const SkPaint& paint) {
+ const SkPaint& paint,
+ SkCanvas::DrawBitmapRectFlags flags) {
SkMatrix matrix;
SkRect bitmapBounds, tmpSrc, tmpDst;
SkBitmap tmpBitmap;
@@ -585,7 +586,7 @@ void VectorPlatformDeviceEmf::drawVertices(const SkDraw& draw,
}
void VectorPlatformDeviceEmf::drawDevice(const SkDraw& draw,
- SkDevice* device,
+ SkBaseDevice* device,
int x,
int y,
const SkPaint& paint) {
@@ -692,7 +693,7 @@ void VectorPlatformDeviceEmf::LoadClipRegion() {
LoadClippingRegionToDC(hdc_, clip_region_, t);
}
-SkDevice* VectorPlatformDeviceEmf::onCreateCompatibleDevice(
+SkBaseDevice* VectorPlatformDeviceEmf::onCreateCompatibleDevice(
SkBitmap::Config config, int width, int height, bool isOpaque,
Usage /*usage*/) {
SkASSERT(config == SkBitmap::kARGB_8888_Config);
diff --git a/chromium/skia/ext/vector_platform_device_emf_win.h b/chromium/skia/ext/vector_platform_device_emf_win.h
index c0deeeceaeb..61ea4413f34 100644
--- a/chromium/skia/ext/vector_platform_device_emf_win.h
+++ b/chromium/skia/ext/vector_platform_device_emf_win.h
@@ -17,13 +17,15 @@ namespace skia {
// SkCanvas to draw into. This specific device is not not backed by a surface
// and is thus unreadable. This is because the backend is completely vectorial.
// This device is a simple wrapper over a Windows device context (HDC) handle.
-class VectorPlatformDeviceEmf : public SkDevice, public PlatformDevice {
+// TODO(robertphillips): Once Skia's SkBaseDevice is refactored to remove
+// the bitmap-specific entry points, this class should derive from it.
+class VectorPlatformDeviceEmf : public SkBitmapDevice, public PlatformDevice {
public:
- SK_API static SkDevice* CreateDevice(int width, int height, bool isOpaque,
- HANDLE shared_section);
+ SK_API static SkBaseDevice* CreateDevice(int width, int height, bool isOpaque,
+ HANDLE shared_section);
// Factory function. The DC is kept as the output context.
- static SkDevice* create(HDC dc, int width, int height);
+ static SkBaseDevice* create(HDC dc, int width, int height);
VectorPlatformDeviceEmf(HDC dc, const SkBitmap& bitmap);
virtual ~VectorPlatformDeviceEmf();
@@ -32,7 +34,7 @@ class VectorPlatformDeviceEmf : public SkDevice, public PlatformDevice {
virtual PlatformSurface BeginPlatformPaint() OVERRIDE;
virtual void DrawToNativeContext(HDC dc, int x, int y,
const RECT* src_rect) OVERRIDE;
- // SkDevice methods.
+ // SkBaseDevice methods.
virtual uint32_t getDeviceCapabilities();
virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) OVERRIDE;
virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
@@ -46,7 +48,8 @@ class VectorPlatformDeviceEmf : public SkDevice, public PlatformDevice {
bool pathIsMutable = false) OVERRIDE;
virtual void drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
const SkRect* src, const SkRect& dst,
- const SkPaint& paint) SK_OVERRIDE;
+ const SkPaint& paint,
+ SkCanvas::DrawBitmapRectFlags flags) SK_OVERRIDE;
virtual void drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
const SkMatrix& matrix,
const SkPaint& paint) OVERRIDE;
@@ -66,7 +69,7 @@ class VectorPlatformDeviceEmf : public SkDevice, public PlatformDevice {
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
const SkPaint& paint) OVERRIDE;
- virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y,
+ virtual void drawDevice(const SkDraw& draw, SkBaseDevice*, int x, int y,
const SkPaint&) OVERRIDE;
virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region,
@@ -75,9 +78,9 @@ class VectorPlatformDeviceEmf : public SkDevice, public PlatformDevice {
void LoadClipRegion();
protected:
- virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
- int height, bool isOpaque,
- Usage usage) OVERRIDE;
+ virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
+ int height, bool isOpaque,
+ Usage usage) OVERRIDE;
private:
// Applies the SkPaint's painting properties in the current GDI context, if
diff --git a/chromium/skia/ext/vector_platform_device_skia.cc b/chromium/skia/ext/vector_platform_device_skia.cc
index d8d3084afcb..b8b5c6b0c5f 100644
--- a/chromium/skia/ext/vector_platform_device_skia.cc
+++ b/chromium/skia/ext/vector_platform_device_skia.cc
@@ -77,7 +77,7 @@ CGContextRef VectorPlatformDeviceSkia::GetBitmapContext() {
SkASSERT(false);
return NULL;
}
-#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_OPENBSD)
+#elif defined(OS_POSIX)
void VectorPlatformDeviceSkia::DrawToNativeContext(
PlatformSurface surface, int x, int y, const PlatformRect* src_rect) {
// Should never be called on Linux.
diff --git a/chromium/skia/ext/vector_platform_device_skia.h b/chromium/skia/ext/vector_platform_device_skia.h
index 4a6d2d92921..cf392c05da3 100644
--- a/chromium/skia/ext/vector_platform_device_skia.h
+++ b/chromium/skia/ext/vector_platform_device_skia.h
@@ -10,7 +10,6 @@
#include "base/logging.h"
#include "skia/ext/platform_device.h"
#include "skia/ext/refptr.h"
-#include "third_party/skia/include/core/SkTScopedPtr.h"
#include "third_party/skia/include/pdf/SkPDFDevice.h"
class SkMatrix;
@@ -42,7 +41,7 @@ class VectorPlatformDeviceSkia : public SkPDFDevice, public PlatformDevice {
int y,
const CGRect* src_rect) OVERRIDE;
virtual CGContextRef GetBitmapContext() OVERRIDE;
-#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_OPENBSD)
+#elif defined(OS_POSIX)
virtual void DrawToNativeContext(PlatformSurface surface,
int x,
int y,
diff --git a/chromium/skia/skia.gyp b/chromium/skia/skia.gyp
index d1a227557c6..af1cc531d44 100644
--- a/chromium/skia/skia.gyp
+++ b/chromium/skia/skia.gyp
@@ -65,14 +65,11 @@
],
'defines': [
'SKIA_DLL',
- 'GR_DLL=1',
- 'GR_IMPLEMENTATION=1',
'SKIA_IMPLEMENTATION=1',
],
'direct_dependent_settings': {
'defines': [
'SKIA_DLL',
- 'GR_DLL=1',
],
},
},
@@ -87,7 +84,7 @@
],
}],
],
-
+
# targets that are not dependent upon the component type
'targets': [
{
diff --git a/chromium/skia/skia_chrome.gypi b/chromium/skia/skia_chrome.gypi
index 1d246057d17..a0cd3bbbf19 100644
--- a/chromium/skia/skia_chrome.gypi
+++ b/chromium/skia/skia_chrome.gypi
@@ -63,6 +63,8 @@
'ext/recursive_gaussian_convolution.cc',
'ext/recursive_gaussian_convolution.h',
'ext/refptr.h',
+ 'ext/SkDiscardableMemory_chrome.h',
+ 'ext/SkDiscardableMemory_chrome.cc',
'ext/SkMemory_new_handler.cpp',
'ext/skia_trace_shim.h',
'ext/skia_utils_base.cc',
@@ -80,7 +82,6 @@
'ext/vector_platform_device_skia.cc',
'ext/vector_platform_device_skia.h',
],
-
'conditions': [
# For POSIX platforms, prefer the Mutex implementation provided by Skia
# since it does not generate static initializers.
@@ -92,6 +93,7 @@
}],
[ 'OS == "android" and enable_printing == 0', {
'sources!': [
+ 'ext/skia_utils_base.cc',
'ext/vector_platform_device_skia.cc',
],
}],
diff --git a/chromium/skia/skia_library.gypi b/chromium/skia/skia_library.gypi
index 75408d48b9e..2ed1854c31e 100644
--- a/chromium/skia/skia_library.gypi
+++ b/chromium/skia/skia_library.gypi
@@ -40,18 +40,19 @@
'SK_ENABLE_INST_COUNT=0',
'SK_SUPPORT_GPU=<(skia_support_gpu)',
'GR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"',
+ 'SK_ENABLE_LEGACY_API_ALIASING=1',
],
-
+
'default_font_cache_limit': '(20*1024*1024)',
'conditions': [
['OS== "android"', {
# Android devices are typically more memory constrained, so
- # use a smaller glyph cache.
- 'default_font_cache_limit': '(8*1024*1024)',
+ # default to a smaller glyph cache (it may be overriden at runtime
+ # when the renderer starts up, depending on the actual device memory).
+ 'default_font_cache_limit': '(1*1024*1024)',
'skia_export_defines': [
'SK_BUILD_FOR_ANDROID',
- 'USE_CHROMIUM_SKIA',
],
}],
],
@@ -60,6 +61,7 @@
'includes': [
'../third_party/skia/gyp/core.gypi',
'../third_party/skia/gyp/effects.gypi',
+ '../third_party/skia/gyp/pdf.gypi',
],
'sources': [
@@ -76,33 +78,6 @@
'../third_party/skia/src/opts/opts_check_SSE2.cpp',
- '../third_party/skia/src/pdf/SkPDFCatalog.cpp',
- '../third_party/skia/src/pdf/SkPDFCatalog.h',
- '../third_party/skia/src/pdf/SkPDFDevice.cpp',
- '../third_party/skia/src/pdf/SkPDFDocument.cpp',
- '../third_party/skia/src/pdf/SkPDFFont.cpp',
- '../third_party/skia/src/pdf/SkPDFFont.h',
- '../third_party/skia/src/pdf/SkPDFFormXObject.cpp',
- '../third_party/skia/src/pdf/SkPDFFormXObject.h',
- '../third_party/skia/src/pdf/SkPDFGraphicState.cpp',
- '../third_party/skia/src/pdf/SkPDFGraphicState.h',
- '../third_party/skia/src/pdf/SkPDFImage.cpp',
- '../third_party/skia/src/pdf/SkPDFImage.h',
- '../third_party/skia/src/pdf/SkPDFImageStream.cpp',
- '../third_party/skia/src/pdf/SkPDFImageStream.h',
- '../third_party/skia/src/pdf/SkPDFPage.cpp',
- '../third_party/skia/src/pdf/SkPDFPage.h',
- '../third_party/skia/src/pdf/SkPDFResourceDict.cpp',
- '../third_party/skia/src/pdf/SkPDFResourceDict.h',
- '../third_party/skia/src/pdf/SkPDFShader.cpp',
- '../third_party/skia/src/pdf/SkPDFShader.h',
- '../third_party/skia/src/pdf/SkPDFStream.cpp',
- '../third_party/skia/src/pdf/SkPDFStream.h',
- '../third_party/skia/src/pdf/SkPDFTypes.cpp',
- '../third_party/skia/src/pdf/SkPDFTypes.h',
- '../third_party/skia/src/pdf/SkPDFUtils.cpp',
- '../third_party/skia/src/pdf/SkPDFUtils.h',
-
'../third_party/skia/src/ports/SkPurgeableMemoryBlock_none.cpp',
'../third_party/skia/src/ports/SkFontConfigInterface_android.cpp',
@@ -117,6 +92,8 @@
'../third_party/skia/src/ports/SkFontConfigParser_android.cpp',
'../third_party/skia/src/ports/SkFontHost_mac.cpp',
'../third_party/skia/src/ports/SkFontHost_win.cpp',
+ '../third_party/skia/src/ports/SkFontHost_win_dw.cpp',
+ '../third_party/skia/src/ports/SkFontMgr_default_gdi.cpp',
'../third_party/skia/src/ports/SkGlobalInitialization_chromium.cpp',
'../third_party/skia/src/ports/SkOSFile_posix.cpp',
'../third_party/skia/src/ports/SkOSFile_stdio.cpp',
@@ -146,6 +123,8 @@
'../third_party/skia/src/utils/SkBase64.h',
'../third_party/skia/src/utils/SkBitSet.cpp',
'../third_party/skia/src/utils/SkBitSet.h',
+ '../third_party/skia/src/utils/SkCanvasStack.cpp',
+ '../third_party/skia/src/utils/SkCanvasStateUtils.cpp',
'../third_party/skia/src/utils/SkDeferredCanvas.cpp',
'../third_party/skia/src/utils/SkMatrix44.cpp',
'../third_party/skia/src/utils/SkNullCanvas.cpp',
@@ -155,8 +134,11 @@
'../third_party/skia/src/utils/SkProxyCanvas.cpp',
'../third_party/skia/src/utils/SkRTConf.cpp',
'../third_party/skia/include/utils/SkRTConf.h',
- '../third_party/skia/include/pdf/SkPDFDevice.h',
- '../third_party/skia/include/pdf/SkPDFDocument.h',
+ '../third_party/skia/src/utils/win/SkDWriteFontFileStream.cpp',
+ '../third_party/skia/src/utils/win/SkDWriteFontFileStream.h',
+ '../third_party/skia/src/utils/win/SkDWriteGeometrySink.cpp',
+ '../third_party/skia/src/utils/win/SkDWriteGeometrySink.h',
+ '../third_party/skia/src/utils/win/SkHRESULT.cpp',
'../third_party/skia/include/ports/SkTypeface_win.h',
@@ -335,7 +317,6 @@
[ 'OS == "ios"', {
'defines': [
'SK_BUILD_FOR_IOS',
- 'SK_USE_MAC_CORE_TEXT',
],
'include_dirs': [
'../third_party/skia/include/utils/ios',
@@ -355,7 +336,7 @@
'sources/': [
['exclude', 'opts_check_SSE2\\.cpp$'],
],
-
+
# The main skia_opts target does not currently work on iOS because the
# target architecture on iOS is determined at compile time rather than
# gyp time (simulator builds are x86, device builds are arm). As a
@@ -371,7 +352,6 @@
[ 'OS == "mac"', {
'defines': [
'SK_BUILD_FOR_MAC',
- 'SK_USE_MAC_CORE_TEXT',
],
'direct_dependent_settings': {
'include_dirs': [
@@ -397,6 +377,24 @@
'../third_party/skia/src/ports/SkTime_Unix.cpp',
'../third_party/skia/src/ports/SkTLS_pthread.cpp',
],
+ 'include_dirs': [
+ '../third_party/skia/include/utils/win',
+ '../third_party/skia/src/utils/win',
+ ],
+ 'defines': [
+ 'SK_FONTHOST_USES_FONTMGR',
+ ],
+ },{ # not 'OS == "win"'
+ 'sources!': [
+ '../third_party/skia/src/ports/SkFontHost_win_dw.cpp',
+ '../third_party/skia/src/ports/SkFontMgr_default_gdi.cpp',
+
+ '../third_party/skia/src/utils/win/SkDWriteFontFileStream.cpp',
+ '../third_party/skia/src/utils/win/SkDWriteFontFileStream.h',
+ '../third_party/skia/src/utils/win/SkDWriteGeometrySink.cpp',
+ '../third_party/skia/src/utils/win/SkDWriteGeometrySink.h',
+ '../third_party/skia/src/utils/win/SkHRESULT.cpp',
+ ],
}],
# TODO(scottmg): http://crbug.com/177306
['clang==1', {
@@ -426,9 +424,6 @@
'defines': [
'<@(skia_export_defines)',
- # this flag can be removed entirely once this has baked for a while
- 'SK_ALLOW_OVER_32K_BITMAPS',
-
# skia uses static initializers to initialize the serialization logic
# of its "pictures" library. This is currently not used in chrome; if
# it ever gets used the processes that use it need to call
@@ -443,6 +438,7 @@
'SKIA_IGNORE_GPU_MIPMAPS',
+ # this flag forces Skia not to use typographic metrics with GDI.
'SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS',
'SK_DEFAULT_FONT_CACHE_LIMIT=<(default_font_cache_limit)',
diff --git a/chromium/skia/skia_library_opts.gyp b/chromium/skia/skia_library_opts.gyp
index c87b9821bf8..15263764741 100644
--- a/chromium/skia/skia_library_opts.gyp
+++ b/chromium/skia/skia_library_opts.gyp
@@ -101,12 +101,14 @@
}],
[ 'target_arch == "arm" and arm_version < 6', {
'sources': [
+ '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
'../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
'../third_party/skia/src/opts/SkUtils_opts_none.cpp',
],
}],
[ 'target_arch == "arm" and arm_version >= 6', {
'sources': [
+ '../third_party/skia/src/opts/SkBlitMask_opts_arm.cpp',
'../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
'../third_party/skia/src/opts/SkBlitRow_opts_arm.h',
'../third_party/skia/src/opts/opts_check_arm.cpp',
@@ -118,6 +120,7 @@
],
'sources': [
'../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
+ '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
'../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
'../third_party/skia/src/opts/SkUtils_opts_none.cpp',
],
@@ -178,6 +181,7 @@
],
'sources': [
'../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
+ '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
'../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
'../third_party/skia/src/opts/SkUtils_opts_none.cpp',
],
diff --git a/chromium/skia/skia_test_expectations.txt b/chromium/skia/skia_test_expectations.txt
index 83f6ac54e64..bfae6eecbc9 100644
--- a/chromium/skia/skia_test_expectations.txt
+++ b/chromium/skia/skia_test_expectations.txt
@@ -48,23 +48,24 @@
#
# START OVERRIDES HERE
-# Image scaling difference due to ongoing Skia image resizing changes
-crbug.com/263331 virtual/deferred/fast/images/webp-color-profile-lossy.html [ ImageOnlyFailure ]
+# The Skia roll to r11121 altered this layout test
+crbug.com/286312 virtual/gpu/fast/canvas/canvas-composite-transformclip.html [ ImageOnlyFailure ]
-# With Skia r10399 Skia's Windows text metrics have been improved
-crbug.com/265448 [ Win ] svg/batik/text/textEffect3.svg [ ImageOnlyFailure ]
-crbug.com/265448 [ Win ] svg/custom/use-referencing-nonexisting-symbol.svg [ ImageOnlyFailure ]
-crbug.com/265448 [ Win ] svg/transforms/animated-path-inside-transformed-html.xhtml [ ImageOnlyFailure ]
-crbug.com/265448 [ Win ] svg/transforms/text-with-pattern-inside-transformed-html.xhtml [ ImageOnlyFailure ]
-crbug.com/265448 [ Win ] svg/transforms/text-with-pattern-with-svg-transform.svg [ ImageOnlyFailure ]
+# Skia CL r11158 improved GPU-base gradient rendering (and changed three baseline images)
+crbug.com/288674 css3/filters/effect-reference-zoom-hw.html [ ImageOnlyFailure ]
+crbug.com/288674 virtual/gpu/fast/canvas/canvas-text-alignment.html [ ImageOnlyFailure ]
+crbug.com/288674 virtual/gpu/fast/canvas/fillrect_gradient.html [ ImageOnlyFailure ]
+# This image difference is related to the recent oval rendering changes
+crbug.com/288674 virtual/gpu/fast/canvas/canvas-composite.html [ ImageOnlyFailure ]
-# With skia r10444 some imperceptible differences on the edges of blurs were caused
-crbug.com/266315 fast/box-shadow/box-shadow-clipped-slices.html [ ImageOnlyFailure ]
-crbug.com/266315 fast/repaint/box-shadow-h.html [ ImageOnlyFailure ]
-crbug.com/266315 fast/repaint/box-shadow-v.html [ ImageOnlyFailure ]
-crbug.com/266315 fast/repaint/shadow-multiple-horizontal.html [ ImageOnlyFailure ]
-crbug.com/266315 fast/repaint/shadow-multiple-strict-horizontal.html [ ImageOnlyFailure ]
-crbug.com/266315 fast/repaint/shadow-multiple-strict-vertical.html [ ImageOnlyFailure ]
-crbug.com/266315 fast/repaint/shadow-multiple-vertical.html [ ImageOnlyFailure ]
+# Skia CL r11249 altered some of the parameters to the spot light filter
+crbug.com/292656 css3/filters/effect-reference-colorspace-hw.html [ ImageOnlyFailure ]
+crbug.com/292656 css3/filters/effect-reference-hw.html [ ImageOnlyFailure ]
+crbug.com/292656 css3/filters/effect-reference-subregion-hw.html [ ImageOnlyFailure ]
+
+# Skia r11365 slightly changed how the GPU draws lines
+crbug.com/295579 virtual/gpu/fast/canvas/canvas-text-baseline.html [ ImageOnlyFailure ]
+crbug.com/295579 virtual/gpu/fast/canvas/canvas-transforms-during-path.html [ ImageOnlyFailure ]
+crbug.com/295579 virtual/gpu/fast/canvas/quadraticCurveTo.xml [ ImageOnlyFailure ]
# END OVERRIDES HERE (this line ensures that the file is newline-terminated)