diff options
-rw-r--r-- | base/gfx/platform_canvas.h | 4 | ||||
-rw-r--r-- | webkit/port/platform/graphics/PlatformContextSkia.cpp | 2 | ||||
-rw-r--r-- | webkit/port/platform/graphics/PlatformContextSkia.h | 2 | ||||
-rw-r--r-- | webkit/port/platform/graphics/SkGraphicsContext.cpp | 4 | ||||
-rw-r--r-- | webkit/port/platform/graphics/SkGraphicsContext.h | 22 |
5 files changed, 24 insertions, 10 deletions
diff --git a/base/gfx/platform_canvas.h b/base/gfx/platform_canvas.h index 269027d..b4d978b 100644 --- a/base/gfx/platform_canvas.h +++ b/base/gfx/platform_canvas.h @@ -31,6 +31,9 @@ // that can be used by upper-level classes that just need to pass a reference // around. +#include "build/build_config.h" + +namespace gfx { #if defined(OS_WIN) class PlatformCanvasWin; typedef PlatformCanvasWin PlatformCanvas; @@ -38,3 +41,4 @@ typedef PlatformCanvasWin PlatformCanvas; class PlatformCanvasMac; typedef PlatformCanvasMac PlatformCanvas; #endif +}
\ No newline at end of file diff --git a/webkit/port/platform/graphics/PlatformContextSkia.cpp b/webkit/port/platform/graphics/PlatformContextSkia.cpp index c2586b3..4019578 100644 --- a/webkit/port/platform/graphics/PlatformContextSkia.cpp +++ b/webkit/port/platform/graphics/PlatformContextSkia.cpp @@ -31,7 +31,7 @@ #include "PlatformContextSkia.h" -PlatformContextSkia::PlatformContextSkia(gfx::PlatformCanvasWin* canvas) +PlatformContextSkia::PlatformContextSkia(gfx::PlatformCanvas* canvas) : SkGraphicsContext(canvas) { } diff --git a/webkit/port/platform/graphics/PlatformContextSkia.h b/webkit/port/platform/graphics/PlatformContextSkia.h index 6afde66..83e4e2c 100644 --- a/webkit/port/platform/graphics/PlatformContextSkia.h +++ b/webkit/port/platform/graphics/PlatformContextSkia.h @@ -47,7 +47,7 @@ class PlatformContextSkia : public SkGraphicsContext { friend class WebCore::GraphicsContextPlatformPrivate; public: // For printing, there shouldn't be any canvas. canvas can be NULL. - PlatformContextSkia(gfx::PlatformCanvasWin* canvas); + PlatformContextSkia(gfx::PlatformCanvas* canvas); ~PlatformContextSkia(); protected: diff --git a/webkit/port/platform/graphics/SkGraphicsContext.cpp b/webkit/port/platform/graphics/SkGraphicsContext.cpp index 0843840..51d7e51 100644 --- a/webkit/port/platform/graphics/SkGraphicsContext.cpp +++ b/webkit/port/platform/graphics/SkGraphicsContext.cpp @@ -146,7 +146,7 @@ void DrawResampledBitmap(SkCanvas& canvas, } // namespace -SkGraphicsContext::SkGraphicsContext(gfx::PlatformCanvasWin* canvas) +SkGraphicsContext::SkGraphicsContext(gfx::PlatformCanvas* canvas) : canvas_(canvas), paint_context_(NULL), own_canvas_(false) { @@ -425,7 +425,7 @@ const SkBitmap* SkGraphicsContext::bitmap() const return &canvas_->getDevice()->accessBitmap(false); } -gfx::PlatformCanvasWin* SkGraphicsContext::canvas() const +gfx::PlatformCanvas* SkGraphicsContext::canvas() const { return canvas_; } diff --git a/webkit/port/platform/graphics/SkGraphicsContext.h b/webkit/port/platform/graphics/SkGraphicsContext.h index 191dbf6..bbd3173 100644 --- a/webkit/port/platform/graphics/SkGraphicsContext.h +++ b/webkit/port/platform/graphics/SkGraphicsContext.h @@ -32,6 +32,8 @@ #include "SkPorterDuff.h" +#include "base/gfx/platform_canvas.h" + class NativeImageSkia; struct SkIRect; struct SkPoint; @@ -47,9 +49,15 @@ class UniscribeStateTextRun; namespace gfx { class NativeTheme; -class PlatformCanvasWin; } +#if defined(OS_WIN) +typedef HICON IconHandle; +typedef HFONT FontHandle; +#elif defined(OS_MACOSX) +typedef CGImageRef IconHandle; +typedef CTFontRef FontHandle; +#endif class SkGraphicsContext { public: @@ -67,13 +75,13 @@ class SkGraphicsContext { RESAMPLE_AWESOME, }; - SkGraphicsContext(gfx::PlatformCanvasWin* canvas); + SkGraphicsContext(gfx::PlatformCanvas* canvas); ~SkGraphicsContext(); // Gets the default theme. static const gfx::NativeTheme* nativeTheme(); - void paintIcon(HICON icon, const SkIRect& rect); + void paintIcon(IconHandle icon, const SkIRect& rect); void paintButton(const SkIRect& widgetRect, const ThemeData& themeData); void paintTextField(const SkIRect& widgetRect, @@ -88,11 +96,13 @@ class SkGraphicsContext { int from, int to, int ascent); - bool paintText(HFONT hfont, +#if defined(OS_WIN) + bool paintText(FontHandle hfont, int number_glyph, const WORD* glyphs, const int* advances, const SkPoint& origin); +#endif // TODO(maruel): I'm still unsure how I will serialize this call. void paintSkPaint(const SkRect& rect, const SkPaint& paint); @@ -130,7 +140,7 @@ class SkGraphicsContext { // Warning: This function is deprecated so the users are reminded that they // should use this layer of indirection instead of using the canvas directly. // This is to help with the eventual serialization. - gfx::PlatformCanvasWin* canvas() const; + gfx::PlatformCanvas* canvas() const; // Returns if the context is a printing context instead of a display context. // Bitmap shouldn't be resampled when printing to keep the best possible @@ -147,7 +157,7 @@ class SkGraphicsContext { SkPaintContext* paint_context_; // Can be NULL when serializing. - gfx::PlatformCanvasWin* canvas_; + gfx::PlatformCanvas* canvas_; // Signal that we own the canvas and must delete it on destruction. bool own_canvas_; |