summaryrefslogtreecommitdiffstats
path: root/base/gfx
diff options
context:
space:
mode:
authorawalker@google.com <awalker@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-09 20:38:55 +0000
committerawalker@google.com <awalker@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-09 20:38:55 +0000
commitab52947d4390b1b59aae47f5f6c16b7d537030fd (patch)
tree3aa8a55fa87f8442a5bd8c3cafa4883ac1797c28 /base/gfx
parentf9ad22f0e3faea2c7a1fb9853bbf3fb768637be0 (diff)
downloadchromium_src-ab52947d4390b1b59aae47f5f6c16b7d537030fd.zip
chromium_src-ab52947d4390b1b59aae47f5f6c16b7d537030fd.tar.gz
chromium_src-ab52947d4390b1b59aae47f5f6c16b7d537030fd.tar.bz2
Refactor the platform canvas unit test a bit so that it can be run on
multiple platforms. Also adjusts platfom_canvas.h and platform_device.h so that some upper layers can include them instead of the windows versions. Change was originally http://codereview.chromium.org/1616, which was created in the wrong source tree. Applying approval from that issue. Review URL: http://codereview.chromium.org/1853 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1926 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/gfx')
-rw-r--r--base/gfx/SConscript2
-rw-r--r--base/gfx/bitmap_platform_device.h13
-rwxr-xr-xbase/gfx/bitmap_platform_device_mac.h3
-rw-r--r--base/gfx/platform_canvas.h18
-rwxr-xr-xbase/gfx/platform_canvas_mac.cc5
-rw-r--r--base/gfx/platform_canvas_unittest.c (renamed from base/gfx/platform_canvas_unittest_win.cc)0
-rw-r--r--base/gfx/platform_device.h15
-rwxr-xr-xbase/gfx/platform_device_mac.h6
8 files changed, 46 insertions, 16 deletions
diff --git a/base/gfx/SConscript b/base/gfx/SConscript
index b9e0d4a..57e61be 100644
--- a/base/gfx/SConscript
+++ b/base/gfx/SConscript
@@ -62,7 +62,7 @@ if env['PLATFORM'] == 'win32':
if env['PLATFORM'] == 'win32':
input_files.extend([
- 'bitmap_platform_device_win.cc',
+ 'bitmap_platform_device.cc',
'platform_canvas_win.cc',
'platform_device_win.cc',
])
diff --git a/base/gfx/bitmap_platform_device.h b/base/gfx/bitmap_platform_device.h
index 83b74df..1efa65c 100644
--- a/base/gfx/bitmap_platform_device.h
+++ b/base/gfx/bitmap_platform_device.h
@@ -6,17 +6,22 @@
// that can be used by upper-level classes that just need to pass a reference
// around.
+#if defined(OS_WIN)
+#include "base/gfx/bitmap_platform_device_win.h"
+#elif defined(OS_MACOSX)
+#include "base/gfx/bitmap_platform_device_mac.h"
+#elif defined(OS_LINUX)
+#include "base/gfx/bitmap_platform_device_linux.h"
+#endif
+
namespace gfx {
#if defined(OS_WIN)
-class BitmapPlatformDeviceWin;
typedef BitmapPlatformDeviceWin BitmapPlatformDevice;
#elif defined(OS_MACOSX)
-class BitmapPlatformDeviceMac;
typedef BitmapPlatformDeviceMac BitmapPlatformDevice;
#elif defined(OS_LINUX)
-class BitmapPlatformDeviceLinux;
typedef BitmapPlatformDeviceLinux BitmapPlatformDevice;
#endif
-} // namespace gfx
+}
diff --git a/base/gfx/bitmap_platform_device_mac.h b/base/gfx/bitmap_platform_device_mac.h
index 11e1133..a22483e 100755
--- a/base/gfx/bitmap_platform_device_mac.h
+++ b/base/gfx/bitmap_platform_device_mac.h
@@ -65,7 +65,8 @@ class BitmapPlatformDeviceMac : public PlatformDeviceMac {
virtual void DrawToContext(CGContextRef context, int x, int y,
const CGRect* src_rect);
virtual bool IsVectorial() { return false; }
-
+ virtual void fixupAlphaBeforeCompositing() { };
+
// Returns the color value at the specified location. This does not
// consider any transforms that may be set on the device.
SkColor GetColorAt(int x, int y);
diff --git a/base/gfx/platform_canvas.h b/base/gfx/platform_canvas.h
index d7433cd..d7442cc 100644
--- a/base/gfx/platform_canvas.h
+++ b/base/gfx/platform_canvas.h
@@ -8,17 +8,25 @@
#include "build/build_config.h"
+#if defined(OS_WIN)
+#include "base/gfx/platform_canvas_win.h"
namespace gfx {
-#if defined(OS_WIN)
-class PlatformCanvasWin;
typedef PlatformCanvasWin PlatformCanvas;
+
+} // namespace gfx
#elif defined(OS_MACOSX)
-class PlatformCanvasMac;
+#include "base/gfx/platform_canvas_mac.h"
+namespace gfx {
+
typedef PlatformCanvasMac PlatformCanvas;
+
+} // namespace gfx
#elif defined(OS_LINUX)
-class PlatformCanvasLinux;
+#include "base/gfx/platform_canvas_linux.h"
+namespace gfx {
+
typedef PlatformCanvasLinux PlatformCanvas;
-#endif
} // namespace gfx
+#endif
diff --git a/base/gfx/platform_canvas_mac.cc b/base/gfx/platform_canvas_mac.cc
index afd5203..f8f0970 100755
--- a/base/gfx/platform_canvas_mac.cc
+++ b/base/gfx/platform_canvas_mac.cc
@@ -141,5 +141,10 @@ SkDevice* PlatformCanvasMac::createPlatformDevice(int width,
return device;
}
+SkDevice* PlatformCanvasMac::setBitmapDevice(const SkBitmap&) {
+ NOTREACHED();
+ return NULL;
+}
+
} // namespace gfx
diff --git a/base/gfx/platform_canvas_unittest_win.cc b/base/gfx/platform_canvas_unittest.c
index a9cf2ae..a9cf2ae 100644
--- a/base/gfx/platform_canvas_unittest_win.cc
+++ b/base/gfx/platform_canvas_unittest.c
diff --git a/base/gfx/platform_device.h b/base/gfx/platform_device.h
index 796eec8..f1c890c 100644
--- a/base/gfx/platform_device.h
+++ b/base/gfx/platform_device.h
@@ -6,17 +6,22 @@
// that can be used by upper-level classes that just need to pass a reference
// around.
-namespace gfx {
+#if defined(OS_WIN)
+#include "base/gfx/platform_device_win.h"
+#elif defined(OS_MACOSX)
+#include "base/gfx/platform_device_mac.h"
+#elif defined(OS_LINUX)
+#include "base/gfx/platform_device_linux.h"
+#endif
+namespace gfx {
+
#if defined(OS_WIN)
-class PlatformDeviceWin;
typedef PlatformDeviceWin PlatformDevice;
#elif defined(OS_MACOSX)
-class PlatformDeviceMac;
typedef PlatformDeviceMac PlatformDevice;
#elif defined(OS_LINUX)
-class PlatformDeviceLinux;
typedef PlatformDeviceLinux PlatformDevice;
#endif
-
+
} // namespace gfx
diff --git a/base/gfx/platform_device_mac.h b/base/gfx/platform_device_mac.h
index 8cd2251..69eac95 100755
--- a/base/gfx/platform_device_mac.h
+++ b/base/gfx/platform_device_mac.h
@@ -59,6 +59,12 @@ class PlatformDeviceMac : public SkDevice {
// Returns if the preferred rendering engine is vectorial or bitmap based.
virtual bool IsVectorial() = 0;
+ // On platforms where the native rendering API does not support rendering
+ // into bitmaps with a premultiplied alpha channel, this call is responsible
+ // for doing any fixup necessary. It is not used on the Mac, since
+ // CoreGraphics can handle premultiplied alpha just fine.
+ virtual void fixupAlphaBeforeCompositing() = 0;
+
// Initializes the default settings and colors in a device context.
static void InitializeCGContext(CGContextRef context);