summaryrefslogtreecommitdiffstats
path: root/skia/ext
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-29 18:32:44 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-29 18:32:44 +0000
commit50f4ee805127dd5b4e1b1065eda77389b7293a84 (patch)
treefb508f191e9acc1373ee1669093419d10b6e50f9 /skia/ext
parentff31667e93c2f61ff9f7d7b1ea9ddb0c6686505b (diff)
downloadchromium_src-50f4ee805127dd5b4e1b1065eda77389b7293a84.zip
chromium_src-50f4ee805127dd5b4e1b1065eda77389b7293a84.tar.gz
chromium_src-50f4ee805127dd5b4e1b1065eda77389b7293a84.tar.bz2
Update Chrome's Skia Device to use the new device factory interface (http://code.google.com/p/skia/source/detail?r=1180).
Remove valgrind suppression. BUG=80836 TEST=NONE Review URL: http://codereview.chromium.org/6883255 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext')
-rw-r--r--skia/ext/bitmap_platform_device_linux.cc8
-rw-r--r--skia/ext/bitmap_platform_device_linux.h5
-rw-r--r--skia/ext/bitmap_platform_device_mac.cc8
-rw-r--r--skia/ext/bitmap_platform_device_mac.h5
-rw-r--r--skia/ext/bitmap_platform_device_win.cc4
-rw-r--r--skia/ext/bitmap_platform_device_win.h7
-rw-r--r--skia/ext/platform_canvas.cc4
-rw-r--r--skia/ext/platform_canvas_linux.cc8
-rw-r--r--skia/ext/platform_canvas_mac.cc12
-rw-r--r--skia/ext/platform_canvas_win.cc8
-rw-r--r--skia/ext/vector_platform_device_cairo_linux.cc2
-rw-r--r--skia/ext/vector_platform_device_cairo_linux.h6
-rw-r--r--skia/ext/vector_platform_device_emf_win.cc4
-rw-r--r--skia/ext/vector_platform_device_emf_win.h8
-rw-r--r--skia/ext/vector_platform_device_skia.cc8
-rw-r--r--skia/ext/vector_platform_device_skia.h5
16 files changed, 58 insertions, 44 deletions
diff --git a/skia/ext/bitmap_platform_device_linux.cc b/skia/ext/bitmap_platform_device_linux.cc
index e4653fc..5372c55 100644
--- a/skia/ext/bitmap_platform_device_linux.cc
+++ b/skia/ext/bitmap_platform_device_linux.cc
@@ -143,14 +143,14 @@ BitmapPlatformDevice::BitmapPlatformDevice(
BitmapPlatformDevice::~BitmapPlatformDevice() {
}
-SkDeviceFactory* BitmapPlatformDevice::getDeviceFactory() {
- return SkNEW(BitmapPlatformDeviceFactory);
-}
-
bool BitmapPlatformDevice::IsVectorial() {
return false;
}
+SkDeviceFactory* BitmapPlatformDevice::onNewDeviceFactory() {
+ return SkNEW(BitmapPlatformDeviceFactory);
+}
+
cairo_t* BitmapPlatformDevice::BeginPlatformPaint() {
data_->LoadConfig();
cairo_t* cairo = data_->bitmap_context();
diff --git a/skia/ext/bitmap_platform_device_linux.h b/skia/ext/bitmap_platform_device_linux.h
index e01acd6..37695f1 100644
--- a/skia/ext/bitmap_platform_device_linux.h
+++ b/skia/ext/bitmap_platform_device_linux.h
@@ -91,7 +91,6 @@ class BitmapPlatformDevice : public PlatformDevice {
virtual void makeOpaque(int x, int y, int width, int height);
// Overridden from SkDevice:
- virtual SkDeviceFactory* getDeviceFactory();
virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region,
const SkClipStack&);
@@ -99,6 +98,10 @@ class BitmapPlatformDevice : public PlatformDevice {
virtual bool IsVectorial();
virtual cairo_t* BeginPlatformPaint();
+ protected:
+ // Override SkDevice.
+ virtual SkDeviceFactory* onNewDeviceFactory();
+
private:
static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
cairo_surface_t* surface);
diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc
index 1713192..543fc38 100644
--- a/skia/ext/bitmap_platform_device_mac.cc
+++ b/skia/ext/bitmap_platform_device_mac.cc
@@ -208,10 +208,6 @@ BitmapPlatformDevice::~BitmapPlatformDevice() {
data_->unref();
}
-SkDeviceFactory* BitmapPlatformDevice::getDeviceFactory() {
- return SkNEW(BitmapPlatformDeviceFactory);
-}
-
BitmapPlatformDevice& BitmapPlatformDevice::operator=(
const BitmapPlatformDevice& other) {
data_ = other.data_;
@@ -277,4 +273,8 @@ void BitmapPlatformDevice::onAccessBitmap(SkBitmap*) {
// Not needed in CoreGraphics
}
+SkDeviceFactory* BitmapPlatformDevice::onNewDeviceFactory() {
+ return SkNEW(BitmapPlatformDeviceFactory);
+}
+
} // namespace skia
diff --git a/skia/ext/bitmap_platform_device_mac.h b/skia/ext/bitmap_platform_device_mac.h
index 06be3f6..f126adc 100644
--- a/skia/ext/bitmap_platform_device_mac.h
+++ b/skia/ext/bitmap_platform_device_mac.h
@@ -58,8 +58,6 @@ class BitmapPlatformDevice : public PlatformDevice {
BitmapPlatformDevice(const BitmapPlatformDevice& other);
virtual ~BitmapPlatformDevice();
- virtual SkDeviceFactory* getDeviceFactory();
-
// See warning for copy constructor above.
BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other);
@@ -90,6 +88,9 @@ class BitmapPlatformDevice : public PlatformDevice {
// starts accessing pixel data.
virtual void onAccessBitmap(SkBitmap*);
+ // Override SkDevice.
+ virtual SkDeviceFactory* onNewDeviceFactory();
+
// Data associated with this device, guaranteed non-null. We hold a reference
// to this object.
BitmapPlatformDeviceData* data_;
diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc
index 618f3db..5c0bd61 100644
--- a/skia/ext/bitmap_platform_device_win.cc
+++ b/skia/ext/bitmap_platform_device_win.cc
@@ -281,5 +281,9 @@ void BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) {
GdiFlush();
}
+SkDeviceFactory* BitmapPlatformDevice::onNewDeviceFactory() {
+ return SkNEW(BitmapPlatformDeviceFactory);
+}
+
} // namespace skia
diff --git a/skia/ext/bitmap_platform_device_win.h b/skia/ext/bitmap_platform_device_win.h
index 76e45f6..485c532 100644
--- a/skia/ext/bitmap_platform_device_win.h
+++ b/skia/ext/bitmap_platform_device_win.h
@@ -69,10 +69,6 @@ class SK_API BitmapPlatformDevice : public PlatformDevice {
// See warning for copy constructor above.
BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other);
- virtual SkDeviceFactory* getDeviceFactory() {
- return SkNEW(BitmapPlatformDeviceFactory);
- }
-
// Retrieves the bitmap DC, which is the memory DC for our bitmap data. The
// bitmap DC is lazy created.
virtual PlatformSurface BeginPlatformPaint();
@@ -96,6 +92,9 @@ class SK_API BitmapPlatformDevice : public PlatformDevice {
// starts accessing pixel data.
virtual void onAccessBitmap(SkBitmap* bitmap);
+ // Override SkDevice.
+ virtual SkDeviceFactory* onNewDeviceFactory();
+
private:
// Reference counted data that can be shared between multiple devices. This
// allows copy constructors and operator= for devices to work properly. The
diff --git a/skia/ext/platform_canvas.cc b/skia/ext/platform_canvas.cc
index dfb40f7..c48cce4 100644
--- a/skia/ext/platform_canvas.cc
+++ b/skia/ext/platform_canvas.cc
@@ -17,8 +17,8 @@ skia::PlatformDevice* GetTopPlatformDevice(const SkCanvas* canvas) {
namespace skia {
-PlatformCanvas::PlatformCanvas()
- : SkCanvas(SkNEW(BitmapPlatformDeviceFactory)) {
+PlatformCanvas::PlatformCanvas() {
+ setDeviceFactory(SkNEW(BitmapPlatformDeviceFactory))->unref();
}
PlatformCanvas::PlatformCanvas(SkDeviceFactory* factory) : SkCanvas(factory) {
diff --git a/skia/ext/platform_canvas_linux.cc b/skia/ext/platform_canvas_linux.cc
index 1de283c..c059544 100644
--- a/skia/ext/platform_canvas_linux.cc
+++ b/skia/ext/platform_canvas_linux.cc
@@ -12,15 +12,15 @@
namespace skia {
-PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque)
- : SkCanvas(SkNEW(BitmapPlatformDeviceFactory)) {
+PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) {
+ setDeviceFactory(SkNEW(BitmapPlatformDeviceFactory))->unref();
if (!initialize(width, height, is_opaque))
SK_CRASH();
}
PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque,
- uint8_t* data)
- : SkCanvas(SkNEW(BitmapPlatformDeviceFactory)) {
+ uint8_t* data) {
+ setDeviceFactory(SkNEW(BitmapPlatformDeviceFactory))->unref();
if (!initialize(width, height, is_opaque, data))
SK_CRASH();
}
diff --git a/skia/ext/platform_canvas_mac.cc b/skia/ext/platform_canvas_mac.cc
index 64603a8..bf6843f 100644
--- a/skia/ext/platform_canvas_mac.cc
+++ b/skia/ext/platform_canvas_mac.cc
@@ -9,24 +9,24 @@
namespace skia {
-PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque)
- : SkCanvas(SkNEW(BitmapPlatformDeviceFactory)) {
+PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) {
+ setDeviceFactory(SkNEW(BitmapPlatformDeviceFactory))->unref();
initialize(width, height, is_opaque);
}
PlatformCanvas::PlatformCanvas(int width,
int height,
bool is_opaque,
- CGContextRef context)
- : SkCanvas(SkNEW(BitmapPlatformDeviceFactory)) {
+ CGContextRef context) {
+ setDeviceFactory(SkNEW(BitmapPlatformDeviceFactory))->unref();
initialize(context, width, height, is_opaque);
}
PlatformCanvas::PlatformCanvas(int width,
int height,
bool is_opaque,
- uint8_t* data)
- : SkCanvas(SkNEW(BitmapPlatformDeviceFactory)) {
+ uint8_t* data) {
+ setDeviceFactory(SkNEW(BitmapPlatformDeviceFactory))->unref();
initialize(width, height, is_opaque, data);
}
diff --git a/skia/ext/platform_canvas_win.cc b/skia/ext/platform_canvas_win.cc
index 2283b19..a6381ed 100644
--- a/skia/ext/platform_canvas_win.cc
+++ b/skia/ext/platform_canvas_win.cc
@@ -76,8 +76,8 @@ void CrashIfInvalidSection(HANDLE shared_section) {
// Restore the optimization options.
#pragma optimize("", on)
-PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque)
- : SkCanvas(SkNEW(BitmapPlatformDeviceFactory)) {
+PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) {
+ setDeviceFactory(SkNEW(BitmapPlatformDeviceFactory))->unref();
bool initialized = initialize(width, height, is_opaque, NULL);
if (!initialized)
CrashForBitmapAllocationFailure(width, height);
@@ -86,8 +86,8 @@ PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque)
PlatformCanvas::PlatformCanvas(int width,
int height,
bool is_opaque,
- HANDLE shared_section)
- : SkCanvas(SkNEW(BitmapPlatformDeviceFactory)) {
+ HANDLE shared_section) {
+ setDeviceFactory(SkNEW(BitmapPlatformDeviceFactory))->unref();
bool initialized = initialize(width, height, is_opaque, shared_section);
if (!initialized) {
CrashIfInvalidSection(shared_section);
diff --git a/skia/ext/vector_platform_device_cairo_linux.cc b/skia/ext/vector_platform_device_cairo_linux.cc
index defd904..10089b4 100644
--- a/skia/ext/vector_platform_device_cairo_linux.cc
+++ b/skia/ext/vector_platform_device_cairo_linux.cc
@@ -129,7 +129,7 @@ VectorPlatformDeviceCairo::~VectorPlatformDeviceCairo() {
cairo_destroy(context_);
}
-SkDeviceFactory* VectorPlatformDeviceCairo::getDeviceFactory() {
+SkDeviceFactory* VectorPlatformDeviceCairo::onNewDeviceFactory() {
return SkNEW(VectorPlatformDeviceCairoFactory);
}
diff --git a/skia/ext/vector_platform_device_cairo_linux.h b/skia/ext/vector_platform_device_cairo_linux.h
index 84dd734..da7fbe1 100644
--- a/skia/ext/vector_platform_device_cairo_linux.h
+++ b/skia/ext/vector_platform_device_cairo_linux.h
@@ -43,9 +43,6 @@ class SK_API VectorPlatformDeviceCairo : public PlatformDevice {
// this class.
static void ClearFontCache();
- // Overridden from SkDevice (through PlatformDevice):
- virtual SkDeviceFactory* getDeviceFactory();
-
// Overridden from PlatformDevice:
virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) OVERRIDE;
virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
@@ -89,6 +86,9 @@ class SK_API VectorPlatformDeviceCairo : public PlatformDevice {
explicit VectorPlatformDeviceCairo(PlatformSurface context,
const SkBitmap& bitmap);
+ // Override from SkDevice (through PlatformDevice).
+ virtual SkDeviceFactory* onNewDeviceFactory();
+
private:
// Apply paint's color in the context.
void ApplyPaintColor(const SkPaint& paint);
diff --git a/skia/ext/vector_platform_device_emf_win.cc b/skia/ext/vector_platform_device_emf_win.cc
index 621ba32..d13ee4d 100644
--- a/skia/ext/vector_platform_device_emf_win.cc
+++ b/skia/ext/vector_platform_device_emf_win.cc
@@ -115,6 +115,10 @@ VectorPlatformDeviceEmf::~VectorPlatformDeviceEmf() {
SkASSERT(previous_pen_ == NULL);
}
+SkDeviceFactory* VectorPlatformDeviceEmf::onNewDeviceFactory() {
+ return SkNEW(VectorPlatformDeviceEmfFactory);
+}
+
HDC VectorPlatformDeviceEmf::BeginPlatformPaint() {
return hdc_;
}
diff --git a/skia/ext/vector_platform_device_emf_win.h b/skia/ext/vector_platform_device_emf_win.h
index 9091792a..4662475 100644
--- a/skia/ext/vector_platform_device_emf_win.h
+++ b/skia/ext/vector_platform_device_emf_win.h
@@ -35,10 +35,6 @@ class VectorPlatformDeviceEmf : public PlatformDevice {
VectorPlatformDeviceEmf(HDC dc, const SkBitmap& bitmap);
virtual ~VectorPlatformDeviceEmf();
- virtual SkDeviceFactory* getDeviceFactory() {
- return SkNEW(VectorPlatformDeviceEmfFactory);
- }
-
virtual PlatformSurface BeginPlatformPaint();
virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) OVERRIDE;
@@ -83,6 +79,10 @@ class VectorPlatformDeviceEmf : public PlatformDevice {
void LoadClipRegion();
bool alpha_blend_used() const { return alpha_blend_used_; }
+ protected:
+ // Override from SkDevice (through PlatformDevice).
+ virtual SkDeviceFactory* onNewDeviceFactory();
+
private:
// Applies the SkPaint's painting properties in the current GDI context, if
// possible. If GDI can't support all paint's properties, returns false. It
diff --git a/skia/ext/vector_platform_device_skia.cc b/skia/ext/vector_platform_device_skia.cc
index 90335ca..ba9a312 100644
--- a/skia/ext/vector_platform_device_skia.cc
+++ b/skia/ext/vector_platform_device_skia.cc
@@ -91,10 +91,6 @@ void VectorPlatformDeviceSkia::EndPlatformPaint() {
raster_surface_ = NULL;
}
-SkDeviceFactory* VectorPlatformDeviceSkia::getDeviceFactory() {
- return SkNEW(VectorPlatformDeviceSkiaFactory);
-}
-
uint32_t VectorPlatformDeviceSkia::getDeviceCapabilities() {
return kVector_Capability;
}
@@ -226,4 +222,8 @@ void VectorPlatformDeviceSkia::drawToHDC(HDC dc,
}
#endif
+SkDeviceFactory* VectorPlatformDeviceSkia::onNewDeviceFactory() {
+ return SkNEW(VectorPlatformDeviceSkiaFactory);
+}
+
} // namespace skia
diff --git a/skia/ext/vector_platform_device_skia.h b/skia/ext/vector_platform_device_skia.h
index f518f54..dad129d 100644
--- a/skia/ext/vector_platform_device_skia.h
+++ b/skia/ext/vector_platform_device_skia.h
@@ -46,7 +46,6 @@ class VectorPlatformDeviceSkia : public PlatformDevice {
virtual void EndPlatformPaint();
// SkDevice methods.
- virtual SkDeviceFactory* getDeviceFactory();
virtual uint32_t getDeviceCapabilities();
virtual int width() const;
@@ -88,6 +87,10 @@ class VectorPlatformDeviceSkia : public PlatformDevice {
virtual void drawToHDC(HDC dc, int x, int y, const RECT* src_rect);
#endif
+ protected:
+ // Override from SkDevice (through PlatformDevice).
+ virtual SkDeviceFactory* onNewDeviceFactory();
+
private:
SkRefPtr<SkPDFDevice> pdf_device_;
SkRefPtr<BitmapPlatformDevice> raster_surface_;