Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=23333
Platform code fixes. These compensate for changes in platform
callbacks from WebKit and minor API tweaks.
I enumerated a few below.
* platform/graphics/chromium/FontCacheChromiumWin.cpp:
fontExists has been gone since r34794.
* platform/graphics/skia/ImageSkia.cpp:
(WebCore::paintSkBitmap):
(WebCore::FrameData::clear):
r39751 changes this api to take and return a bool.
(WebCore::Image::drawPattern):
* platform/graphics/skia/PathSkia.cpp:
(WebCore::Path::apply):
(WebCore::boundingBoxForCurrentStroke):
(WebCore::Path::strokeContains):
* svg/graphics/skia/RenderPathSkia.cpp: Removed due to r39805.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@39918
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2009-01-14 David Levin <levin@chromium.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23333
+ Platform code fixes. These compensate for changes in platform
+ callbacks from WebKit and minor API tweaks.
+
+ I enumerated a few below.
+
+ * platform/graphics/chromium/FontCacheChromiumWin.cpp:
+ fontExists has been gone since r34794.
+
+ * platform/graphics/skia/ImageSkia.cpp:
+ (WebCore::paintSkBitmap):
+
+ (WebCore::FrameData::clear):
+ r39751 changes this api to take and return a bool.
+
+ (WebCore::Image::drawPattern):
+ * platform/graphics/skia/PathSkia.cpp:
+ (WebCore::Path::apply):
+ (WebCore::boundingBoxForCurrentStroke):
+ (WebCore::Path::strokeContains):
+ * svg/graphics/skia/RenderPathSkia.cpp: Removed due to r39805.
+
2009-01-14 Jeremy Moskovich <jeremy@chromium.org>
Reviewed by Eric Seidel.
winfont->lfWeight = toGDIFontWeight(fontDescription.weight());
}
-bool FontCache::fontExists(const FontDescription& fontDescription, const AtomicString& family)
-{
- LOGFONT winfont = {0};
- FillLogFont(fontDescription, &winfont);
- String winName;
- HFONT hfont = createFontIndirectAndGetWinName(family, &winfont, &winName);
- if (!hfont)
- return false;
-
- DeleteObject(hfont);
- if (equalIgnoringCase(family, winName))
- return true;
- // For CJK fonts with both English and native names,
- // GetTextFace returns a native name under the font's "locale"
- // and an English name under other locales regardless of
- // lfFaceName field of LOGFONT. As a result, we need to check
- // if a font has an alternate name. If there is, we need to
- // compare it with what's requested in the first place.
- String altName;
- return LookupAltName(family, altName) && equalIgnoringCase(altName, winName);
-}
-
struct TraitsInFamilyProcData {
TraitsInFamilyProcData(const AtomicString& familyName)
: m_familyName(familyName)
skia::PlatformCanvas* canvas = platformContext->canvas();
- ResamplingMode resampling = platformContext->IsPrinting() ? RESAMPLE_NONE :
+ ResamplingMode resampling = platformContext->isPrinting() ? RESAMPLE_NONE :
computeResamplingMode(bitmap, srcRect.width(), srcRect.height(),
SkScalarToFloat(destRect.width()),
SkScalarToFloat(destRect.height()));
return norm;
}
-void FrameData::clear()
+bool FrameData::clear(bool clearMetadata)
{
- // ImageSource::createFrameAtIndex() allocated |m_frame| and passed
- // ownership to BitmapImage; we must delete it here.
- delete m_frame;
- m_frame = 0;
- // NOTE: We purposefully don't reset metadata here, so that even if we
- // throw away previously-decoded data, animation loops can still access
- // properties like frame durations without re-decoding.
+ if (clearMetadata)
+ m_haveMetadata = false;
+
+ if (m_frame) {
+ // ImageSource::createFrameAtIndex() allocated |m_frame| and passed
+ // ownership to BitmapImage; we must delete it here.
+ delete m_frame;
+ m_frame = 0;
+ return true;
+ }
+ return false;
}
PassRefPtr<Image> Image::loadPlatformResource(const char *name)
// Compute the resampling mode.
ResamplingMode resampling;
- if (context->platformContext()->IsPrinting())
+ if (context->platformContext()->isPrinting())
resampling = RESAMPLE_LINEAR;
else {
resampling = computeResamplingMode(*bitmap,
{
SkPath::Iter iter(*m_path, false);
SkPoint pts[4];
-
PathElement pathElement;
FloatPoint pathPoints[3];
SkPaint paint;
context->platformContext()->setupPaintForStroking(&paint, 0, 0);
SkPath boundingPath;
- paint.getFillPath(*context->platformContext()->currentPath(), &boundingPath);
+ paint.getFillPath(context->platformContext()->currentPath(), &boundingPath);
SkRect r;
boundingPath.computeBounds(&r, SkPath::kExact_BoundsType);
return r;
return r;
}
+bool Path::strokeContains(StrokeStyleApplier* applier, const FloatPoint& point) const
+{
+ ASSERT(applier);
+ GraphicsContext* scratch = scratchContext();
+ scratch->save();
+
+ applier->strokeStyle(scratch);
+
+ SkPaint paint;
+ scratch->platformContext()->setupPaintForStroking(&paint, 0, 0);
+ SkPath strokePath;
+ paint.getFillPath(*platformPath(), &strokePath);
+ bool contains = SkPathContainsPoint(&strokePath, point,
+ SkPath::kWinding_FillType);
+
+ scratch->restore();
+ return contains;
+}
} // namespace WebCore
+++ /dev/null
-/*
- * Copyright (c) 2008, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "GraphicsContext.h"
-#include "PlatformContextSkia.h"
-#include "RenderPath.h"
-#include "SkiaUtils.h"
-#include "SkPaint.h"
-#include "SkPath.h"
-#include "SVGPaintServer.h"
-
-#if ENABLE(SVG)
-
-namespace WebCore {
-
-bool RenderPath::strokeContains(const FloatPoint& point, bool requiresStroke) const
-{
- if (path().isEmpty())
- return false;
-
- if (requiresStroke && !SVGPaintServer::strokePaintServer(style(), this))
- return false;
-
- GraphicsContext* scratch = scratchContext();
- scratch->save();
- applyStrokeStyleToContext(scratch, style(), this);
-
- SkPaint paint;
- scratch->platformContext()->setupPaintForStroking(&paint, 0, 0);
- SkPath strokePath;
- paint.getFillPath(*path().platformPath(), &strokePath);
- bool contains = SkPathContainsPoint(&strokePath, point,
- SkPath::kWinding_FillType);
-
- scratch->restore();
- return contains;
-}
-
-}
-
-#endif // ENABLE(SVG)