2009-01-14 David Levin <levin@chromium.org>
authordglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jan 2009 23:50:17 +0000 (23:50 +0000)
committerdglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jan 2009 23:50:17 +0000 (23:50 +0000)
        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

WebCore/ChangeLog
WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp
WebCore/platform/graphics/skia/ImageSkia.cpp
WebCore/platform/graphics/skia/PathSkia.cpp
WebCore/svg/graphics/skia/RenderPathSkia.cpp [deleted file]

index d5df7de1ae81b9f6fd748eef3980ff2390fb4c5c..cc8364c3e20caeea455001040b1f122292dc45d0 100644 (file)
@@ -1,3 +1,29 @@
+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.
index f7e516571c67e052f532663bde572e52e15fff82..03583a084d10d70ec4e8f2796618185f8e9678d7 100644 (file)
@@ -516,28 +516,6 @@ static void FillLogFont(const FontDescription& fontDescription, LOGFONT* winfont
     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)
index 0a12af3a7b6980a5f767769b9db0e5d53b55a3f7..1123fe9e961a6a453c0144ba8dcf79651e380125 100644 (file)
@@ -228,7 +228,7 @@ static void paintSkBitmap(PlatformContextSkia* platformContext, const NativeImag
 
     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()));
@@ -279,15 +279,19 @@ static FloatRect normalizeRect(const FloatRect& rect)
     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)
@@ -328,7 +332,7 @@ void Image::drawPattern(GraphicsContext* context,
 
     // Compute the resampling mode.
     ResamplingMode resampling;
-    if (context->platformContext()->IsPrinting())
+    if (context->platformContext()->isPrinting())
       resampling = RESAMPLE_LINEAR;
     else {
       resampling = computeResamplingMode(*bitmap,
index 06a791ace6b175acca0453147976adeb4197d647..ca993224dddc70d7fe65428ae245a4398fdd457c 100644 (file)
@@ -174,7 +174,6 @@ void Path::apply(void* info, PathApplierFunction function) const
 {
     SkPath::Iter iter(*m_path, false);
     SkPoint pts[4];
-
     PathElement pathElement;
     FloatPoint pathPoints[3];
 
@@ -275,7 +274,7 @@ static FloatRect boundingBoxForCurrentStroke(const GraphicsContext* context)
     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;
@@ -296,4 +295,22 @@ FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
     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
diff --git a/WebCore/svg/graphics/skia/RenderPathSkia.cpp b/WebCore/svg/graphics/skia/RenderPathSkia.cpp
deleted file mode 100644 (file)
index 84b56e3..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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)