Changeset 150053 in webkit


Ignore:
Timestamp:
May 13, 2013 9:04:36 PM (11 years ago)
Author:
benjamin@webkit.org
Message:

Remove platform/graphic's Generator
https://bugs.webkit.org/show_bug.cgi?id=116084

Patch by Benjamin Poulain <bpoulain@apple.com> on 2013-05-13
Reviewed by Darin Adler.

The Generator no longer abstract anything useful, its only
implementation is Gradient.

  • GNUmakefile.list.am:
  • WebCore.exp.in:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.vcxproj/WebCore.vcxproj:
  • WebCore.vcxproj/WebCore.vcxproj.filters:
  • WebCore.xcodeproj/project.pbxproj:
  • platform/graphics/GeneratedImage.h:
  • platform/graphics/Generator.h: Removed.
  • platform/graphics/GeneratorGeneratedImage.cpp:

(WebCore::GeneratorGeneratedImage::draw):
(WebCore::GeneratorGeneratedImage::drawPattern):

  • platform/graphics/GeneratorGeneratedImage.h:

(WebCore::GeneratorGeneratedImage::create):
(WebCore::GeneratorGeneratedImage::GeneratorGeneratedImage):
(GeneratorGeneratedImage):

  • platform/graphics/Gradient.h:

(WebCore):
(Gradient):

  • platform/graphics/GraphicsContext.cpp:

(WebCore::GraphicsContext::fillRect):

  • platform/graphics/GraphicsContext.h:

(WebCore):
(GraphicsContext):

Location:
trunk/Source/WebCore
Files:
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150049 r150053  
     12013-05-13  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        Remove platform/graphic's Generator
     4        https://bugs.webkit.org/show_bug.cgi?id=116084
     5
     6        Reviewed by Darin Adler.
     7
     8        The Generator no longer abstract anything useful, its only
     9        implementation is Gradient.
     10
     11        * GNUmakefile.list.am:
     12        * WebCore.exp.in:
     13        * WebCore.vcproj/WebCore.vcproj:
     14        * WebCore.vcxproj/WebCore.vcxproj:
     15        * WebCore.vcxproj/WebCore.vcxproj.filters:
     16        * WebCore.xcodeproj/project.pbxproj:
     17        * platform/graphics/GeneratedImage.h:
     18        * platform/graphics/Generator.h: Removed.
     19        * platform/graphics/GeneratorGeneratedImage.cpp:
     20        (WebCore::GeneratorGeneratedImage::draw):
     21        (WebCore::GeneratorGeneratedImage::drawPattern):
     22        * platform/graphics/GeneratorGeneratedImage.h:
     23        (WebCore::GeneratorGeneratedImage::create):
     24        (WebCore::GeneratorGeneratedImage::GeneratorGeneratedImage):
     25        (GeneratorGeneratedImage):
     26        * platform/graphics/Gradient.h:
     27        (WebCore):
     28        (Gradient):
     29        * platform/graphics/GraphicsContext.cpp:
     30        (WebCore::GraphicsContext::fillRect):
     31        * platform/graphics/GraphicsContext.h:
     32        (WebCore):
     33        (GraphicsContext):
     34
    1352013-05-13  David Kilzer  <ddkilzer@apple.com>
    236
  • trunk/Source/WebCore/GNUmakefile.list.am

    r150045 r150053  
    56805680        Source/WebCore/platform/graphics/GeneratedImage.cpp \
    56815681        Source/WebCore/platform/graphics/GeneratedImage.h \
    5682         Source/WebCore/platform/graphics/Generator.h \
    56835682        Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp \
    56845683        Source/WebCore/platform/graphics/GeneratorGeneratedImage.h \
  • trunk/Source/WebCore/WebCore.exp.in

    r150010 r150053  
    6868__ZN3WTF6StringC1EP8NSString
    6969__ZN3WTF6StringC1EPK10__CFString
     70__ZN7WebCore8GradientD1Ev
    7071__ZN7WebCore10ClientRectC1ERKNS_7IntRectE
    7172__ZN7WebCore10ClientRectC1ERKNS_9FloatRectE
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r150045 r150053  
    2999529995                                </File>
    2999629996                                <File
    29997                                         RelativePath="..\platform\graphics\Generator.h"
    29998                                         >
    29999                                 </File>
    30000                                 <File
    3000129997                                        RelativePath="..\platform\graphics\GeneratorGeneratedImage.cpp"
    3000229998                                        >
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r150045 r150053  
    1166711667    <ClInclude Include="..\platform\graphics\FontTraitsMask.h" />
    1166811668    <ClInclude Include="..\platform\graphics\GeneratedImage.h" />
    11669     <ClInclude Include="..\platform\graphics\Generator.h" />
    1167011669    <ClInclude Include="..\platform\graphics\Glyph.h" />
    1167111670    <ClInclude Include="..\platform\graphics\GlyphBuffer.h" />
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r150045 r150053  
    81948194      <Filter>platform\graphics</Filter>
    81958195    </ClInclude>
    8196     <ClInclude Include="..\platform\graphics\Generator.h">
    8197       <Filter>platform\graphics</Filter>
    8198     </ClInclude>
    81998196    <ClInclude Include="..\platform\graphics\Glyph.h">
    82008197      <Filter>platform\graphics</Filter>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r150049 r150053  
    50025002                BCE0139A0C0BEF180043860A /* JSStyleSheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE013980C0BEF180043860A /* JSStyleSheet.cpp */; };
    50035003                BCE0139B0C0BEF180043860A /* JSStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE013990C0BEF180043860A /* JSStyleSheet.h */; };
    5004                 BCE04C8A0DAFF7A0007A0F41 /* Generator.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE04C890DAFF7A0007A0F41 /* Generator.h */; settings = {ATTRIBUTES = (Private, ); }; };
    50055004                BCE1C41B0D982980003B02F2 /* Location.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE1C4190D982980003B02F2 /* Location.h */; };
    50065005                BCE1C41C0D982981003B02F2 /* Location.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE1C41A0D982980003B02F2 /* Location.cpp */; };
     
    1172611725                BCE013980C0BEF180043860A /* JSStyleSheet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSStyleSheet.cpp; sourceTree = "<group>"; };
    1172711726                BCE013990C0BEF180043860A /* JSStyleSheet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSStyleSheet.h; sourceTree = "<group>"; };
    11728                 BCE04C890DAFF7A0007A0F41 /* Generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Generator.h; sourceTree = "<group>"; };
    1172911727                BCE1C4190D982980003B02F2 /* Location.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Location.h; sourceTree = "<group>"; };
    1173011728                BCE1C41A0D982980003B02F2 /* Location.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Location.cpp; sourceTree = "<group>"; };
     
    1841618414                                4FB390AC15EF61F3007AD51F /* GeneratedImage.cpp */,
    1841718415                                BC23F0DA0DAFF4A4009FDC91 /* GeneratedImage.h */,
    18418                                 BCE04C890DAFF7A0007A0F41 /* Generator.h */,
    1841918416                                2D2FC0561460CD6F00263633 /* GeneratorGeneratedImage.cpp */,
    1842018417                                2D2FC0571460CD6F00263633 /* GeneratorGeneratedImage.h */,
     
    2193521932                                C0C054CC1118C8E400CE2636 /* generate-bindings.pl in Headers */,
    2193621933                                BC23F0DB0DAFF4A4009FDC91 /* GeneratedImage.h in Headers */,
    21937                                 BCE04C8A0DAFF7A0007A0F41 /* Generator.h in Headers */,
    2193821934                                2D481F04146B5C6B00AA7834 /* GeneratorGeneratedImage.h in Headers */,
    2193921935                                A622A8FF122C44A600A785B3 /* GenericBinding.h in Headers */,
  • trunk/Source/WebCore/platform/graphics/GeneratedImage.h

    r148921 r150053  
    11/*
    2  * Copyright (C) 2008 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2008, 2013 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929#include "Image.h"
    3030
    31 #include "Generator.h"
    3231#include "IntSize.h"
    3332#include <wtf/RefPtr.h>
  • trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp

    r149886 r150053  
    11/*
    2  * Copyright (C) 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4242        destContext->scale(FloatSize(destRect.width() / srcRect.width(), destRect.height() / srcRect.height()));
    4343    destContext->translate(-srcRect.x(), -srcRect.y());
    44     destContext->fillRect(FloatRect(FloatPoint(), m_size), *m_generator.get());
     44    destContext->fillRect(FloatRect(FloatPoint(), m_size), *m_gradient.get());
    4545}
    4646
     
    5151    IntSize adjustedSize = m_size;
    5252    FloatRect adjustedSrcRect = srcRect;
    53     m_generator->adjustParametersForTiledDrawing(adjustedSize, adjustedSrcRect);
     53    m_gradient->adjustParametersForTiledDrawing(adjustedSize, adjustedSrcRect);
    5454
    5555    // Factor in the destination context's scale to generate at the best resolution
     
    6161    adjustedSrcRect.scale(xScale, yScale);
    6262
    63     unsigned generatorHash = m_generator->hash();
     63    unsigned generatorHash = m_gradient->hash();
    6464
    6565    if (!m_cachedImageBuffer || m_cachedGeneratorHash != generatorHash || m_cachedAdjustedSize != adjustedSize || !destContext->isCompatibleWithBuffer(m_cachedImageBuffer.get())) {
    66         m_cachedImageBuffer = destContext->createCompatibleBuffer(adjustedSize, m_generator->hasAlpha());
     66        m_cachedImageBuffer = destContext->createCompatibleBuffer(adjustedSize, m_gradient->hasAlpha());
    6767        if (!m_cachedImageBuffer)
    6868            return;
    6969
    7070        // Fill with the generated image.
    71         m_cachedImageBuffer->context()->fillRect(FloatRect(FloatPoint(), adjustedSize), *m_generator);
     71        m_cachedImageBuffer->context()->fillRect(FloatRect(FloatPoint(), adjustedSize), *m_gradient);
    7272
    7373        m_cachedGeneratorHash = generatorHash;
  • trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h

    r149886 r150053  
    11/*
    2  * Copyright (C) 2008, 2012 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2008, 2012, 2013 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828
    2929#include "GeneratedImage.h"
    30 #include "Generator.h"
     30#include "Gradient.h"
    3131#include "Image.h"
    3232#include "ImageBuffer.h"
     
    3838class GeneratorGeneratedImage : public GeneratedImage {
    3939public:
    40     static PassRefPtr<GeneratorGeneratedImage> create(PassRefPtr<Generator> generator, const IntSize& size)
     40    static PassRefPtr<GeneratorGeneratedImage> create(PassRefPtr<Gradient> generator, const IntSize& size)
    4141    {
    4242        return adoptRef(new GeneratorGeneratedImage(generator, size));
     
    5050        const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode);
    5151
    52     GeneratorGeneratedImage(PassRefPtr<Generator> generator, const IntSize& size)
    53         : m_generator(generator)
     52    GeneratorGeneratedImage(PassRefPtr<Gradient> generator, const IntSize& size)
     53        : m_gradient(generator)
    5454    {
    5555        m_size = size;
    5656    }
    5757
    58     RefPtr<Generator> m_generator;
     58    RefPtr<Gradient> m_gradient;
    5959    OwnPtr<ImageBuffer> m_cachedImageBuffer;
    6060    IntSize m_cachedAdjustedSize;
  • trunk/Source/WebCore/platform/graphics/Gradient.h

    r149193 r150053  
    11/*
    2  * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008, 2011, 2012, 2013 Apple Inc. All rights reserved.
    33 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
    44 * Copyright (C) 2008 Torch Mobile, Inc.
     
    3131#include "AffineTransform.h"
    3232#include "FloatPoint.h"
    33 #include "Generator.h"
    3433#include "GraphicsTypes.h"
    3534#include <wtf/PassRefPtr.h>
     35#include <wtf/RefCounted.h>
    3636#include <wtf/Vector.h>
    3737
     
    6767
    6868    class Color;
    69 
    70     class Gradient : public Generator {
     69    class FloatRect;
     70    class GraphicsContext;
     71
     72    class Gradient : public RefCounted<Gradient> {
    7173    public:
    7274        static PassRefPtr<Gradient> create(const FloatPoint& p0, const FloatPoint& p1)
     
    7880            return adoptRef(new Gradient(p0, r0, p1, r1, aspectRatio));
    7981        }
    80         virtual ~Gradient();
     82        ~Gradient();
    8183
    8284        struct ColorStop;
     
    8587
    8688        void getColor(float value, float* r, float* g, float* b, float* a) const;
    87         virtual bool hasAlpha() const OVERRIDE;
     89        bool hasAlpha() const;
    8890
    8991        bool isRadial() const { return m_radial; }
     
    163165        AffineTransform gradientSpaceTransform() { return m_gradientSpaceTransformation; }
    164166
    165         virtual void fill(GraphicsContext*, const FloatRect&);
    166         virtual void adjustParametersForTiledDrawing(IntSize& size, FloatRect& srcRect);
     167        void fill(GraphicsContext*, const FloatRect&);
     168        void adjustParametersForTiledDrawing(IntSize&, FloatRect&);
    167169
    168170        void setPlatformGradientSpaceTransform(const AffineTransform& gradientSpaceTransformation);
    169171
    170         virtual unsigned hash() const OVERRIDE;
     172        unsigned hash() const;
    171173        void invalidateHash() { m_cachedHash = 0; }
    172174
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r149193 r150053  
    11/*
    2  * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
     2 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929#include "BidiResolver.h"
    3030#include "BitmapImage.h"
    31 #include "Generator.h"
     31#include "Gradient.h"
    3232#include "ImageBuffer.h"
    3333#include "IntRect.h"
     
    665665}
    666666
    667 void GraphicsContext::fillRect(const FloatRect& rect, Generator& generator)
    668 {
    669     if (paintingDisabled())
    670         return;
    671     generator.fill(this, rect);
     667void GraphicsContext::fillRect(const FloatRect& rect, Gradient& gradient)
     668{
     669    if (paintingDisabled())
     670        return;
     671    gradient.fill(this, rect);
    672672}
    673673
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r149566 r150053  
    11/*
    2  * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
     2 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
    33 * Copyright (C) 2008-2009 Torch Mobile, Inc.
    44 *
     
    8383    class AffineTransform;
    8484    class DrawingBuffer;
    85     class Generator;
     85    class Gradient;
    8686    class GraphicsContextPlatformPrivate;
    8787    class ImageBuffer;
     
    271271        void fillRect(const FloatRect&);
    272272        void fillRect(const FloatRect&, const Color&, ColorSpace);
    273         void fillRect(const FloatRect&, Generator&);
     273        void fillRect(const FloatRect&, Gradient&);
    274274        void fillRect(const FloatRect&, const Color&, ColorSpace, CompositeOperator, BlendMode = BlendModeNormal);
    275275        void fillRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color&, ColorSpace);
Note: See TracChangeset for help on using the changeset viewer.