summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authorrobertphillips@google.com <robertphillips@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-26 18:37:29 +0000
committerrobertphillips@google.com <robertphillips@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-26 18:37:29 +0000
commit598e4f866fb1540d4d5e4351694bb3c9b0a20a1b (patch)
treedf1a98aa62ccff7ffacacfa4c961d2ee74e6bf2f /skia
parent93773d08322990032231aa26c4eba4f02014de99 (diff)
downloadchromium_src-598e4f866fb1540d4d5e4351694bb3c9b0a20a1b.zip
chromium_src-598e4f866fb1540d4d5e4351694bb3c9b0a20a1b.tar.gz
chromium_src-598e4f866fb1540d4d5e4351694bb3c9b0a20a1b.tar.bz2
Skia is going to Split the SkDevice class into SkBaseDevice and SkBitmapDevice. Right now Skia has typedefs redirecting SkBaseDevice and SkBitmapDevice to SkDevice. This CL begins the Chromium-side renaming process in preparation for the real change (https://codereview.chromium.org/22978012/)
BUG=278148 Review URL: https://chromiumcodereview.appspot.com/22796028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219568 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r--skia/ext/analysis_canvas.cc2
-rw-r--r--skia/ext/analysis_canvas.h13
-rw-r--r--skia/ext/benchmarking_canvas.cc6
-rw-r--r--skia/ext/bitmap_platform_device_android.cc6
-rw-r--r--skia/ext/bitmap_platform_device_android.h10
-rw-r--r--skia/ext/bitmap_platform_device_linux.cc8
-rw-r--r--skia/ext/bitmap_platform_device_linux.h10
-rw-r--r--skia/ext/bitmap_platform_device_mac.cc15
-rw-r--r--skia/ext/bitmap_platform_device_mac.h12
-rw-r--r--skia/ext/bitmap_platform_device_win.cc8
-rw-r--r--skia/ext/bitmap_platform_device_win.h12
-rw-r--r--skia/ext/lazy_pixel_ref_utils.cc10
-rw-r--r--skia/ext/platform_canvas.cc4
-rw-r--r--skia/ext/platform_canvas.h6
-rw-r--r--skia/ext/platform_canvas_unittest.cc4
-rw-r--r--skia/ext/platform_device.cc6
-rw-r--r--skia/ext/platform_device.h38
-rw-r--r--skia/ext/platform_device_mac.cc2
-rw-r--r--skia/ext/skia_utils_mac.mm4
-rw-r--r--skia/ext/vector_canvas.cc6
-rw-r--r--skia/ext/vector_canvas.h5
-rw-r--r--skia/ext/vector_platform_device_emf_win.cc14
-rw-r--r--skia/ext/vector_platform_device_emf_win.h20
23 files changed, 115 insertions, 106 deletions
diff --git a/skia/ext/analysis_canvas.cc b/skia/ext/analysis_canvas.cc
index d710fb6..9db42f1 100644
--- a/skia/ext/analysis_canvas.cc
+++ b/skia/ext/analysis_canvas.cc
@@ -283,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/skia/ext/analysis_canvas.h b/skia/ext/analysis_canvas.h
index b257b9f..78d72ff 100644
--- a/skia/ext/analysis_canvas.h
+++ b/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,
@@ -143,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/skia/ext/benchmarking_canvas.cc b/skia/ext/benchmarking_canvas.cc
index fbd2eb1..557827f 100644
--- a/skia/ext/benchmarking_canvas.cc
+++ b/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());
diff --git a/skia/ext/bitmap_platform_device_android.cc b/skia/ext/bitmap_platform_device_android.cc
index 8a29586..32f447f 100644
--- a/skia/ext/bitmap_platform_device_android.cc
+++ b/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/skia/ext/bitmap_platform_device_android.h b/skia/ext/bitmap_platform_device_android.h
index b5755cb..4e1735f 100644
--- a/skia/ext/bitmap_platform_device_android.h
+++ b/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/skia/ext/bitmap_platform_device_linux.cc b/skia/ext/bitmap_platform_device_linux.cc
index c9a0214..af26806 100644
--- a/skia/ext/bitmap_platform_device_linux.cc
+++ b/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/skia/ext/bitmap_platform_device_linux.h b/skia/ext/bitmap_platform_device_linux.h
index e1f9a75c..048092e0 100644
--- a/skia/ext/bitmap_platform_device_linux.h
+++ b/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/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc
index c09f8be..5ba7ea6 100644
--- a/skia/ext/bitmap_platform_device_mac.cc
+++ b/skia/ext/bitmap_platform_device_mac.cc
@@ -195,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);
}
@@ -253,12 +253,13 @@ const SkBitmap& BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) {
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;
}
@@ -266,14 +267,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/skia/ext/bitmap_platform_device_mac.h b/skia/ext/bitmap_platform_device_mac.h
index a1c5894..d2d6fae 100644
--- a/skia/ext/bitmap_platform_device_mac.h
+++ b/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;
@@ -69,13 +69,13 @@ class SK_API BitmapPlatformDevice : public SkDevice, public PlatformDevice {
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
+ // directly by Skia. Overridden from SkBaseDevice, 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/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc
index 201866a..8da09d1 100644
--- a/skia/ext/bitmap_platform_device_win.cc
+++ b/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);
@@ -301,7 +301,7 @@ const SkBitmap& BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) {
return *bitmap;
}
-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/skia/ext/bitmap_platform_device_win.h b/skia/ext/bitmap_platform_device_win.h
index c896c0a..fa313f6 100644
--- a/skia/ext/bitmap_platform_device_win.h
+++ b/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 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/skia/ext/lazy_pixel_ref_utils.cc b/skia/ext/lazy_pixel_ref_utils.cc
index f0caef2..09f44a5 100644
--- a/skia/ext/lazy_pixel_ref_utils.cc
+++ b/skia/ext/lazy_pixel_ref_utils.cc
@@ -5,9 +5,9 @@
#include "skia/ext/lazy_pixel_ref_utils.h"
#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 +44,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,
@@ -315,7 +315,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 {}
@@ -349,7 +349,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/skia/ext/platform_canvas.cc b/skia/ext/platform_canvas.cc
index 6a25481..f0d1717 100644
--- a/skia/ext/platform_canvas.cc
+++ b/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/skia/ext/platform_canvas.h b/skia/ext/platform_canvas.h
index 9e2bc82..85ad85e 100644
--- a/skia/ext/platform_canvas.h
+++ b/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/skia/ext/platform_canvas_unittest.cc b/skia/ext/platform_canvas_unittest.cc
index 7595bca..d0d83dd 100644
--- a/skia/ext/platform_canvas_unittest.cc
+++ b/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/skia/ext/platform_device.cc b/skia/ext/platform_device.cc
index c7f1565..ae720df 100644
--- a/skia/ext/platform_device.cc
+++ b/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/skia/ext/platform_device.h b/skia/ext/platform_device.h
index 4ac3aee..d46b5d4 100644
--- a/skia/ext/platform_device.h
+++ b/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/skia/ext/platform_device_mac.cc b/skia/ext/platform_device_mac.cc
index 6ff017d..f66372b 100644
--- a/skia/ext/platform_device_mac.cc
+++ b/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/skia/ext/skia_utils_mac.mm b/skia/ext/skia_utils_mac.mm
index 213bb00..50217d0 100644
--- a/skia/ext/skia_utils_mac.mm
+++ b/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/skia/ext/vector_canvas.cc b/skia/ext/vector_canvas.cc
index 9de6b3d..13025eb 100644
--- a/skia/ext/vector_canvas.cc
+++ b/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/skia/ext/vector_canvas.h b/skia/ext/vector_canvas.h
index e7a67fc..66ef216 100644
--- a/skia/ext/vector_canvas.h
+++ b/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/skia/ext/vector_platform_device_emf_win.cc b/skia/ext/vector_platform_device_emf_win.cc
index 16d0844..fe1ba29 100644
--- a/skia/ext/vector_platform_device_emf_win.cc
+++ b/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,
@@ -586,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) {
@@ -693,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/skia/ext/vector_platform_device_emf_win.h b/skia/ext/vector_platform_device_emf_win.h
index 9baee32..61ea441 100644
--- a/skia/ext/vector_platform_device_emf_win.h
+++ b/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,
@@ -67,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,
@@ -76,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