summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-21 19:42:42 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-21 19:42:42 +0000
commitd44b526f2a8c502feb4baf6bf32c7971e7102729 (patch)
treeb30d26f86cb214d3d1f5d56d2ab04fb4f2853076
parent3fca23f7fc46d3fe0016040d53065b3676011118 (diff)
downloadchromium_src-d44b526f2a8c502feb4baf6bf32c7971e7102729.zip
chromium_src-d44b526f2a8c502feb4baf6bf32c7971e7102729.tar.gz
chromium_src-d44b526f2a8c502feb4baf6bf32c7971e7102729.tar.bz2
Build SkGraphicsContext under Linux
Review URL: http://codereview.chromium.org/8019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3671 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/gfx/bitmap_platform_device_linux.h3
-rw-r--r--base/gfx/platform_device_linux.h4
-rw-r--r--webkit/SConscript.port1
-rw-r--r--webkit/port/platform/graphics/SkGraphicsContext.cpp41
4 files changed, 17 insertions, 32 deletions
diff --git a/base/gfx/bitmap_platform_device_linux.h b/base/gfx/bitmap_platform_device_linux.h
index f459d42..3059c2c 100644
--- a/base/gfx/bitmap_platform_device_linux.h
+++ b/base/gfx/bitmap_platform_device_linux.h
@@ -27,6 +27,9 @@ class BitmapPlatformDeviceLinux : public PlatformDeviceLinux {
// A stub copy constructor. Needs to be properly implemented.
BitmapPlatformDeviceLinux(const BitmapPlatformDeviceLinux& other);
+
+ // Bitmaps aren't vector graphics.
+ virtual bool IsVectorial() { return false; }
};
} // namespace gfx
diff --git a/base/gfx/platform_device_linux.h b/base/gfx/platform_device_linux.h
index 52fbfae..8be2e4a 100644
--- a/base/gfx/platform_device_linux.h
+++ b/base/gfx/platform_device_linux.h
@@ -11,6 +11,10 @@ namespace gfx {
// Blindly copying the mac hierarchy.
class PlatformDeviceLinux : public SkDevice {
+ public:
+ // Returns if the preferred rendering engine is vectorial or bitmap based.
+ virtual bool IsVectorial() = 0;
+
protected:
// Forwards |bitmap| to SkDevice's constructor.
PlatformDeviceLinux(const SkBitmap& bitmap);
diff --git a/webkit/SConscript.port b/webkit/SConscript.port
index 23fd77a..d048bdb 100644
--- a/webkit/SConscript.port
+++ b/webkit/SConscript.port
@@ -126,7 +126,6 @@ if env['PLATFORM'] == 'posix':
'$PORT_DIR/platform/chromium/WidgetChromium.cpp',
'$PORT_DIR/platform/graphics/FontCustomPlatformData.cpp',
'$PORT_DIR/platform/graphics/ImageSkia.cpp',
- '$PORT_DIR/platform/graphics/SkGraphicsContext.cpp',
]
for remove in remove_files:
input_files.remove(remove)
diff --git a/webkit/port/platform/graphics/SkGraphicsContext.cpp b/webkit/port/platform/graphics/SkGraphicsContext.cpp
index d89dbd0..afe5d34 100644
--- a/webkit/port/platform/graphics/SkGraphicsContext.cpp
+++ b/webkit/port/platform/graphics/SkGraphicsContext.cpp
@@ -28,21 +28,22 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "config.h"
+#include "build/build_config.h"
#include "SkGraphicsContext.h"
-#include <vssym32.h>
-
#include "base/gfx/image_operations.h"
-#include "base/gfx/native_theme.h"
-#include "base/gfx/platform_canvas_win.h"
+#include "base/gfx/platform_canvas.h"
#include "base/gfx/skia_utils.h"
#include "GraphicsContextPlatformPrivate.h"
#include "NativeImageSkia.h"
#include "SkBitmap.h"
-// These need to be moved
+#if defined(OS_WIN)
+#include <vssym32.h>
+#include "base/gfx/native_theme.h"
#include "ThemeData.h"
#include "UniscribeStateTextRun.h"
+#endif
#undef LOG
#include "SkiaUtils.h"
@@ -148,8 +149,8 @@ void DrawResampledBitmap(SkCanvas& canvas,
SkGraphicsContext::SkGraphicsContext(gfx::PlatformCanvas* canvas)
- : canvas_(canvas),
- paint_context_(NULL),
+ : paint_context_(NULL),
+ canvas_(canvas),
own_canvas_(false) {
}
@@ -158,6 +159,7 @@ SkGraphicsContext::~SkGraphicsContext() {
delete canvas_;
}
+#if defined(OS_WIN)
const gfx::NativeTheme* SkGraphicsContext::nativeTheme() {
return gfx::NativeTheme::instance();
}
@@ -278,36 +280,13 @@ bool SkGraphicsContext::paintText(FontHandle hfont,
canvas_->endPlatformPaint();
return success;
}
+#endif
void SkGraphicsContext::paintSkPaint(const SkRect& rect,
const SkPaint& paint) {
canvas_->drawRect(rect, paint);
}
-// Returns smallest multiple of two of the dest size that is more than a small
-// multiple larger than src_size.
-//
-// Used to determine the size that source should be high-quality upsampled to,
-// after which we use linear interpolation. Making sure that the linear
-// interpolation is a factor of two reduces artifacts, and doing the lowest
-// level of resampling
-static int GetResamplingThreshold(int src_size, int dest_size) {
- int lower_bound = src_size * 3 / 2; // Minimum size we'll resample to (1.5x).
- int cur = dest_size;
-
- // Find the largest multiple of two of the destination size less than our
- // threshold
- while (cur > lower_bound)
- cur /= 2;
-
- // We want the next size above that, or just the destination size if it's
- // smaller.
- cur *= 2;
- if (cur > dest_size)
- return dest_size;
- return cur;
-}
-
// static
SkGraphicsContext::ResamplingMode SkGraphicsContext::computeResamplingMode(
const NativeImageSkia& bitmap,