diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-21 19:42:42 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-21 19:42:42 +0000 |
commit | d44b526f2a8c502feb4baf6bf32c7971e7102729 (patch) | |
tree | b30d26f86cb214d3d1f5d56d2ab04fb4f2853076 /webkit/port | |
parent | 3fca23f7fc46d3fe0016040d53065b3676011118 (diff) | |
download | chromium_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
Diffstat (limited to 'webkit/port')
-rw-r--r-- | webkit/port/platform/graphics/SkGraphicsContext.cpp | 41 |
1 files changed, 10 insertions, 31 deletions
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, |