Changeset 39713 in webkit


Ignore:
Timestamp:
Jan 8, 2009 11:45:23 AM (15 years ago)
Author:
eric@webkit.org
Message:

2009-01-08 Dimitri Glazkov <Dimitri Glazkov>

Reviewed by Eric Seidel.

Commit the right files this time! (Instead of the ugly unfixed ones.)
https://bugs.webkit.org/show_bug.cgi?id=23191

  • platform/graphics/skia/BitmapImageSingleFrameSkia.h:
  • platform/graphics/skia/FloatPointSkia.cpp:
  • platform/graphics/skia/FloatRectSkia.cpp:
  • platform/graphics/skia/IntPointSkia.cpp:
  • platform/graphics/skia/IntRectSkia.cpp: (WebCore::IntRect::operator SkRect):
  • platform/graphics/skia/SkiaUtils.cpp: (WebCore::): (WebCore::WebCoreCompositeToSkiaComposite): (WebCore::SkPMColorToWebCoreColor): (WebCore::IntersectRectAndRegion): (WebCore::ClipRectToCanvas): (WebCore::SkPathContainsPoint): (WebCore::scratchContext):
  • platform/graphics/skia/SkiaUtils.h: (WebCore::WebCoreFloatToSkScalar): (WebCore::WebCoreDoubleToSkScalar):
Location:
trunk/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r39712 r39713  
     12009-01-08  Dimitri Glazkov  <dglazkov@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Commit the right files this time!  (Instead of the ugly unfixed ones.)
     6        https://bugs.webkit.org/show_bug.cgi?id=23191
     7
     8        * platform/graphics/skia/BitmapImageSingleFrameSkia.h:
     9        * platform/graphics/skia/FloatPointSkia.cpp:
     10        * platform/graphics/skia/FloatRectSkia.cpp:
     11        * platform/graphics/skia/IntPointSkia.cpp:
     12        * platform/graphics/skia/IntRectSkia.cpp:
     13        (WebCore::IntRect::operator SkRect):
     14        * platform/graphics/skia/SkiaUtils.cpp:
     15        (WebCore::):
     16        (WebCore::WebCoreCompositeToSkiaComposite):
     17        (WebCore::SkPMColorToWebCoreColor):
     18        (WebCore::IntersectRectAndRegion):
     19        (WebCore::ClipRectToCanvas):
     20        (WebCore::SkPathContainsPoint):
     21        (WebCore::scratchContext):
     22        * platform/graphics/skia/SkiaUtils.h:
     23        (WebCore::WebCoreFloatToSkScalar):
     24        (WebCore::WebCoreDoubleToSkScalar):
     25
    1262009-01-08  Dimitri Glazkov  <dglazkov@chromium.org>
    227
     
    530        Add the first few files from platform/graphics/skia
    631        https://bugs.webkit.org/show_bug.cgi?id=23191
    7        
     32
    833        These are all pretty simple.
    934        Eventually BitmapImageSingleFrameSkia might grow a .cpp file, for now it's just a header.
  • trunk/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h

    r39712 r39713  
    1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
    2 // Use of this source code is governed by a BSD-style license that can be
    3 // found in the LICENSE file.
     1/*
     2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved.
     3 *
     4 * Redistribution and use in source and binary forms, with or without
     5 * modification, are permitted provided that the following conditions are
     6 * met:
     7 *
     8 *     * Redistributions of source code must retain the above copyright
     9 * notice, this list of conditions and the following disclaimer.
     10 *     * Redistributions in binary form must reproduce the above
     11 * copyright notice, this list of conditions and the following disclaimer
     12 * in the documentation and/or other materials provided with the
     13 * distribution.
     14 *     * Neither the name of Google Inc. nor the names of its
     15 * contributors may be used to endorse or promote products derived from
     16 * this software without specific prior written permission.
     17 *
     18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29 */
    430
    531#ifndef BitmapImageSingleFrameSkia_h
     
    2349    // Creates a new Image, by copying the pixel values out of |bitmap|.
    2450    // If creation failed, returns null.
    25     static PassRefPtr<BitmapImageSingleFrameSkia> create(
    26         const SkBitmap& bitmap);
     51    static PassRefPtr<BitmapImageSingleFrameSkia> create(const SkBitmap&);
    2752
    2853    virtual bool isBitmapImage() const { return true; }
     
    4873
    4974protected:
    50     virtual void draw(GraphicsContext* ctxt, const FloatRect& dstRect,
    51                       const FloatRect& srcRect, CompositeOperator compositeOp);
     75    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator);
    5276
    5377private:
  • trunk/WebCore/platform/graphics/skia/FloatPointSkia.cpp

    r39712 r39713  
    11/*
    2  * Copyright (C) 2008 Google, Inc. All rights reserved.
    3  *
     2 * Copyright (c) 2008, Google Inc. All rights reserved.
     3 * 
    44 * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
    10  *    notice, this list of conditions and the following disclaimer in the
    11  *    documentation and/or other materials provided with the distribution.
    12  *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     5 * modification, are permitted provided that the following conditions are
     6 * met:
     7 *
     8 *     * Redistributions of source code must retain the above copyright
     9 * notice, this list of conditions and the following disclaimer.
     10 *     * Redistributions in binary form must reproduce the above
     11 * copyright notice, this list of conditions and the following disclaimer
     12 * in the documentation and/or other materials provided with the
     13 * distribution.
     14 *     * Neither the name of Google Inc. nor the names of its
     15 * contributors may be used to endorse or promote products derived from
     16 * this software without specific prior written permission.
     17 *
     18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2227 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2429 */
    2530
     
    4550
    4651} // namespace WebCore
    47 
  • trunk/WebCore/platform/graphics/skia/FloatRectSkia.cpp

    r39712 r39713  
    11/*
    2  * Copyright (C) 2008 Google, Inc. All rights reserved.
    3  *
     2 * Copyright (c) 2008, Google Inc. All rights reserved.
     3 * 
    44 * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
    10  *    notice, this list of conditions and the following disclaimer in the
    11  *    documentation and/or other materials provided with the distribution.
    12  *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     5 * modification, are permitted provided that the following conditions are
     6 * met:
     7 *
     8 *     * Redistributions of source code must retain the above copyright
     9 * notice, this list of conditions and the following disclaimer.
     10 *     * Redistributions in binary form must reproduce the above
     11 * copyright notice, this list of conditions and the following disclaimer
     12 * in the documentation and/or other materials provided with the
     13 * distribution.
     14 *     * Neither the name of Google Inc. nor the names of its
     15 * contributors may be used to endorse or promote products derived from
     16 * this software without specific prior written permission.
     17 *
     18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2227 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    2328 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     
    4449
    4550} // namespace WebCore
    46 
  • trunk/WebCore/platform/graphics/skia/IntPointSkia.cpp

    r39712 r39713  
    11/*
    2  * Copyright (C) 2008 Google, Inc. All rights reserved.
    3  *
     2 * Copyright (c) 2008, Google Inc. All rights reserved.
     3 * 
    44 * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
    10  *    notice, this list of conditions and the following disclaimer in the
    11  *    documentation and/or other materials provided with the distribution.
    12  *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     5 * modification, are permitted provided that the following conditions are
     6 * met:
     7 *
     8 *     * Redistributions of source code must retain the above copyright
     9 * notice, this list of conditions and the following disclaimer.
     10 *     * Redistributions in binary form must reproduce the above
     11 * copyright notice, this list of conditions and the following disclaimer
     12 * in the documentation and/or other materials provided with the
     13 * distribution.
     14 *     * Neither the name of Google Inc. nor the names of its
     15 * contributors may be used to endorse or promote products derived from
     16 * this software without specific prior written permission.
     17 *
     18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2227 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2429 */
    2530
    2631#include "config.h"
    2732#include "IntPoint.h"
     33
    2834#include "SkPoint.h"
    2935
  • trunk/WebCore/platform/graphics/skia/IntRectSkia.cpp

    r39712 r39713  
    11/*
    2  * Copyright (C) 2008 Google, Inc. All rights reserved.
    3  *
     2 * Copyright (c) 2008, Google Inc. All rights reserved.
     3 * 
    44 * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
    10  *    notice, this list of conditions and the following disclaimer in the
    11  *    documentation and/or other materials provided with the distribution.
    12  *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     5 * modification, are permitted provided that the following conditions are
     6 * met:
     7 *
     8 *     * Redistributions of source code must retain the above copyright
     9 * notice, this list of conditions and the following disclaimer.
     10 *     * Redistributions in binary form must reproduce the above
     11 * copyright notice, this list of conditions and the following disclaimer
     12 * in the documentation and/or other materials provided with the
     13 * distribution.
     14 *     * Neither the name of Google Inc. nor the names of its
     15 * contributors may be used to endorse or promote products derived from
     16 * this software without specific prior written permission.
     17 *
     18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2227 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2429 */
    2530
     
    4045{
    4146    SkRect rect;
    42     rect.set(SkIntToScalar(x()), SkIntToScalar(y()),
    43              SkIntToScalar(right()), SkIntToScalar(bottom()));
     47    rect.set(SkIntToScalar(x()), SkIntToScalar(y()), SkIntToScalar(right()), SkIntToScalar(bottom()));
    4448    return rect;
    4549}
     
    5155}
    5256
    53 }
    54 
     57} // namespace WebCore
  • trunk/WebCore/platform/graphics/skia/SkiaUtils.cpp

    r39712 r39713  
    1 // Copyright (c) 2008, Google Inc.
    2 // All rights reserved.
    3 //
    4 // Redistribution and use in source and binary forms, with or without
    5 // modification, are permitted provided that the following conditions are
    6 // met:
    7 //
    8 //     * Redistributions of source code must retain the above copyright
    9 // notice, this list of conditions and the following disclaimer.
    10 //     * Redistributions in binary form must reproduce the above
    11 // copyright notice, this list of conditions and the following disclaimer
    12 // in the documentation and/or other materials provided with the
    13 // distribution.
    14 //     * Neither the name of Google Inc. nor the names of its
    15 // contributors may be used to endorse or promote products derived from
    16 // this software without specific prior written permission.
    17 //
    18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     1/*
     2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved.
     3 *
     4 * Redistribution and use in source and binary forms, with or without
     5 * modification, are permitted provided that the following conditions are
     6 * met:
     7 *
     8 *     * Redistributions of source code must retain the above copyright
     9 * notice, this list of conditions and the following disclaimer.
     10 *     * Redistributions in binary form must reproduce the above
     11 * copyright notice, this list of conditions and the following disclaimer
     12 * in the documentation and/or other materials provided with the
     13 * distribution.
     14 *     * Neither the name of Google Inc. nor the names of its
     15 * contributors may be used to endorse or promote products derived from
     16 * this software without specific prior written permission.
     17 *
     18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29 */
    2930
    3031#include "config.h"
     
    4142namespace WebCore {
    4243
    43 void WebCorePointToSkiaPoint(const WebCore::FloatPoint& src, SkPoint* dst)
    44 {
    45     dst->set(WebCoreFloatToSkScalar(src.x()), WebCoreFloatToSkScalar(src.y()));
    46 }
    47 
    48 void WebCoreRectToSkiaRect(const WebCore::IntRect& src, SkRect* dst)
    49 {
    50     dst->set(SkIntToScalar(src.x()),
    51              SkIntToScalar(src.y()),
    52              SkIntToScalar(src.x() + src.width()),
    53              SkIntToScalar(src.y() + src.height()));
    54 }
    55 
    56 void WebCoreRectToSkiaRect(const WebCore::IntRect& src, SkIRect* dst)
    57 {
    58     dst->set(src.x(),
    59              src.y(),
    60              src.x() + src.width(),
    61              src.y() + src.height());
    62 }
    63 
    64 void WebCoreRectToSkiaRect(const WebCore::FloatRect& src, SkRect* dst)
    65 {
    66     dst->set(WebCoreFloatToSkScalar(src.x()),
    67              WebCoreFloatToSkScalar(src.y()),
    68              WebCoreFloatToSkScalar(src.x() + src.width()),
    69              WebCoreFloatToSkScalar(src.y() + src.height()));
    70 }
    71 
    72 void WebCoreRectToSkiaRect(const WebCore::FloatRect& src, SkIRect* dst)
    73 {
    74     dst->set(SkScalarRound(WebCoreFloatToSkScalar(src.x())),
    75              SkScalarRound(WebCoreFloatToSkScalar(src.y())),
    76              SkScalarRound(WebCoreFloatToSkScalar(src.x() + src.width())),
    77              SkScalarRound(WebCoreFloatToSkScalar(src.y() + src.height())));
    78 }
    79 
    8044static const struct CompositOpToPorterDuffMode {
    8145    uint8_t mCompositOp;
    8246    uint8_t mPorterDuffMode;
    8347} gMapCompositOpsToPorterDuffModes[] = {
    84     { WebCore::CompositeClear,           SkPorterDuff::kClear_Mode },
    85     { WebCore::CompositeCopy,            SkPorterDuff::kSrcOver_Mode },  // TODO
    86     { WebCore::CompositeSourceOver,      SkPorterDuff::kSrcOver_Mode },
    87     { WebCore::CompositeSourceIn,        SkPorterDuff::kSrcIn_Mode },
    88     { WebCore::CompositeSourceOut,       SkPorterDuff::kSrcOut_Mode },
    89     { WebCore::CompositeSourceAtop,      SkPorterDuff::kSrcATop_Mode },
    90     { WebCore::CompositeDestinationOver, SkPorterDuff::kDstOver_Mode },
    91     { WebCore::CompositeDestinationIn,   SkPorterDuff::kDstIn_Mode },
    92     { WebCore::CompositeDestinationOut,  SkPorterDuff::kDstOut_Mode },
    93     { WebCore::CompositeDestinationAtop, SkPorterDuff::kDstATop_Mode },
    94     { WebCore::CompositeXOR,             SkPorterDuff::kXor_Mode },
    95     { WebCore::CompositePlusDarker,      SkPorterDuff::kDarken_Mode },
    96     { WebCore::CompositeHighlight,       SkPorterDuff::kSrcOver_Mode },  // TODO
    97     { WebCore::CompositePlusLighter,     SkPorterDuff::kLighten_Mode }
     48    { CompositeClear,           SkPorterDuff::kClear_Mode },
     49    { CompositeCopy,            SkPorterDuff::kSrcOver_Mode },  // TODO
     50    { CompositeSourceOver,      SkPorterDuff::kSrcOver_Mode },
     51    { CompositeSourceIn,        SkPorterDuff::kSrcIn_Mode },
     52    { CompositeSourceOut,       SkPorterDuff::kSrcOut_Mode },
     53    { CompositeSourceAtop,      SkPorterDuff::kSrcATop_Mode },
     54    { CompositeDestinationOver, SkPorterDuff::kDstOver_Mode },
     55    { CompositeDestinationIn,   SkPorterDuff::kDstIn_Mode },
     56    { CompositeDestinationOut,  SkPorterDuff::kDstOut_Mode },
     57    { CompositeDestinationAtop, SkPorterDuff::kDstATop_Mode },
     58    { CompositeXOR,             SkPorterDuff::kXor_Mode },
     59    { CompositePlusDarker,      SkPorterDuff::kDarken_Mode },
     60    { CompositeHighlight,       SkPorterDuff::kSrcOver_Mode },  // TODO
     61    { CompositePlusLighter,     SkPorterDuff::kLighten_Mode }
    9862};
    9963
    100 SkPorterDuff::Mode WebCoreCompositeToSkiaComposite(WebCore::CompositeOperator op)
     64SkPorterDuff::Mode WebCoreCompositeToSkiaComposite(CompositeOperator op)
    10165{
    10266    const CompositOpToPorterDuffMode* table = gMapCompositOpsToPorterDuffModes;
    10367   
    10468    for (unsigned i = 0; i < SK_ARRAY_COUNT(gMapCompositOpsToPorterDuffModes); i++) {
    105         if (table[i].mCompositOp == op) {
     69        if (table[i].mCompositOp == op)
    10670            return (SkPorterDuff::Mode)table[i].mPorterDuffMode;
    107         }
    10871    }
    10972
    110     SkDEBUGF(("GraphicsContext::setCompositeOperation uknown CompositOperator %d\n", op));
     73    SkDEBUGF(("GraphicsContext::setCompositeOperation uknown CompositeOperator %d\n", op));
    11174    return SkPorterDuff::kSrcOver_Mode; // fall-back
    11275}
     
    13295}
    13396
    134 WebCore::Color SkPMColorToWebCoreColor(SkPMColor pm)
     97Color SkPMColorToWebCoreColor(SkPMColor pm)
    13598{
    13699    return SkPMColorToColor(pm);
    137100}
    138101
    139 void IntersectRectAndRegion(const SkRegion& region, const SkRect& src_rect,
    140                             SkRect* dest_rect) {
     102void IntersectRectAndRegion(const SkRegion& region, const SkRect& srcRect, SkRect* destRect) {
    141103    // The cliperator requires an int rect, so we round out.
    142     SkIRect src_rect_rounded;
    143     src_rect.roundOut(&src_rect_rounded);
     104    SkIRect srcRectRounded;
     105    srcRect.roundOut(&srcRectRounded);
    144106
    145107    // The Cliperator will iterate over a bunch of rects where our transformed
    146108    // rect and the clipping region (which may be non-square) overlap.
    147     SkRegion::Cliperator cliperator(region, src_rect_rounded);
     109    SkRegion::Cliperator cliperator(region, srcRectRounded);
    148110    if (cliperator.done()) {
    149         dest_rect->setEmpty();
     111        destRect->setEmpty();
    150112        return;
    151113    }
    152114
    153115    // Get the union of all visible rects in the clip that overlap our bitmap.
    154     SkIRect cur_visible_rect = cliperator.rect();
     116    SkIRect currentVisibleRect = cliperator.rect();
    155117    cliperator.next();
    156118    while (!cliperator.done()) {
    157         cur_visible_rect.join(cliperator.rect());
     119        currentVisibleRect.join(cliperator.rect());
    158120        cliperator.next();
    159121    }
    160122
    161     dest_rect->set(cur_visible_rect);
     123    destRect->set(currentVisibleRect);
    162124}
    163125
    164 void ClipRectToCanvas(const SkCanvas& canvas, const SkRect& src_rect,
    165                       SkRect* dest_rect) {
     126void ClipRectToCanvas(const SkCanvas& canvas, const SkRect& srcRect, SkRect* destRect) {
    166127    // Translate into the canvas' coordinate space. This is where the clipping
    167128    // region applies.
    168     SkRect transformed_src;
    169     canvas.getTotalMatrix().mapRect(&transformed_src, src_rect);
     129    SkRect transformedSrc;
     130    canvas.getTotalMatrix().mapRect(&transformedSrc, srcRect);
    170131
    171132    // Do the intersection.
    172     SkRect transformed_dest;
    173     IntersectRectAndRegion(canvas.getTotalClip(), transformed_src,
    174                            &transformed_dest);
     133    SkRect transformedDest;
     134    IntersectRectAndRegion(canvas.getTotalClip(), transformedSrc, &transformedDest);
    175135
    176136    // Now transform it back into world space.
    177     SkMatrix inverse_transform;
    178     canvas.getTotalMatrix().invert(&inverse_transform);
    179     inverse_transform.mapRect(dest_rect, transformed_dest);
     137    SkMatrix inverseTransform;
     138    canvas.getTotalMatrix().invert(&inverseTransform);
     139    inverseTransform.mapRect(destRect, transformedDest);
    180140}
    181141
    182 bool SkPathContainsPoint(SkPath* orig_path, WebCore::FloatPoint point, SkPath::FillType ft)
     142bool SkPathContainsPoint(SkPath* originalPath, const FloatPoint& point, SkPath::FillType ft)
    183143{
    184     SkRegion    rgn, clip;
     144    SkRegion rgn;
     145    SkRegion clip;
    185146
    186     SkPath::FillType orig_ft = orig_path->getFillType();    // save
     147    SkPath::FillType originalFillType = originalPath->getFillType();
    187148
    188     const SkPath* path = orig_path;
    189     SkPath scaled_path;
     149    const SkPath* path = originalPath;
     150    SkPath scaledPath;
    190151    int scale = 1;
    191152
    192153    SkRect bounds;
    193     orig_path->computeBounds(&bounds, SkPath::kFast_BoundsType);
     154    originalPath->computeBounds(&bounds, SkPath::kFast_BoundsType);
    194155
    195156    // We can immediately return false if the point is outside the bounding rect
    196157    if (!bounds.contains(SkFloatToScalar(point.x()), SkFloatToScalar(point.y())))
    197       return false;
     158        return false;
    198159
    199     orig_path->setFillType(ft);
     160    originalPath->setFillType(ft);
    200161
    201162    // Skia has trouble with coordinates close to the max signed 16-bit values
     
    205166    // values
    206167    const SkScalar kMaxCoordinate = SkIntToScalar(1<<15);
    207     SkScalar biggest_coord = std::max(std::max(std::max(
    208       bounds.fRight, bounds.fBottom), -bounds.fLeft), -bounds.fTop);
     168    SkScalar biggestCoord = std::max(std::max(std::max(bounds.fRight, bounds.fBottom), -bounds.fLeft), -bounds.fTop);
    209169
    210     if (biggest_coord > kMaxCoordinate) {
    211       scale = SkScalarCeil(SkScalarDiv(biggest_coord, kMaxCoordinate));
     170    if (biggestCoord > kMaxCoordinate) {
     171        scale = SkScalarCeil(SkScalarDiv(biggestCoord, kMaxCoordinate));
    212172
    213       SkMatrix m;
    214       m.setScale(SkScalarInvert(SkIntToScalar(scale)),
    215                  SkScalarInvert(SkIntToScalar(scale)));
    216       orig_path->transform(m, &scaled_path);
    217       path = &scaled_path;
     173        SkMatrix m;
     174        m.setScale(SkScalarInvert(SkIntToScalar(scale)), SkScalarInvert(SkIntToScalar(scale)));
     175        originalPath->transform(m, &scaledPath);
     176        path = &scaledPath;
    218177    }
    219178
    220     int x = (int)floorf(point.x() / scale);
    221     int y = (int)floorf(point.y() / scale);
     179    int x = static_cast<int>(floorf(point.x() / scale));
     180    int y = static_cast<int>(floorf(point.y() / scale));
    222181    clip.setRect(x, y, x + 1, y + 1);
    223182
    224183    bool contains = rgn.setPath(*path, clip);
    225184
    226     orig_path->setFillType(orig_ft);    // restore
     185    originalPath->setFillType(originalFillType);
    227186    return contains;
    228187}
     
    230189GraphicsContext* scratchContext()
    231190{
    232     static ImageBuffer* scratch = NULL;
     191    static ImageBuffer* scratch = 0;
    233192    if (!scratch)
    234193        scratch = ImageBuffer::create(IntSize(1, 1), false).release();
  • trunk/WebCore/platform/graphics/skia/SkiaUtils.h

    r39712 r39713  
    1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
    2 // Use of this source code is governed by a BSD-style license that can be
    3 // found in the LICENSE file.
     1/*
     2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved.
     3 *
     4 * Redistribution and use in source and binary forms, with or without
     5 * modification, are permitted provided that the following conditions are
     6 * met:
     7 *
     8 *     * Redistributions of source code must retain the above copyright
     9 * notice, this list of conditions and the following disclaimer.
     10 *     * Redistributions in binary form must reproduce the above
     11 * copyright notice, this list of conditions and the following disclaimer
     12 * in the documentation and/or other materials provided with the
     13 * distribution.
     14 *     * Neither the name of Google Inc. nor the names of its
     15 * contributors may be used to endorse or promote products derived from
     16 * this software without specific prior written permission.
     17 *
     18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29 */
    430
    5 // This file declares helper routines for using Skia in WebKit.
     31// All of the functions in this file should move to new homes and this file should be deleted.
    632
    733#ifndef SkiaUtils_h
     
    1844namespace WebCore {
    1945
    20 // Converts a WebCore composit operation (WebCore::Composite*) to the
    21 // corresponding Skia type.
    22 SkPorterDuff::Mode WebCoreCompositeToSkiaComposite(WebCore::CompositeOperator);
     46SkPorterDuff::Mode WebCoreCompositeToSkiaComposite(CompositeOperator);
    2347
    2448// move this guy into SkColor.h
    25 SkColor SkPMColorToColor(SkPMColor pm);
     49SkColor SkPMColorToColor(SkPMColor);
    2650
    27 // Converts Android colors to WebKit ones.
    28 WebCore::Color SkPMColorToWebCoreColor(SkPMColor pm);
     51// This should be an operator on Color
     52Color SkPMColorToWebCoreColor(SkPMColor);
    2953
    3054// Skia has problems when passed infinite, etc floats, filter them to 0.
    31 inline SkScalar WebCoreFloatToSkScalar(const float& f) {
    32   return SkFloatToScalar(isfinite(f) ? f : 0);
     55inline SkScalar WebCoreFloatToSkScalar(float f)
     56{
     57    return SkFloatToScalar(isfinite(f) ? f : 0);
    3358}
    3459
    35 inline SkScalar WebCoreDoubleToSkScalar(const double& d) {
    36   return SkDoubleToScalar(isfinite(d) ? d : 0);
     60inline SkScalar WebCoreDoubleToSkScalar(double d)
     61{
     62    return SkDoubleToScalar(isfinite(d) ? d : 0);
    3763}
    38 
    39 // Intersects the given source rect with the region, returning the smallest
    40 // rectangular region that encompases the result.
    41 //
    42 // src_rect and dest_rect can be the same.
    43 void IntersectRectAndRegion(const SkRegion& region, const SkRect& src_rect,
    44                             SkRect* dest_rect);
    4564
    4665// Computes the smallest rectangle that, which when drawn to the given canvas,
     
    4867// clip, doing the necessary coordinate transforms.
    4968//
    50 // src_rect and dest_rect can be the same.
    51 void ClipRectToCanvas(const SkCanvas& canvas, const SkRect& src_rect,
    52                       SkRect* dest_rect);
     69// srcRect and destRect can be the same.
     70void ClipRectToCanvas(const SkCanvas&, const SkRect& srcRect, SkRect* destRect);
    5371
    5472// Determine if a given WebKit point is contained in a path
    55 bool SkPathContainsPoint(SkPath* orig_path, WebCore::FloatPoint point, SkPath::FillType ft);
     73bool SkPathContainsPoint(SkPath*, const FloatPoint&, SkPath::FillType);
    5674
    5775// Returns a statically allocated 1x1 GraphicsContext intended for temporary
Note: See TracChangeset for help on using the changeset viewer.