Changeset 90872 in webkit


Ignore:
Timestamp:
Jul 12, 2011 5:20:04 PM (13 years ago)
Author:
jamesr@google.com
Message:

[chromium] Delete the unused legacy accelerated canvas 2d code
https://bugs.webkit.org/show_bug.cgi?id=64214

Reviewed by Stephen White.

Source/WebCore:

This removes the legacy accelerated canvas 2d path and support logic since we (chromium) are no longer using
this codepath and it seems clear that no other port is interested.

Refactoring and removing unused code, so no new tests.

  • WebCore.gypi:
  • WebCore.xcodeproj/project.pbxproj:
  • html/canvas/CanvasRenderingContext2D.cpp:

(WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
(WebCore::CanvasRenderingContext2D::setGlobalCompositeOperation):
(WebCore::CanvasRenderingContext2D::didDraw):

  • html/canvas/CanvasRenderingContext2D.h:
  • loader/EmptyClients.h:
  • page/ChromeClient.h:
  • page/Page.cpp:

(WebCore::Page::sharedGraphicsContext3D):

  • page/Page.h:
  • platform/graphics/GraphicsContext.cpp:

(WebCore::GraphicsContext::setSharedGraphicsContext3D):
(WebCore::GraphicsContext::syncSoftwareCanvas):

  • platform/graphics/GraphicsContext.h:
  • platform/graphics/GraphicsContext3D.h:
  • platform/graphics/chromium/DrawingBufferChromium.cpp:

(WebCore::DrawingBuffer::setGrContext):

  • platform/graphics/chromium/FontLinux.cpp:

(WebCore::Font::drawGlyphs):

  • platform/graphics/chromium/cc/CCLayerSorter.cpp:

(WebCore::pointInTriangle):

  • platform/graphics/gpu/BicubicShader.cpp: Removed.
  • platform/graphics/gpu/BicubicShader.h: Removed.
  • platform/graphics/gpu/ConvolutionShader.cpp: Removed.
  • platform/graphics/gpu/ConvolutionShader.h: Removed.
  • platform/graphics/gpu/GraphicsContextGPU.cpp: Removed.
  • platform/graphics/gpu/GraphicsContextGPU.h: Removed.
  • platform/graphics/gpu/SharedGraphicsContext3D.cpp: Removed.
  • platform/graphics/gpu/SharedGraphicsContext3D.h: Removed.
  • platform/graphics/gpu/SolidFillShader.cpp: Removed.
  • platform/graphics/gpu/SolidFillShader.h: Removed.
  • platform/graphics/gpu/TexShader.cpp: Removed.
  • platform/graphics/gpu/TexShader.h: Removed.
  • platform/graphics/skia/GraphicsContextSkia.cpp:

(WebCore::GraphicsContext::savePlatformState):
(WebCore::GraphicsContext::restorePlatformState):
(WebCore::GraphicsContext::addInnerRoundedRectClip):
(WebCore::GraphicsContext::clearRect):
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::canvasClip):
(WebCore::GraphicsContext::clipOut):
(WebCore::GraphicsContext::clipPath):
(WebCore::GraphicsContext::concatCTM):
(WebCore::GraphicsContext::setCTM):
(WebCore::GraphicsContext::drawConvexPolygon):
(WebCore::GraphicsContext::drawEllipse):
(WebCore::GraphicsContext::drawFocusRing):
(WebCore::GraphicsContext::drawLine):
(WebCore::GraphicsContext::drawLineForTextChecking):
(WebCore::GraphicsContext::drawLineForText):
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::fillRoundedRect):
(WebCore::GraphicsContext::scale):
(WebCore::GraphicsContext::setAlpha):
(WebCore::GraphicsContext::setPlatformCompositeOperation):
(WebCore::GraphicsContext::setPlatformFillColor):
(WebCore::GraphicsContext::setPlatformShadow):
(WebCore::GraphicsContext::strokeArc):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::strokeRect):
(WebCore::GraphicsContext::rotate):
(WebCore::GraphicsContext::translate):
(WebCore::GraphicsContext::setSharedGraphicsContext3D):
(WebCore::GraphicsContext::syncSoftwareCanvas):

  • platform/graphics/skia/ImageBufferSkia.cpp:

(WebCore::ImageBuffer::copyImage):
(WebCore::ImageBuffer::draw):
(WebCore::ImageBuffer::getUnmultipliedImageData):
(WebCore::ImageBuffer::getPremultipliedImageData):
(WebCore::ImageBuffer::putUnmultipliedImageData):
(WebCore::ImageBuffer::putPremultipliedImageData):

  • platform/graphics/skia/ImageSkia.cpp:

(WebCore::BitmapImage::draw):
(WebCore::BitmapImageSingleFrameSkia::draw):

  • platform/graphics/skia/NativeImageSkia.cpp:

(WebCore::NativeImageSkia::~NativeImageSkia):

  • platform/graphics/skia/PlatformContextSkia.cpp:

(WebCore::PlatformContextSkia::PlatformContextSkia):
(WebCore::PlatformContextSkia::~PlatformContextSkia):
(WebCore::PlatformContextSkia::setSharedGraphicsContext3D):
(WebCore::PlatformContextSkia::makeGrContextCurrent):

  • platform/graphics/skia/PlatformContextSkia.h:

Source/WebKit/chromium:

Adds a way to stash a GrContext* on a GraphicsContext3D. Previously, this was handled by
SharedGraphicsContext3D, but we don't need that class any more. This is used only for the shared
GraphicsContext3D stashed on the Page and shared by all accelerated canvases within the Page, for WebGL and
compositor contexts the GrContext is never set.

  • src/GraphicsContext3DChromium.cpp:

(WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
(WebCore::GraphicsContext3DInternal::~GraphicsContext3DInternal):
(WebCore::GraphicsContext3DInternal::grContext):
(WebCore::GraphicsContext3D::grContext):

  • src/GraphicsContext3DInternal.h:
Location:
trunk/Source
Files:
12 deleted
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90869 r90872  
     12011-07-12  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Delete the unused legacy accelerated canvas 2d code
     4        https://bugs.webkit.org/show_bug.cgi?id=64214
     5
     6        Reviewed by Stephen White.
     7
     8        This removes the legacy accelerated canvas 2d path and support logic since we (chromium) are no longer using
     9        this codepath and it seems clear that no other port is interested.
     10
     11        Refactoring and removing unused code, so no new tests.
     12
     13        * WebCore.gypi:
     14        * WebCore.xcodeproj/project.pbxproj:
     15        * html/canvas/CanvasRenderingContext2D.cpp:
     16        (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
     17        (WebCore::CanvasRenderingContext2D::setGlobalCompositeOperation):
     18        (WebCore::CanvasRenderingContext2D::didDraw):
     19        * html/canvas/CanvasRenderingContext2D.h:
     20        * loader/EmptyClients.h:
     21        * page/ChromeClient.h:
     22        * page/Page.cpp:
     23        (WebCore::Page::sharedGraphicsContext3D):
     24        * page/Page.h:
     25        * platform/graphics/GraphicsContext.cpp:
     26        (WebCore::GraphicsContext::setSharedGraphicsContext3D):
     27        (WebCore::GraphicsContext::syncSoftwareCanvas):
     28        * platform/graphics/GraphicsContext.h:
     29        * platform/graphics/GraphicsContext3D.h:
     30        * platform/graphics/chromium/DrawingBufferChromium.cpp:
     31        (WebCore::DrawingBuffer::setGrContext):
     32        * platform/graphics/chromium/FontLinux.cpp:
     33        (WebCore::Font::drawGlyphs):
     34        * platform/graphics/chromium/cc/CCLayerSorter.cpp:
     35        (WebCore::pointInTriangle):
     36        * platform/graphics/gpu/BicubicShader.cpp: Removed.
     37        * platform/graphics/gpu/BicubicShader.h: Removed.
     38        * platform/graphics/gpu/ConvolutionShader.cpp: Removed.
     39        * platform/graphics/gpu/ConvolutionShader.h: Removed.
     40        * platform/graphics/gpu/GraphicsContextGPU.cpp: Removed.
     41        * platform/graphics/gpu/GraphicsContextGPU.h: Removed.
     42        * platform/graphics/gpu/SharedGraphicsContext3D.cpp: Removed.
     43        * platform/graphics/gpu/SharedGraphicsContext3D.h: Removed.
     44        * platform/graphics/gpu/SolidFillShader.cpp: Removed.
     45        * platform/graphics/gpu/SolidFillShader.h: Removed.
     46        * platform/graphics/gpu/TexShader.cpp: Removed.
     47        * platform/graphics/gpu/TexShader.h: Removed.
     48        * platform/graphics/skia/GraphicsContextSkia.cpp:
     49        (WebCore::GraphicsContext::savePlatformState):
     50        (WebCore::GraphicsContext::restorePlatformState):
     51        (WebCore::GraphicsContext::addInnerRoundedRectClip):
     52        (WebCore::GraphicsContext::clearRect):
     53        (WebCore::GraphicsContext::clip):
     54        (WebCore::GraphicsContext::canvasClip):
     55        (WebCore::GraphicsContext::clipOut):
     56        (WebCore::GraphicsContext::clipPath):
     57        (WebCore::GraphicsContext::concatCTM):
     58        (WebCore::GraphicsContext::setCTM):
     59        (WebCore::GraphicsContext::drawConvexPolygon):
     60        (WebCore::GraphicsContext::drawEllipse):
     61        (WebCore::GraphicsContext::drawFocusRing):
     62        (WebCore::GraphicsContext::drawLine):
     63        (WebCore::GraphicsContext::drawLineForTextChecking):
     64        (WebCore::GraphicsContext::drawLineForText):
     65        (WebCore::GraphicsContext::drawRect):
     66        (WebCore::GraphicsContext::fillPath):
     67        (WebCore::GraphicsContext::fillRect):
     68        (WebCore::GraphicsContext::fillRoundedRect):
     69        (WebCore::GraphicsContext::scale):
     70        (WebCore::GraphicsContext::setAlpha):
     71        (WebCore::GraphicsContext::setPlatformCompositeOperation):
     72        (WebCore::GraphicsContext::setPlatformFillColor):
     73        (WebCore::GraphicsContext::setPlatformShadow):
     74        (WebCore::GraphicsContext::strokeArc):
     75        (WebCore::GraphicsContext::strokePath):
     76        (WebCore::GraphicsContext::strokeRect):
     77        (WebCore::GraphicsContext::rotate):
     78        (WebCore::GraphicsContext::translate):
     79        (WebCore::GraphicsContext::setSharedGraphicsContext3D):
     80        (WebCore::GraphicsContext::syncSoftwareCanvas):
     81        * platform/graphics/skia/ImageBufferSkia.cpp:
     82        (WebCore::ImageBuffer::copyImage):
     83        (WebCore::ImageBuffer::draw):
     84        (WebCore::ImageBuffer::getUnmultipliedImageData):
     85        (WebCore::ImageBuffer::getPremultipliedImageData):
     86        (WebCore::ImageBuffer::putUnmultipliedImageData):
     87        (WebCore::ImageBuffer::putPremultipliedImageData):
     88        * platform/graphics/skia/ImageSkia.cpp:
     89        (WebCore::BitmapImage::draw):
     90        (WebCore::BitmapImageSingleFrameSkia::draw):
     91        * platform/graphics/skia/NativeImageSkia.cpp:
     92        (WebCore::NativeImageSkia::~NativeImageSkia):
     93        * platform/graphics/skia/PlatformContextSkia.cpp:
     94        (WebCore::PlatformContextSkia::PlatformContextSkia):
     95        (WebCore::PlatformContextSkia::~PlatformContextSkia):
     96        (WebCore::PlatformContextSkia::setSharedGraphicsContext3D):
     97        (WebCore::PlatformContextSkia::makeGrContextCurrent):
     98        * platform/graphics/skia/PlatformContextSkia.h:
     99
    11002011-07-12  Emil A Eklund  <eae@chromium.org>
    2101
  • trunk/Source/WebCore/WebCore.gypi

    r90859 r90872  
    42494249            'platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp',
    42504250            'platform/graphics/freetype/SimpleFontDataFreeType.cpp',
    4251             'platform/graphics/gpu/BicubicShader.cpp',
    4252             'platform/graphics/gpu/BicubicShader.h',
    4253             'platform/graphics/gpu/ConvolutionShader.cpp',
    4254             'platform/graphics/gpu/ConvolutionShader.h',
    42554251            'platform/graphics/gpu/DrawingBuffer.cpp',
    42564252            'platform/graphics/gpu/DrawingBuffer.h',
    4257             'platform/graphics/gpu/GraphicsContextGPU.cpp',
    4258             'platform/graphics/gpu/GraphicsContextGPU.h',
    4259             'platform/graphics/gpu/LoopBlinnClassifier.cpp',
    4260             'platform/graphics/gpu/LoopBlinnClassifier.h',
    4261             'platform/graphics/gpu/LoopBlinnConstants.h',
    4262             'platform/graphics/gpu/LoopBlinnLocalTriangulator.cpp',
    4263             'platform/graphics/gpu/LoopBlinnLocalTriangulator.h',
    4264             'platform/graphics/gpu/LoopBlinnMathUtils.cpp',
    4265             'platform/graphics/gpu/LoopBlinnMathUtils.h',
    4266             'platform/graphics/gpu/LoopBlinnPathCache.cpp',
    4267             'platform/graphics/gpu/LoopBlinnPathCache.h',
    4268             'platform/graphics/gpu/LoopBlinnPathProcessor.cpp',
    4269             'platform/graphics/gpu/LoopBlinnPathProcessor.h',
    4270             'platform/graphics/gpu/LoopBlinnShader.cpp',
    4271             'platform/graphics/gpu/LoopBlinnShader.h',
    4272             'platform/graphics/gpu/LoopBlinnSolidFillShader.cpp',
    4273             'platform/graphics/gpu/LoopBlinnSolidFillShader.h',
    4274             'platform/graphics/gpu/LoopBlinnTextureCoords.cpp',
    4275             'platform/graphics/gpu/LoopBlinnTextureCoords.h',
    4276             'platform/graphics/gpu/PODArena.h',
    4277             'platform/graphics/gpu/PODInterval.h',
    4278             'platform/graphics/gpu/PODIntervalTree.h',
    4279             'platform/graphics/gpu/PODRedBlackTree.h',
    42804253            'platform/graphics/gpu/Shader.cpp',
    42814254            'platform/graphics/gpu/Shader.h',
    4282             'platform/graphics/gpu/SharedGraphicsContext3D.cpp',
    4283             'platform/graphics/gpu/SharedGraphicsContext3D.h',
    4284             'platform/graphics/gpu/SolidFillShader.cpp',
    4285             'platform/graphics/gpu/SolidFillShader.h',
    4286             'platform/graphics/gpu/TexShader.cpp',
    4287             'platform/graphics/gpu/TexShader.h',
    42884255            'platform/graphics/gpu/Texture.cpp',
    42894256            'platform/graphics/gpu/Texture.h',
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r90863 r90872  
    10931093                498770DB1242C535002226BA /* DrawingBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498770C21242C535002226BA /* DrawingBuffer.cpp */; };
    10941094                498770DC1242C535002226BA /* DrawingBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770C31242C535002226BA /* DrawingBuffer.h */; };
    1095                 498770E41242C535002226BA /* PODArena.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770CB1242C535002226BA /* PODArena.h */; };
    1096                 498770E51242C535002226BA /* PODInterval.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770CC1242C535002226BA /* PODInterval.h */; };
    1097                 498770E61242C535002226BA /* PODIntervalTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770CD1242C535002226BA /* PODIntervalTree.h */; };
    1098                 498770E71242C535002226BA /* PODRedBlackTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770CE1242C535002226BA /* PODRedBlackTree.h */; };
    10991095                498770E81242C535002226BA /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498770CF1242C535002226BA /* Shader.cpp */; };
    11001096                498770E91242C535002226BA /* Shader.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770D01242C535002226BA /* Shader.h */; };
    1101                 498770EA1242C535002226BA /* SharedGraphicsContext3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498770D11242C535002226BA /* SharedGraphicsContext3D.cpp */; };
    1102                 498770EB1242C535002226BA /* SharedGraphicsContext3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770D21242C535002226BA /* SharedGraphicsContext3D.h */; };
    1103                 498770EC1242C535002226BA /* SolidFillShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498770D31242C535002226BA /* SolidFillShader.cpp */; };
    1104                 498770ED1242C535002226BA /* SolidFillShader.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770D41242C535002226BA /* SolidFillShader.h */; };
    1105                 498770EE1242C535002226BA /* TexShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498770D51242C535002226BA /* TexShader.cpp */; };
    1106                 498770EF1242C535002226BA /* TexShader.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770D61242C535002226BA /* TexShader.h */; };
    11071097                498770F01242C535002226BA /* Texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498770D71242C535002226BA /* Texture.cpp */; };
    11081098                498770F11242C535002226BA /* Texture.h in Headers */ = {isa = PBXBuildFile; fileRef = 498770D81242C535002226BA /* Texture.h */; };
     
    11181108                49A85B77138D58EE00ECB7B3 /* JSStreamEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49A85B75138D58EE00ECB7B3 /* JSStreamEvent.cpp */; };
    11191109                49A85B78138D58EE00ECB7B3 /* JSStreamEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 49A85B76138D58EE00ECB7B3 /* JSStreamEvent.h */; };
    1120                 49B69E5E1254FEED007D57EB /* LoopBlinnClassifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49B69E551254FEED007D57EB /* LoopBlinnClassifier.cpp */; };
    1121                 49B69E5F1254FEED007D57EB /* LoopBlinnClassifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 49B69E561254FEED007D57EB /* LoopBlinnClassifier.h */; };
    1122                 49B69E601254FEED007D57EB /* LoopBlinnConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 49B69E571254FEED007D57EB /* LoopBlinnConstants.h */; };
    1123                 49B69E631254FEED007D57EB /* LoopBlinnMathUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49B69E5A1254FEED007D57EB /* LoopBlinnMathUtils.cpp */; };
    1124                 49B69E641254FEED007D57EB /* LoopBlinnMathUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 49B69E5B1254FEED007D57EB /* LoopBlinnMathUtils.h */; };
    1125                 49B69E651254FEED007D57EB /* LoopBlinnTextureCoords.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49B69E5C1254FEED007D57EB /* LoopBlinnTextureCoords.cpp */; };
    1126                 49B69E661254FEED007D57EB /* LoopBlinnTextureCoords.h in Headers */ = {isa = PBXBuildFile; fileRef = 49B69E5D1254FEED007D57EB /* LoopBlinnTextureCoords.h */; };
    11271110                49C7B9931042D2D30009D447 /* JSWebGLBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49C7B9801042D2D30009D447 /* JSWebGLBuffer.cpp */; };
    11281111                49C7B9941042D2D30009D447 /* JSWebGLBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 49C7B9811042D2D30009D447 /* JSWebGLBuffer.h */; };
     
    76077590                498770C21242C535002226BA /* DrawingBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DrawingBuffer.cpp; path = gpu/DrawingBuffer.cpp; sourceTree = "<group>"; };
    76087591                498770C31242C535002226BA /* DrawingBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DrawingBuffer.h; path = gpu/DrawingBuffer.h; sourceTree = "<group>"; };
    7609                 498770CB1242C535002226BA /* PODArena.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PODArena.h; path = gpu/PODArena.h; sourceTree = "<group>"; };
    7610                 498770CC1242C535002226BA /* PODInterval.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PODInterval.h; path = gpu/PODInterval.h; sourceTree = "<group>"; };
    7611                 498770CD1242C535002226BA /* PODIntervalTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PODIntervalTree.h; path = gpu/PODIntervalTree.h; sourceTree = "<group>"; };
    7612                 498770CE1242C535002226BA /* PODRedBlackTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PODRedBlackTree.h; path = gpu/PODRedBlackTree.h; sourceTree = "<group>"; };
    76137592                498770CF1242C535002226BA /* Shader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Shader.cpp; path = gpu/Shader.cpp; sourceTree = "<group>"; };
    76147593                498770D01242C535002226BA /* Shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Shader.h; path = gpu/Shader.h; sourceTree = "<group>"; };
    7615                 498770D11242C535002226BA /* SharedGraphicsContext3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SharedGraphicsContext3D.cpp; path = gpu/SharedGraphicsContext3D.cpp; sourceTree = "<group>"; };
    7616                 498770D21242C535002226BA /* SharedGraphicsContext3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SharedGraphicsContext3D.h; path = gpu/SharedGraphicsContext3D.h; sourceTree = "<group>"; };
    7617                 498770D31242C535002226BA /* SolidFillShader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SolidFillShader.cpp; path = gpu/SolidFillShader.cpp; sourceTree = "<group>"; };
    7618                 498770D41242C535002226BA /* SolidFillShader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SolidFillShader.h; path = gpu/SolidFillShader.h; sourceTree = "<group>"; };
    7619                 498770D51242C535002226BA /* TexShader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TexShader.cpp; path = gpu/TexShader.cpp; sourceTree = "<group>"; };
    7620                 498770D61242C535002226BA /* TexShader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TexShader.h; path = gpu/TexShader.h; sourceTree = "<group>"; };
    76217594                498770D71242C535002226BA /* Texture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Texture.cpp; path = gpu/Texture.cpp; sourceTree = "<group>"; };
    76227595                498770D81242C535002226BA /* Texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Texture.h; path = gpu/Texture.h; sourceTree = "<group>"; };
     
    76337606                49A85B75138D58EE00ECB7B3 /* JSStreamEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStreamEvent.cpp; sourceTree = "<group>"; };
    76347607                49A85B76138D58EE00ECB7B3 /* JSStreamEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStreamEvent.h; sourceTree = "<group>"; };
    7635                 49B69E551254FEED007D57EB /* LoopBlinnClassifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LoopBlinnClassifier.cpp; path = gpu/LoopBlinnClassifier.cpp; sourceTree = "<group>"; };
    7636                 49B69E561254FEED007D57EB /* LoopBlinnClassifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LoopBlinnClassifier.h; path = gpu/LoopBlinnClassifier.h; sourceTree = "<group>"; };
    7637                 49B69E571254FEED007D57EB /* LoopBlinnConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LoopBlinnConstants.h; path = gpu/LoopBlinnConstants.h; sourceTree = "<group>"; };
    7638                 49B69E5A1254FEED007D57EB /* LoopBlinnMathUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LoopBlinnMathUtils.cpp; path = gpu/LoopBlinnMathUtils.cpp; sourceTree = "<group>"; };
    7639                 49B69E5B1254FEED007D57EB /* LoopBlinnMathUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LoopBlinnMathUtils.h; path = gpu/LoopBlinnMathUtils.h; sourceTree = "<group>"; };
    7640                 49B69E5C1254FEED007D57EB /* LoopBlinnTextureCoords.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LoopBlinnTextureCoords.cpp; path = gpu/LoopBlinnTextureCoords.cpp; sourceTree = "<group>"; };
    7641                 49B69E5D1254FEED007D57EB /* LoopBlinnTextureCoords.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LoopBlinnTextureCoords.h; path = gpu/LoopBlinnTextureCoords.h; sourceTree = "<group>"; };
    76427608                49C7B9801042D2D30009D447 /* JSWebGLBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLBuffer.cpp; sourceTree = "<group>"; };
    76437609                49C7B9811042D2D30009D447 /* JSWebGLBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLBuffer.h; sourceTree = "<group>"; };
     
    1390413870                                498770C21242C535002226BA /* DrawingBuffer.cpp */,
    1390513871                                498770C31242C535002226BA /* DrawingBuffer.h */,
    13906                                 49B69E551254FEED007D57EB /* LoopBlinnClassifier.cpp */,
    13907                                 49B69E561254FEED007D57EB /* LoopBlinnClassifier.h */,
    13908                                 49B69E571254FEED007D57EB /* LoopBlinnConstants.h */,
    13909                                 49B69E5A1254FEED007D57EB /* LoopBlinnMathUtils.cpp */,
    13910                                 49B69E5B1254FEED007D57EB /* LoopBlinnMathUtils.h */,
    13911                                 49B69E5C1254FEED007D57EB /* LoopBlinnTextureCoords.cpp */,
    13912                                 49B69E5D1254FEED007D57EB /* LoopBlinnTextureCoords.h */,
    13913                                 498770CB1242C535002226BA /* PODArena.h */,
    13914                                 498770CC1242C535002226BA /* PODInterval.h */,
    13915                                 498770CD1242C535002226BA /* PODIntervalTree.h */,
    13916                                 498770CE1242C535002226BA /* PODRedBlackTree.h */,
    1391713872                                498770CF1242C535002226BA /* Shader.cpp */,
    1391813873                                498770D01242C535002226BA /* Shader.h */,
    13919                                 498770D11242C535002226BA /* SharedGraphicsContext3D.cpp */,
    13920                                 498770D21242C535002226BA /* SharedGraphicsContext3D.h */,
    13921                                 498770D31242C535002226BA /* SolidFillShader.cpp */,
    13922                                 498770D41242C535002226BA /* SolidFillShader.h */,
    13923                                 498770D51242C535002226BA /* TexShader.cpp */,
    13924                                 498770D61242C535002226BA /* TexShader.h */,
    1392513874                                498770D71242C535002226BA /* Texture.cpp */,
    1392613875                                498770D81242C535002226BA /* Texture.h */,
     
    2212022069                                BCE1C41B0D982980003B02F2 /* Location.h in Headers */,
    2212122070                                A8239E0109B3CF8A00B60641 /* Logging.h in Headers */,
    22122                                 49B69E5F1254FEED007D57EB /* LoopBlinnClassifier.h in Headers */,
    22123                                 49B69E601254FEED007D57EB /* LoopBlinnConstants.h in Headers */,
    22124                                 49B69E641254FEED007D57EB /* LoopBlinnMathUtils.h in Headers */,
    22125                                 49B69E661254FEED007D57EB /* LoopBlinnTextureCoords.h in Headers */,
    2212622071                                FD31603912B0267600C1A359 /* LowPass2FilterNode.h in Headers */,
    2212722072                                656D37410ADBA5DE00A4554D /* MainResourceLoader.h in Headers */,
     
    2229922244                                1AA8799011CBE846003C664F /* PluginStrategy.h in Headers */,
    2230022245                                0AFDAC3D10F5448C00E1F3D2 /* PluginViewBase.h in Headers */,
    22301                                 498770E41242C535002226BA /* PODArena.h in Headers */,
    22302                                 498770E51242C535002226BA /* PODInterval.h in Headers */,
    22303                                 498770E61242C535002226BA /* PODIntervalTree.h in Headers */,
    22304                                 498770E71242C535002226BA /* PODRedBlackTree.h in Headers */,
    2230522246                                B2B1F7170D00CAA8004AEA64 /* PointerEventsHitRules.h in Headers */,
    2230622247                                84730D921248F0B300D3A9C9 /* PointLightSource.h in Headers */,
     
    2256622507                                1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */,
    2256722508                                97B1F02F13B025D200F5103F /* SharedBufferChunkReader.h in Headers */,
    22568                                 498770EB1242C535002226BA /* SharedGraphicsContext3D.h in Headers */,
    2256922509                                93309EA3099EB78C0056E581 /* SharedTimer.h in Headers */,
    2257022510                                41E1B1D40FF5986900576B3B /* SharedWorker.h in Headers */,
     
    2258522525                                510D4A38103165EE0049EA54 /* SocketStreamHandleClient.h in Headers */,
    2258622526                                0A4844990CA44CB200B7BD48 /* SoftLinking.h in Headers */,
    22587                                 498770ED1242C535002226BA /* SolidFillShader.h in Headers */,
    2258822527                                4B3043C70AE0370300A82647 /* Sound.h in Headers */,
    2258922528                                84A81F3E0FC7DFF000955300 /* SourceAlpha.h in Headers */,
     
    2291322852                                BCE3BEC30D222B1D007E06E4 /* TagNodeList.h in Headers */,
    2291422853                                F55B3DD61251F12D003EF269 /* TelephoneInputType.h in Headers */,
    22915                                 498770EF1242C535002226BA /* TexShader.h in Headers */,
    2291622854                                6550B6A6099DF0270090D781 /* Text.h in Headers */,
    2291722855                                93309E17099E64920056E581 /* TextAffinity.h in Headers */,
     
    2511025048                                A8239E0009B3CF8A00B60641 /* Logging.cpp in Sources */,
    2511125049                                1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */,
    25112                                 49B69E5E1254FEED007D57EB /* LoopBlinnClassifier.cpp in Sources */,
    25113                                 49B69E631254FEED007D57EB /* LoopBlinnMathUtils.cpp in Sources */,
    25114                                 49B69E651254FEED007D57EB /* LoopBlinnTextureCoords.cpp in Sources */,
    2511525050                                FD31603812B0267600C1A359 /* LowPass2FilterNode.cpp in Sources */,
    2511625051                                93E227E10AF589AD00D48324 /* MainResourceLoader.cpp in Sources */,
     
    2546325398                                97B1F02E13B025CA00F5103F /* SharedBufferChunkReader.cpp in Sources */,
    2546425399                                1A4A95520B4EDCFF002D8C3C /* SharedBufferMac.mm in Sources */,
    25465                                 498770EA1242C535002226BA /* SharedGraphicsContext3D.cpp in Sources */,
    2546625400                                93309EA2099EB78C0056E581 /* SharedTimerMac.mm in Sources */,
    2546725401                                41E1B1D30FF5986900576B3B /* SharedWorker.cpp in Sources */,
     
    2548225416                                510D4A36103165EE0049EA54 /* SocketStreamHandleBase.cpp in Sources */,
    2548325417                                51ABAE1F103C1913008C5260 /* SocketStreamHandleCFNet.cpp in Sources */,
    25484                                 498770EC1242C535002226BA /* SolidFillShader.cpp in Sources */,
    2548525418                                4B3043C90AE0371D00A82647 /* SoundMac.mm in Sources */,
    2548625419                                84A81F3D0FC7DFF000955300 /* SourceAlpha.cpp in Sources */,
     
    2572825661                                BCE3BEC20D222B1D007E06E4 /* TagNodeList.cpp in Sources */,
    2572925662                                F55B3DD51251F12D003EF269 /* TelephoneInputType.cpp in Sources */,
    25730                                 498770EE1242C535002226BA /* TexShader.cpp in Sources */,
    2573125663                                6550B6A5099DF0270090D781 /* Text.cpp in Sources */,
    2573225664                                372C00C4129611F1005C9575 /* TextBoundaries.cpp in Sources */,
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r90758 r90872  
    6767#include "DrawingBuffer.h"
    6868#include "FrameView.h"
    69 #include "GraphicsContext3D.h"
    70 #include "SharedGraphicsContext3D.h"
    7169#if USE(ACCELERATED_COMPOSITING)
    7270#include "RenderLayer.h"
     
    147145        m_context3D = p->sharedGraphicsContext3D();
    148146        if (m_context3D) {
    149             m_drawingBuffer = m_context3D->graphicsContext3D()->createDrawingBuffer(IntSize(canvas->width(), canvas->height()));
     147            m_drawingBuffer = m_context3D->createDrawingBuffer(IntSize(canvas->width(), canvas->height()));
    150148            if (!m_drawingBuffer) {
    151                 c->setSharedGraphicsContext3D(0, 0, IntSize());
     149                c->setGraphicsContext3D(0, 0, IntSize());
    152150                m_context3D.clear();
    153151            } else
    154                 c->setSharedGraphicsContext3D(m_context3D.get(), m_drawingBuffer.get(), IntSize(canvas->width(), canvas->height()));
     152                c->setGraphicsContext3D(m_context3D.get(), m_drawingBuffer.get(), IntSize(canvas->width(), canvas->height()));
    155153        }
    156154    }
     
    174172#if ENABLE(ACCELERATED_2D_CANVAS)
    175173    if (GraphicsContext* context = drawingContext())
    176         context->setSharedGraphicsContext3D(0, 0, IntSize());
     174        context->setGraphicsContext3D(0, 0, IntSize());
    177175#endif
    178176}
     
    209207        if (m_context3D && m_drawingBuffer) {
    210208            if (m_drawingBuffer->reset(IntSize(canvas()->width(), canvas()->height()))) {
    211                 c->setSharedGraphicsContext3D(m_context3D.get(), m_drawingBuffer.get(), IntSize(canvas()->width(), canvas()->height()));
     209                c->setGraphicsContext3D(m_context3D.get(), m_drawingBuffer.get(), IntSize(canvas()->width(), canvas()->height()));
    212210            } else {
    213                 c->setSharedGraphicsContext3D(0, 0, IntSize());
     211                c->setGraphicsContext3D(0, 0, IntSize());
    214212                m_drawingBuffer.clear();
    215213                m_context3D.clear();
     
    573571        return;
    574572    c->setCompositeOperation(op);
    575 #if ENABLE(ACCELERATED_2D_CANVAS)
    576     if (isAccelerated() && !m_context3D->supportsCompositeOp(op)) {
    577         c->setSharedGraphicsContext3D(0, 0, IntSize());
    578         m_drawingBuffer.clear();
    579         m_context3D.clear();
    580         // Mark as needing a style recalc so our compositing layer can be removed.
    581         canvas()->setNeedsStyleRecalc(SyntheticStyleChange);
    582     }
    583 #endif
    584573}
    585574
     
    16451634    }
    16461635
    1647 #if ENABLE(ACCELERATED_2D_CANVAS)
    1648     if (isAccelerated())
    1649         drawingContext()->markDirtyRect(enclosingIntRect(dirtyRect));
    1650 #endif
    16511636#if ENABLE(ACCELERATED_2D_CANVAS) && USE(ACCELERATED_COMPOSITING)
    16521637    // If we are drawing to hardware and we have a composited layer, just call contentChanged().
     
    20392024}
    20402025
    2041 void CanvasRenderingContext2D::paintRenderingResultsToCanvas()
    2042 {
    2043 #if ENABLE(ACCELERATED_2D_CANVAS)
    2044     if (GraphicsContext* c = drawingContext())
    2045         c->syncSoftwareCanvas();
    2046 #endif
    2047 }
    2048 
    20492026#if ENABLE(ACCELERATED_2D_CANVAS) && USE(ACCELERATED_COMPOSITING)
    20502027PlatformLayer* CanvasRenderingContext2D::platformLayer() const
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h

    r87735 r90872  
    5757#if ENABLE(ACCELERATED_2D_CANVAS)
    5858class DrawingBuffer;
    59 class SharedGraphicsContext3D;
     59class GraphicsContext3D;
    6060#endif
    6161
     
    219219    LineCap getLineCap() const { return state().m_lineCap; }
    220220    LineJoin getLineJoin() const { return state().m_lineJoin; }
    221 
    222     virtual void paintRenderingResultsToCanvas();
    223221
    224222#if ENABLE(ACCELERATED_2D_CANVAS) && USE(ACCELERATED_COMPOSITING)
     
    306304#if ENABLE(ACCELERATED_2D_CANVAS)
    307305    RefPtr<DrawingBuffer> m_drawingBuffer;
    308     RefPtr<SharedGraphicsContext3D> m_context3D;
     306    RefPtr<GraphicsContext3D> m_context3D;
    309307#endif
    310308};
  • trunk/Source/WebCore/loader/EmptyClients.h

    r90856 r90872  
    6363namespace WebCore {
    6464
    65 class SharedGraphicsContext3D;
     65class GraphicsContext3D;
    6666
    6767class EmptyPopupMenu : public PopupMenu {
  • trunk/Source/WebCore/page/ChromeClient.h

    r90856 r90872  
    6161    class PopupMenuClient;
    6262    class SecurityOrigin;
    63     class SharedGraphicsContext3D;
     63    class GraphicsContext3D;
    6464    class Widget;
    6565
  • trunk/Source/WebCore/page/Page.cpp

    r86644 r90872  
    7777
    7878#if ENABLE(ACCELERATED_2D_CANVAS)
    79 #include "SharedGraphicsContext3D.h"
     79#include "GraphicsContext3D.h"
    8080#endif
    8181
     
    753753}
    754754
    755 SharedGraphicsContext3D* Page::sharedGraphicsContext3D()
     755GraphicsContext3D* Page::sharedGraphicsContext3D()
    756756{
    757757#if ENABLE(ACCELERATED_2D_CANVAS)
    758     if (!m_sharedGraphicsContext3D)
    759 #if USE(SKIA)
    760         // Temporary code to postpone massive test rebaselining
    761         m_sharedGraphicsContext3D = SharedGraphicsContext3D::create(chrome(), settings()->legacyAccelerated2dCanvasEnabled() ? 0 : SharedGraphicsContext3D::UseSkiaGPU);
    762 #else
    763         m_sharedGraphicsContext3D = SharedGraphicsContext3D::create(chrome(), 0);
    764 #endif
     758    if (!m_sharedGraphicsContext3D) {
     759        GraphicsContext3D::Attributes attr;
     760        attr.depth = false;
     761        attr.stencil = true;
     762        attr.antialias = false;
     763        attr.canRecoverFromContextLoss = false; // Canvas contexts can not handle lost contexts.
     764        m_sharedGraphicsContext3D = GraphicsContext3D::create(attr, chrome());
     765    }
    765766    return m_sharedGraphicsContext3D.get();
    766767#else // !ENABLE(ACCELERATED_2D_CANVAS)
  • trunk/Source/WebCore/page/Page.h

    r86391 r90872  
    8282    class ScrollableArea;
    8383    class Settings;
    84     class SharedGraphicsContext3D;
     84    class GraphicsContext3D;
    8585    class SpeechInput;
    8686    class SpeechInputClient;
     
    267267        static void visitedStateChanged(PageGroup*, LinkHash visitedHash);
    268268
    269         SharedGraphicsContext3D* sharedGraphicsContext3D();
     269        GraphicsContext3D* sharedGraphicsContext3D();
    270270
    271271#if ENABLE(DOM_STORAGE)
     
    326326
    327327#if ENABLE(ACCELERATED_2D_CANVAS)
    328         RefPtr<SharedGraphicsContext3D> m_sharedGraphicsContext3D;
     328        RefPtr<GraphicsContext3D> m_sharedGraphicsContext3D;
    329329#endif
    330330       
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r90832 r90872  
    686686
    687687#if !USE(SKIA)
    688 void GraphicsContext::setSharedGraphicsContext3D(SharedGraphicsContext3D*, DrawingBuffer*, const IntSize&)
    689 {
    690 }
    691 
    692 void GraphicsContext::syncSoftwareCanvas()
    693 {
    694 }
    695 
    696 void GraphicsContext::markDirtyRect(const IntRect&)
     688void GraphicsContext::setGraphicsContext3D(GraphicsContext3D*, DrawingBuffer*, const IntSize&)
    697689{
    698690}
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r90832 r90872  
    129129    class RoundedRect;
    130130    class KURL;
    131     class SharedGraphicsContext3D;
     131    class GraphicsContext3D;
    132132    class TextRun;
    133133
     
    513513#endif
    514514
    515         void setSharedGraphicsContext3D(SharedGraphicsContext3D*, DrawingBuffer*, const IntSize&);
    516         void syncSoftwareCanvas();
    517         void markDirtyRect(const IntRect&); // Hints that a portion of the backing store is dirty.
     515        void setGraphicsContext3D(GraphicsContext3D*, DrawingBuffer*, const IntSize&);
    518516
    519517        static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, StrokeStyle);
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r89827 r90872  
    7171#else
    7272typedef void* PlatformGraphicsContext3D;
     73#endif
     74
     75#if PLATFORM(CHROMIUM) && USE(SKIA)
     76class GrContext;
    7377#endif
    7478
     
    465469    PlatformGraphicsContext3D platformGraphicsContext3D() const;
    466470    Platform3DObject platformTexture() const;
     471#if USE(SKIA)
     472    GrContext* grContext();
     473#endif
    467474#if USE(ACCELERATED_COMPOSITING)
    468475    PlatformLayer* platformLayer() const;
  • trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp

    r87987 r90872  
    3535#include "Extensions3DChromium.h"
    3636#include "GraphicsContext3D.h"
    37 #include "SharedGraphicsContext3D.h"
    3837
    3938#if USE(SKIA)
     
    162161{
    163162    // We just take a ptr without referencing it, as we require that we never outlive
    164     // the SharedGraphicsContext3D object that is giving us the context.
     163    // the GraphicsContext3D object that is giving us the context.
    165164    m_grContext = context;
    166165}
  • trunk/Source/WebCore/platform/graphics/chromium/FontLinux.cpp

    r89988 r90872  
    111111    }
    112112
    113     gc->platformContext()->prepareForSoftwareDraw();
     113    gc->platformContext()->makeGrContextCurrent();
    114114
    115115    SkCanvas* canvas = gc->platformContext()->canvas();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerSorter.cpp

    r85814 r90872  
    2727#include "cc/CCLayerSorter.h"
    2828
    29 #include "LoopBlinnMathUtils.h"
    3029#include "RenderSurfaceChromium.h"
    3130#include "TransformationMatrix.h"
     
    4746namespace WebCore {
    4847
    49 using LoopBlinnMathUtils::pointInTriangle;
     48static bool pointInTriangle(const FloatPoint& point,
     49                            const FloatPoint& a,
     50                            const FloatPoint& b,
     51                            const FloatPoint& c)
     52{
     53    // Algorithm from http://www.blackpawn.com/texts/pointinpoly/default.html
     54    float x0 = c.x() - a.x();
     55    float y0 = c.y() - a.y();
     56    float x1 = b.x() - a.x();
     57    float y1 = b.y() - a.y();
     58    float x2 = point.x() - a.x();
     59    float y2 = point.y() - a.y();
     60
     61    float dot00 = x0 * x0 + y0 * y0;
     62    float dot01 = x0 * x1 + y0 * y1;
     63    float dot02 = x0 * x2 + y0 * y2;
     64    float dot11 = x1 * x1 + y1 * y1;
     65    float dot12 = x1 * x2 + y1 * y2;
     66    float denominator = dot00 * dot11 - dot01 * dot01;
     67    if (!denominator)
     68        // Triangle is zero-area. Treat query point as not being inside.
     69        return false;
     70    // Compute
     71    float inverseDenominator = 1.0f / denominator;
     72    float u = (dot11 * dot02 - dot01 * dot12) * inverseDenominator;
     73    float v = (dot00 * dot12 - dot01 * dot02) * inverseDenominator;
     74
     75    return (u > 0.0f) && (v > 0.0f) && (u + v < 1.0f);
     76}
    5077
    5178inline static float perpProduct(const FloatSize& u, const FloatSize& v)
  • trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp

    r90369 r90872  
    9292    }
    9393
    94     m_context->deleteFramebuffer(m_fbo);
    95     m_fbo = 0;
     94    if (m_fbo) {
     95        m_context->deleteFramebuffer(m_fbo);
     96        m_fbo = 0;
     97    }
    9698}
    9799
  • trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

    r90767 r90872  
    3636#include "FloatRect.h"
    3737#include "Gradient.h"
    38 #include "GraphicsContextGPU.h"
    3938#include "ImageBuffer.h"
    4039#include "IntRect.h"
     
    251250        return;
    252251
    253     if (platformContext()->useGPU())
    254         platformContext()->gpuCanvas()->save();
    255 
    256252    // Save our private State.
    257253    platformContext()->save();
     
    262258    if (paintingDisabled())
    263259        return;
    264 
    265     if (platformContext()->useGPU())
    266         platformContext()->gpuCanvas()->restore();
    267260
    268261    // Restore our private State.
     
    304297        return;
    305298
    306     platformContext()->prepareForSoftwareDraw();
     299    platformContext()->makeGrContextCurrent();
    307300    SkPath path;
    308301    path.addOval(r, SkPath::kCW_Direction);
     
    330323        return;
    331324
    332     if (platformContext()->useGPU() && !platformContext()->canvasClipApplied()) {
    333         platformContext()->prepareForHardwareDraw();
    334         platformContext()->gpuCanvas()->clearRect(rect);
    335         return;
    336     }
    337 
    338     // Force a readback here (if we're using the GPU), since clearRect() is
    339     // incompatible with mixed-mode rendering.
    340     platformContext()->syncSoftwareCanvas();
    341 
    342325    SkRect r = rect;
    343326    if (!isRectSkiaSafe(getCTM(), r))
     
    359342        return;
    360343
    361     platformContext()->prepareForSoftwareDraw();
     344    platformContext()->makeGrContextCurrent();
    362345    platformContext()->canvas()->clipRect(r);
    363346}
     
    372355        return;
    373356
    374     platformContext()->prepareForSoftwareDraw();
     357    platformContext()->makeGrContextCurrent();
    375358    platformContext()->clipPathAntiAliased(p);
    376359}
     
    380363    if (paintingDisabled())
    381364        return;
    382 
    383     if (platformContext()->useGPU())
    384         platformContext()->gpuCanvas()->clipPath(path);
    385365
    386366    const SkPath& p = *path.platformPath();
     
    408388        return;
    409389
    410     if (platformContext()->useGPU())
    411         platformContext()->gpuCanvas()->clipOut(p);
    412 
    413390    const SkPath& path = *p.platformPath();
    414391    if (!isPathSkiaSafe(getCTM(), path))
     
    423400        return;
    424401
    425     if (platformContext()->useGPU())
    426         platformContext()->gpuCanvas()->clipPath(pathToClip);
    427 
    428402    SkPath path = *pathToClip.platformPath();
    429403    if (!isPathSkiaSafe(getCTM(), path))
     
    439413        return;
    440414
    441     if (platformContext()->useGPU())
    442         platformContext()->gpuCanvas()->concatCTM(affine);
    443 
    444415    platformContext()->canvas()->concat(affine);
    445416}
     
    449420    if (paintingDisabled())
    450421        return;
    451 
    452     if (platformContext()->useGPU())
    453         platformContext()->gpuCanvas()->setCTM(affine);
    454422
    455423    platformContext()->canvas()->setMatrix(affine);
     
    478446        return;
    479447
    480     platformContext()->prepareForSoftwareDraw();
     448    platformContext()->makeGrContextCurrent();
    481449
    482450    SkPath path;
     
    521489        return;
    522490
    523     platformContext()->prepareForSoftwareDraw();
     491    platformContext()->makeGrContextCurrent();
    524492    SkPaint paint;
    525493    platformContext()->setupPaintForFilling(&paint);
     
    578546        return;
    579547
    580     platformContext()->prepareForSoftwareDraw();
     548    platformContext()->makeGrContextCurrent();
    581549    SkRegion focusRingRegion;
    582550    const SkScalar focusRingOutset = getFocusRingOutset(width);
     
    613581        return;
    614582
    615     platformContext()->prepareForSoftwareDraw();
     583    platformContext()->makeGrContextCurrent();
    616584
    617585    FloatPoint p1 = point1;
     
    659627        return;
    660628
    661     platformContext()->prepareForSoftwareDraw();
     629    platformContext()->makeGrContextCurrent();
    662630
    663631    // Create the pattern we'll use to draw the underline.
     
    741709        return;
    742710
    743     platformContext()->prepareForSoftwareDraw();
     711    platformContext()->makeGrContextCurrent();
    744712
    745713    int thickness = SkMax32(static_cast<int>(strokeThickness()), 1);
     
    763731        return;
    764732
    765     platformContext()->prepareForSoftwareDraw();
     733    platformContext()->makeGrContextCurrent();
    766734
    767735    SkRect r = rect;
     
    779747        return;
    780748
    781     // FIXME: add support to GraphicsContextGPU for more than just solid fills.
    782     if (platformContext()->useGPU() && platformContext()->canAccelerate()) {
    783         platformContext()->prepareForHardwareDraw();
    784         platformContext()->gpuCanvas()->fillPath(pathToFill);
    785         return;
    786     }
    787 
    788749    SkPath path = *pathToFill.platformPath();
    789750    if (!isPathSkiaSafe(getCTM(), path))
    790751      return;
    791752
    792     platformContext()->prepareForSoftwareDraw();
     753    platformContext()->makeGrContextCurrent();
    793754
    794755    const GraphicsContextState& state = m_state;
     
    813774    }
    814775
    815     if (platformContext()->useGPU() && platformContext()->canAccelerate()) {
    816         platformContext()->prepareForHardwareDraw();
    817         platformContext()->gpuCanvas()->fillRect(rect);
    818         return;
    819     }
    820 
    821776    platformContext()->save();
    822777
    823     platformContext()->prepareForSoftwareDraw();
     778    platformContext()->makeGrContextCurrent();
    824779
    825780    SkPaint paint;
     
    835790        return;
    836791
    837     if (platformContext()->useGPU() && platformContext()->canAccelerate()) {
    838         platformContext()->prepareForHardwareDraw();
    839         platformContext()->gpuCanvas()->fillRect(rect, color, colorSpace);
    840         return;
    841     }
    842 
    843     platformContext()->prepareForSoftwareDraw();
     792    platformContext()->makeGrContextCurrent();
    844793
    845794    SkRect r = rect;
     
    875824        return;
    876825
    877     platformContext()->prepareForSoftwareDraw();
     826    platformContext()->makeGrContextCurrent();
    878827
    879828    SkRect r = rect;
     
    926875        return;
    927876
    928     if (platformContext()->useGPU())
    929         platformContext()->gpuCanvas()->scale(size);
    930 
    931877    platformContext()->canvas()->scale(WebCoreFloatToSkScalar(size.width()),
    932878        WebCoreFloatToSkScalar(size.height()));
     
    938884        return;
    939885
    940     if (platformContext()->useGPU())
    941         platformContext()->gpuCanvas()->setAlpha(alpha);
    942 
    943886    platformContext()->setAlpha(alpha);
    944887}
     
    948891    if (paintingDisabled())
    949892        return;
    950 
    951     if (platformContext()->useGPU())
    952         platformContext()->gpuCanvas()->setCompositeOperation(op);
    953893
    954894    platformContext()->setXfermodeMode(WebCoreCompositeToSkiaComposite(op));
     
    1044984        return;
    1045985
    1046     if (platformContext()->useGPU())
    1047         platformContext()->gpuCanvas()->setFillColor(color, colorSpace);
    1048 
    1049986    platformContext()->setFillColor(color.rgb());
    1050987}
     
    1057994    if (paintingDisabled())
    1058995        return;
    1059 
    1060     if (platformContext()->useGPU()) {
    1061         GraphicsContextGPU* canvas = platformContext()->gpuCanvas();
    1062         canvas->setShadowOffset(size);
    1063         canvas->setShadowBlur(blurFloat);
    1064         canvas->setShadowColor(color, colorSpace);
    1065         canvas->setShadowsIgnoreTransforms(m_state.shadowsIgnoreTransforms);
    1066     }
    1067996
    1068997    // Detect when there's no effective shadow and clear the looper.
     
    11841113        return;
    11851114
    1186     platformContext()->prepareForSoftwareDraw();
     1115    platformContext()->makeGrContextCurrent();
    11871116
    11881117    SkPaint paint;
     
    12171146        return;
    12181147
    1219     platformContext()->prepareForSoftwareDraw();
     1148    platformContext()->makeGrContextCurrent();
    12201149
    12211150    SkPaint paint;
     
    12321161        return;
    12331162
    1234     platformContext()->prepareForSoftwareDraw();
     1163    platformContext()->makeGrContextCurrent();
    12351164
    12361165    SkPaint paint;
     
    12621191        return;
    12631192
    1264     if (platformContext()->useGPU())
    1265         platformContext()->gpuCanvas()->rotate(angleInRadians);
    1266 
    12671193    platformContext()->canvas()->rotate(WebCoreFloatToSkScalar(
    12681194        angleInRadians * (180.0f / 3.14159265f)));
     
    12741200        return;
    12751201
    1276     if (platformContext()->useGPU())
    1277         platformContext()->gpuCanvas()->translate(w, h);
    1278 
    12791202    platformContext()->canvas()->translate(WebCoreFloatToSkScalar(w),
    12801203                                           WebCoreFloatToSkScalar(h));
    12811204}
    12821205
    1283 void GraphicsContext::syncSoftwareCanvas()
    1284 {
    1285     platformContext()->syncSoftwareCanvas();
    1286 }
    1287 
    1288 void GraphicsContext::setSharedGraphicsContext3D(SharedGraphicsContext3D* context, DrawingBuffer* framebuffer, const IntSize& size)
    1289 {
    1290     platformContext()->setSharedGraphicsContext3D(context, framebuffer, size);
    1291 }
    1292 
    1293 void GraphicsContext::markDirtyRect(const IntRect& rect)
    1294 {
    1295     platformContext()->markDirtyRect(rect);
     1206void GraphicsContext::setGraphicsContext3D(GraphicsContext3D* context, DrawingBuffer* framebuffer, const IntSize& size)
     1207{
     1208    platformContext()->setGraphicsContext3D(context, framebuffer, size);
    12961209}
    12971210
  • trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp

    r90847 r90872  
    3939#include "DrawingBuffer.h"
    4040#include "GraphicsContext.h"
    41 #include "GraphicsContextGPU.h"
    4241#include "ImageData.h"
    4342#include "JPEGImageEncoder.h"
     
    106105PassRefPtr<Image> ImageBuffer::copyImage() const
    107106{
    108     m_context->platformContext()->syncSoftwareCanvas();
     107    m_context->platformContext()->makeGrContextCurrent();
    109108    return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), true);
    110109}
     
    118117                       CompositeOperator op, bool useLowQualityScale)
    119118{
    120     if (m_data.m_platformContext.useGPU() && context->platformContext()->useGPU()) {
    121         if (context->platformContext()->canAccelerate()) {
    122             m_data.m_platformContext.prepareForHardwareDraw();
    123             DrawingBuffer* sourceDrawingBuffer = m_data.m_platformContext.gpuCanvas()->drawingBuffer();
    124             unsigned sourceTexture = static_cast<unsigned>(sourceDrawingBuffer->platformColorBuffer());
    125             FloatRect destRectNormalized(normalizeRect(destRect));
    126             FloatRect srcRectFlipped(normalizeRect(srcRect));
    127             srcRectFlipped.setY(m_size.height() - srcRect.y());
    128             srcRectFlipped.setHeight(-srcRect.height());
    129             context->platformContext()->prepareForHardwareDraw();
    130             context->platformContext()->gpuCanvas()->drawTexturedRect(sourceTexture, m_size, srcRectFlipped, destRectNormalized, styleColorSpace, op);
    131             return;
    132         }
    133         m_data.m_platformContext.syncSoftwareCanvas();
    134     }
    135 
     119    context->platformContext()->makeGrContextCurrent();
    136120    RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context);
    137121    context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale);
     
    141125                              const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
    142126{
     127    context->platformContext()->makeGrContextCurrent();
    143128    RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context);
    144129    image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
     
    257242PassRefPtr<ByteArray> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const
    258243{
    259     context()->platformContext()->syncSoftwareCanvas();
     244    m_context->platformContext()->makeGrContextCurrent();
    260245    return getImageData<Unmultiplied>(rect, *context()->platformContext()->canvas()->getDevice(), m_size);
    261246}
     
    263248PassRefPtr<ByteArray> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const
    264249{
    265     context()->platformContext()->syncSoftwareCanvas();
     250    m_context->platformContext()->makeGrContextCurrent();
    266251    return getImageData<Premultiplied>(rect, *context()->platformContext()->canvas()->getDevice(), m_size);
    267252}
     
    338323void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint)
    339324{
    340     context()->platformContext()->syncSoftwareCanvas();
     325    m_context->platformContext()->makeGrContextCurrent();
    341326    putImageData<Unmultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas()->getDevice(), m_size);
    342327}
     
    344329void ImageBuffer::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint)
    345330{
    346     context()->platformContext()->syncSoftwareCanvas();
     331    m_context->platformContext()->makeGrContextCurrent();
    347332    putImageData<Premultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas()->getDevice(), m_size);
    348333}
  • trunk/Source/WebCore/platform/graphics/skia/ImageSkia.cpp

    r85422 r90872  
    3737#include "FloatRect.h"
    3838#include "GraphicsContext.h"
    39 #include "GraphicsContextGPU.h"
    4039#include "Logging.h"
    4140#include "NativeImageSkia.h"
     
    424423}
    425424
    426 static void drawBitmapGLES2(GraphicsContext* ctxt, NativeImageSkia* bitmap, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace styleColorSpace, CompositeOperator compositeOp)
    427 {
    428     ctxt->platformContext()->prepareForHardwareDraw();
    429     GraphicsContextGPU* gpuCanvas = ctxt->platformContext()->gpuCanvas();
    430     Texture* texture = gpuCanvas->getTexture(bitmap);
    431     if (!texture) {
    432         ASSERT(bitmap->config() == SkBitmap::kARGB_8888_Config);
    433         ASSERT(bitmap->rowBytes() == bitmap->width() * 4);
    434         texture = gpuCanvas->createTexture(bitmap, Texture::BGRA8, bitmap->width(), bitmap->height());
    435         SkAutoLockPixels lock(*bitmap);
    436         ASSERT(bitmap->getPixels());
    437         texture->load(bitmap->getPixels());
    438     }
    439     gpuCanvas->drawTexturedRect(texture, srcRect, dstRect, styleColorSpace, compositeOp);
    440 }
    441 
    442425// ================================================
    443426// BitmapImage Class
     
    500483        return;  // Nothing to draw.
    501484
    502     if (ctxt->platformContext()->useGPU() && ctxt->platformContext()->canAccelerate()) {
    503         drawBitmapGLES2(ctxt, bm, normSrcRect, normDstRect, colorSpace, compositeOp);
    504         return;
    505     }
    506 
    507     ctxt->platformContext()->prepareForSoftwareDraw();
     485    ctxt->platformContext()->makeGrContextCurrent();
    508486
    509487    paintSkBitmap(ctxt->platformContext(),
     
    528506        return;  // Nothing to draw.
    529507
    530     if (ctxt->platformContext()->useGPU() && ctxt->platformContext()->canAccelerate()) {
    531         drawBitmapGLES2(ctxt, &m_nativeImage, srcRect, dstRect, styleColorSpace, compositeOp);
    532         return;
    533     }
    534 
    535     ctxt->platformContext()->prepareForSoftwareDraw();
     508    ctxt->platformContext()->makeGrContextCurrent();
    536509
    537510    paintSkBitmap(ctxt->platformContext(),
  • trunk/Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp

    r67412 r90872  
    3434
    3535#include "NativeImageSkia.h"
    36 #include "SharedGraphicsContext3D.h"
     36#include "GraphicsContext3D.h"
    3737#include "SkiaUtils.h"
    3838
     
    5757NativeImageSkia::~NativeImageSkia()
    5858{
    59     SharedGraphicsContext3D::removeTexturesFor(this);
    6059}
    6160
  • trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp

    r90767 r90872  
    5858#include <wtf/Vector.h>
    5959
    60 #if ENABLE(ACCELERATED_2D_CANVAS)
    61 #include "GraphicsContextGPU.h"
    62 #include "SharedGraphicsContext3D.h"
    63 #endif
    64 
    6560namespace WebCore {
    6661
     
    111106    WTF::Vector<SkPath> m_antiAliasClipPaths;
    112107    InterpolationQuality m_interpolationQuality;
    113 
    114     // If we currently have a canvas (non-antialiased path) clip applied.
    115     bool m_canvasClipApplied;
    116108
    117109    PlatformContextSkia::State cloneInheritedProperties();
     
    138130    , m_textDrawingMode(TextModeFill)
    139131    , m_interpolationQuality(InterpolationHigh)
    140     , m_canvasClipApplied(false)
    141132{
    142133}
     
    161152    , m_antiAliasClipPaths(other.m_antiAliasClipPaths)
    162153    , m_interpolationQuality(other.m_interpolationQuality)
    163     , m_canvasClipApplied(other.m_canvasClipApplied)
    164154{
    165155    // Up the ref count of these. SkSafeRef does nothing if its argument is 0.
     
    204194    , m_printing(false)
    205195    , m_drawingToImageBuffer(false)
    206     , m_accelerationMode(NoAcceleration)
    207     , m_backingStoreState(None)
     196    , m_gpuContext(0)
    208197{
    209198    m_stateStack.append(State());
     
    216205PlatformContextSkia::~PlatformContextSkia()
    217206{
    218 #if ENABLE(ACCELERATED_2D_CANVAS)
    219     if (m_gpuCanvas) {
    220         // make sure everything related to this platform context has been flushed
    221         if (useSkiaGPU()) {
    222             SharedGraphicsContext3D* context = m_gpuCanvas->context();
    223             context->makeContextCurrent();
    224             context->grContext()->flush(0);
    225         }
    226         m_gpuCanvas->drawingBuffer()->setWillPublishCallback(nullptr);
    227     }
    228 #endif
    229207}
    230208
     
    560538void PlatformContextSkia::canvasClipPath(const SkPath& path)
    561539{
    562     m_state->m_canvasClipApplied = true;
    563540    m_canvas->clipPath(path);
    564541}
     
    598575    return false;
    599576#else
    600     if (m_accelerationMode == SkiaGPU)
     577    if (useSkiaGPU())
    601578        return false;
    602579    return skia::SupportsPlatformPaint(m_canvas);
     
    675652}
    676653
    677 bool PlatformContextSkia::canAccelerate() const
    678 {
    679     // Can't accelerate with a fill gradient or pattern.
    680     const GraphicsContextState& state = m_gc->state();
    681     return !state.fillGradient.get() && !state.fillPattern.get();
    682 }
    683 
    684 bool PlatformContextSkia::canvasClipApplied() const
    685 {
    686     return m_state->m_canvasClipApplied;
    687 }
    688 
    689 class WillPublishCallbackImpl : public DrawingBuffer::WillPublishCallback {
    690 public:
    691     static PassOwnPtr<WillPublishCallback> create(PlatformContextSkia* pcs)
    692     {
    693         return adoptPtr(new WillPublishCallbackImpl(pcs));
    694     }
    695 
    696     virtual void willPublish()
    697     {
    698         m_pcs->prepareForHardwareDraw();
    699     }
    700 
    701 private:
    702     explicit WillPublishCallbackImpl(PlatformContextSkia* pcs)
    703         : m_pcs(pcs)
    704     {
    705     }
    706 
    707     PlatformContextSkia* m_pcs;
    708 };
    709 
    710 void PlatformContextSkia::setSharedGraphicsContext3D(SharedGraphicsContext3D* context, DrawingBuffer* drawingBuffer, const WebCore::IntSize& size)
    711 {
    712     m_accelerationMode = NoAcceleration;
     654void PlatformContextSkia::setGraphicsContext3D(GraphicsContext3D* context, DrawingBuffer* drawingBuffer, const WebCore::IntSize& size)
     655{
     656    m_gpuContext = context;
    713657#if ENABLE(ACCELERATED_2D_CANVAS)
    714658    if (context && drawingBuffer) {
    715         m_gpuCanvas = adoptPtr(new GraphicsContextGPU(context, drawingBuffer, size));
    716         m_uploadTexture.clear();
    717         drawingBuffer->setWillPublishCallback(WillPublishCallbackImpl::create(this));
    718 
    719659        // use skia gpu rendering if available
    720660        GrContext* gr = context->grContext();
    721661        if (gr) {
    722             m_accelerationMode = SkiaGPU;
    723 
    724662            context->makeContextCurrent();
    725             m_gpuCanvas->bindFramebuffer();
     663            drawingBuffer->bind();
    726664
    727665            gr->resetContext();
     
    733671            m_canvas->setDevice(new SkGpuDevice(gr, drawBufTex.get()))->unref();
    734672        } else
    735             m_accelerationMode = GPU;
    736     } else {
    737         syncSoftwareCanvas();
    738         m_uploadTexture.clear();
    739         m_gpuCanvas.clear();
     673            m_gpuContext = 0;
    740674    }
    741675#endif
    742676}
    743677
    744 void PlatformContextSkia::prepareForSoftwareDraw() const
    745 {
    746     if (m_accelerationMode == SkiaGPU) {
    747 #if ENABLE(ACCELERATED_2D_CANVAS)
    748         if (m_gpuCanvas)
    749             m_gpuCanvas->context()->makeContextCurrent();
    750 #endif
    751         return;
    752     }
    753 
    754     if (m_backingStoreState == Hardware) {
    755         // Depending on the blend mode we need to do one of a few things:
    756 
    757         // * For associative blend modes, we can draw into an initially empty
    758         // canvas and then composite the results on top of the hardware drawn
    759         // results before the next hardware draw or swapBuffers().
    760 
    761         // * For non-associative blend modes we have to do a readback and then
    762         // software draw.  When we re-upload in this mode we have to blow
    763         // away whatever is in the hardware backing store (do a copy instead
    764         // of a compositing operation).
    765 
    766         if (m_state->m_xferMode == SkXfermode::kSrcOver_Mode) {
    767             // Note that we have rendering results in both the hardware and software backing stores.
    768             m_backingStoreState = Mixed;
    769         } else {
    770             readbackHardwareToSoftware();
    771             // When we switch back to hardware copy the results, don't composite.
    772             m_backingStoreState = Software;
    773         }
    774     } else if (m_backingStoreState == Mixed) {
    775         if (m_state->m_xferMode != SkXfermode::kSrcOver_Mode) {
    776             // Have to composite our currently software drawn data...
    777             uploadSoftwareToHardware(CompositeSourceOver);
    778             // then do a readback so we can hardware draw stuff.
    779             readbackHardwareToSoftware();
    780             m_backingStoreState = Software;
    781         }
    782     } else if (m_backingStoreState == None) {
    783         m_backingStoreState = Software;
    784     }
    785 }
    786 
    787 void PlatformContextSkia::prepareForHardwareDraw() const
    788 {
    789     if (!(m_accelerationMode == GPU))
    790         return;
    791 
    792     if (m_backingStoreState == Software) {
    793         // Last drawn in software; upload everything we've drawn.
    794         uploadSoftwareToHardware(CompositeCopy);
    795     } else if (m_backingStoreState == Mixed) {
    796         // Stuff in software/hardware, composite the software stuff on top of
    797         // the hardware stuff.
    798         uploadSoftwareToHardware(CompositeSourceOver);
    799     }
    800     m_backingStoreState = Hardware;
    801 }
    802 
    803 void PlatformContextSkia::syncSoftwareCanvas() const
    804 {
    805     if (m_accelerationMode == SkiaGPU) {
    806 #if ENABLE(ACCELERATED_2D_CANVAS)
    807         if (m_gpuCanvas)
    808             m_gpuCanvas->context()->makeContextCurrent();
    809 #endif
    810         return;
    811     }
    812 
    813     if (m_backingStoreState == Hardware)
    814         readbackHardwareToSoftware();
    815     else if (m_backingStoreState == Mixed) {
    816         // Have to composite our currently software drawn data..
    817         uploadSoftwareToHardware(CompositeSourceOver);
    818         // then do a readback.
    819         readbackHardwareToSoftware();
    820         m_backingStoreState = Software;
    821     }
    822     m_backingStoreState = Software;
    823 }
    824 
    825 void PlatformContextSkia::markDirtyRect(const IntRect& rect)
    826 {
    827     if (m_accelerationMode != GPU)
    828         return;
    829 
    830     switch (m_backingStoreState) {
    831     case Software:
    832     case Mixed:
    833         m_softwareDirtyRect.unite(rect);
    834         return;
    835     case Hardware:
    836         return;
    837     default:
    838         ASSERT_NOT_REACHED();
    839     }
    840 }
    841 
    842 void PlatformContextSkia::uploadSoftwareToHardware(CompositeOperator op) const
    843 {
    844 #if ENABLE(ACCELERATED_2D_CANVAS)
    845     const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(false);
    846     SkAutoLockPixels lock(bitmap);
    847     SharedGraphicsContext3D* context = m_gpuCanvas->context();
    848     if (!m_uploadTexture || m_uploadTexture->tiles().totalSizeX() < bitmap.width() || m_uploadTexture->tiles().totalSizeY() < bitmap.height())
    849         m_uploadTexture = context->createTexture(Texture::BGRA8, bitmap.width(), bitmap.height());
    850 
    851     m_uploadTexture->updateSubRect(bitmap.getPixels(), m_softwareDirtyRect);
    852     AffineTransform identity;
    853     gpuCanvas()->drawTexturedRect(m_uploadTexture.get(), m_softwareDirtyRect, m_softwareDirtyRect, identity, 1.0, ColorSpaceDeviceRGB, op, false);
    854     // Clear out the region of the software canvas we just uploaded.
    855     m_canvas->save();
    856     m_canvas->resetMatrix();
    857     SkRect bounds = m_softwareDirtyRect;
    858     m_canvas->clipRect(bounds, SkRegion::kReplace_Op);
    859     m_canvas->drawARGB(0, 0, 0, 0, SkXfermode::kClear_Mode);
    860     m_canvas->restore();
    861     m_softwareDirtyRect.setWidth(0); // Clear dirty rect.
    862 #endif
    863 }
    864 
    865 void PlatformContextSkia::readbackHardwareToSoftware() const
    866 {
    867 #if ENABLE(ACCELERATED_2D_CANVAS)
    868     const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(true);
    869     SkAutoLockPixels lock(bitmap);
    870     int width = bitmap.width(), height = bitmap.height();
    871     SharedGraphicsContext3D* context = m_gpuCanvas->context();
    872     m_gpuCanvas->bindFramebuffer();
    873     // Flips the image vertically.
    874     for (int y = 0; y < height; ++y) {
    875         uint32_t* pixels = bitmap.getAddr32(0, y);
    876         if (context->supportsBGRA())
    877             context->readPixels(0, height - 1 - y, width, 1, Extensions3D::BGRA_EXT, GraphicsContext3D::UNSIGNED_BYTE, pixels);
    878         else {
    879             context->readPixels(0, height - 1 - y, width, 1, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels);
    880             for (int i = 0; i < width; ++i) {
    881                 uint32_t pixel = pixels[i];
    882                 // Swizzles from RGBA -> BGRA.
    883                 pixels[i] = (pixel & 0xFF00FF00) | ((pixel & 0x00FF0000) >> 16) | ((pixel & 0x000000FF) << 16);
    884             }
    885         }
    886     }
    887     m_softwareDirtyRect.unite(IntRect(0, 0, width, height)); // Mark everything as dirty.
    888 #endif
     678void PlatformContextSkia::makeGrContextCurrent()
     679{
     680    if (m_gpuContext)
     681        m_gpuContext->makeContextCurrent();
    889682}
    890683
  • trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h

    r90767 r90872  
    4848class DrawingBuffer;
    4949class GraphicsContext3D;
    50 class GraphicsContextGPU;
    5150class Texture;
    5251
     
    7170    WTF_MAKE_NONCOPYABLE(PlatformContextSkia);
    7271public:
    73     enum AccelerationMode {
    74         NoAcceleration,
    75         GPU,
    76         SkiaGPU
    77     };
    78 
    7972    // For printing, there shouldn't be any canvas. canvas can be NULL. If you
    8073    // supply a NULL canvas, you can also call setCanvas later.
     
    185178    bool hasImageResamplingHint() const;
    186179
    187     bool canAccelerate() const;
    188     bool canvasClipApplied() const;
    189     AccelerationMode accelerationMode() const { return m_accelerationMode; }
    190     bool useGPU() const { return m_accelerationMode == GPU; }
    191     bool useSkiaGPU() const { return m_accelerationMode == SkiaGPU; }
    192     void setSharedGraphicsContext3D(SharedGraphicsContext3D*, DrawingBuffer*, const IntSize&);
    193 #if ENABLE(ACCELERATED_2D_CANVAS)
    194     GraphicsContextGPU* gpuCanvas() const { return m_gpuCanvas.get(); }
    195 #else
    196     GraphicsContextGPU* gpuCanvas() const { return 0; }
    197 #endif
    198     // Call these before making a call that manipulates the underlying
    199     // SkCanvas or WebCore::GraphicsContextGPU
    200     void prepareForSoftwareDraw() const;
    201     void prepareForHardwareDraw() const;
    202     // Call to force the SkCanvas to contain all rendering results.
    203     void syncSoftwareCanvas() const;
    204     void markDirtyRect(const IntRect& rect);
     180    bool useSkiaGPU() const { return m_gpuContext; }
     181    void setGraphicsContext3D(GraphicsContext3D*, DrawingBuffer*, const IntSize&);
     182    void makeGrContextCurrent();
    205183
    206184private:
     
    209187    void applyClipFromImage(const FloatRect&, const SkBitmap&);
    210188    void applyAntiAliasedClipPaths(WTF::Vector<SkPath>& paths);
    211 
    212     void uploadSoftwareToHardware(CompositeOperator) const;
    213     void readbackHardwareToSoftware() const;
    214189
    215190    // common code between setupPaintFor[Filling,Stroking]
     
    236211    bool m_printing;
    237212    bool m_drawingToImageBuffer;
    238     AccelerationMode m_accelerationMode;
    239 #if ENABLE(ACCELERATED_2D_CANVAS)
    240     OwnPtr<GraphicsContextGPU> m_gpuCanvas;
    241     mutable RefPtr<Texture> m_uploadTexture;
    242 #endif
    243     mutable enum { None, Software, Mixed, Hardware } m_backingStoreState;
    244     mutable IntRect m_softwareDirtyRect;
     213    GraphicsContext3D* m_gpuContext;
    245214};
    246215
  • trunk/Source/WebKit/chromium/ChangeLog

    r90856 r90872  
     12011-07-12  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Delete the unused legacy accelerated canvas 2d code
     4        https://bugs.webkit.org/show_bug.cgi?id=64214
     5
     6        Reviewed by Stephen White.
     7
     8        Adds a way to stash a GrContext* on a GraphicsContext3D. Previously, this was handled by
     9        SharedGraphicsContext3D, but we don't need that class any more.  This is used only for the shared
     10        GraphicsContext3D stashed on the Page and shared by all accelerated canvases within the Page, for WebGL and
     11        compositor contexts the GrContext is never set.
     12
     13        * src/GraphicsContext3DChromium.cpp:
     14        (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
     15        (WebCore::GraphicsContext3DInternal::~GraphicsContext3DInternal):
     16        (WebCore::GraphicsContext3DInternal::grContext):
     17        (WebCore::GraphicsContext3D::grContext):
     18        * src/GraphicsContext3DInternal.h:
     19
    1202011-07-12  Joseph Pecoraro  <joepeck@webkit.org>
    221
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp

    r89393 r90872  
    6262#endif
    6363
     64#if USE(SKIA)
     65#include "GrContext.h"
     66#endif
     67
    6468// There are two levels of delegation in this file:
    6569//
     
    8589    , m_layerComposited(false)
    8690#if USE(SKIA)
     91    , m_grContext(0)
    8792#elif USE(CG)
    8893    , m_renderOutput(0)
     
    98103    if (m_renderOutput)
    99104        delete[] m_renderOutput;
     105#endif
     106#if USE(SKIA)
     107    if (m_grContext) {
     108        m_grContext->contextDestroyed();
     109        GrSafeUnref(m_grContext);
     110    }
    100111#endif
    101112}
     
    146157    return m_impl->getPlatformTextureId();
    147158}
     159
     160#if USE(SKIA)
     161GrContext* GraphicsContext3DInternal::grContext()
     162{
     163    // Limit the number of textures we hold in the bitmap->texture cache.
     164    static const int maxTextureCacheCount = 512;
     165    // Limit the bytes allocated toward textures in the bitmap->texture cache.
     166    static const size_t maxTextureCacheBytes = 50 * 1024 * 1024;
     167
     168    if (!m_grContext) {
     169        m_grContext = GrContext::CreateGLShaderContext();
     170        if (m_grContext)
     171            m_grContext->setTextureCacheLimits(maxTextureCacheCount, maxTextureCacheBytes);
     172    }
     173    return m_grContext;
     174}
     175#endif
    148176
    149177void GraphicsContext3DInternal::prepareTexture()
     
    962990    return m_internal->platformTexture();
    963991}
     992
     993#if USE(SKIA)
     994GrContext* GraphicsContext3D::grContext()
     995{
     996    return m_internal->grContext();
     997}
     998#endif
    964999
    9651000void GraphicsContext3D::prepareTexture()
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DInternal.h

    r89393 r90872  
    3535#endif
    3636
     37#if USE(SKIA)
     38class GrContext;
     39#endif
     40
    3741namespace WebKit {
    3842class WebGraphicsContext3D;
     
    6367    PlatformGraphicsContext3D platformGraphicsContext3D() const;
    6468    Platform3DObject platformTexture() const;
     69#if USE(SKIA)
     70    GrContext* grContext();
     71#endif
    6572
    6673    bool makeContextCurrent();
     
    306313    // used to resize the Canvas.
    307314    SkBitmap m_resizingBitmap;
     315
     316    GrContext* m_grContext;
    308317#endif
    309318
Note: See TracChangeset for help on using the changeset viewer.