Changeset 95192 in webkit


Ignore:
Timestamp:
Sep 15, 2011 8:13:15 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Source/WebCore: [Skia/Chrome] Cleanup unneeded code now that GrGLInterface is used to set GL ctx per GL call.
https://bugs.webkit.org/show_bug.cgi?id=68096

Patch by Brian Salomon <bsalomon@google.com> on 2011-09-15
Reviewed by Stephen White.

This change removes PlatformContextSkia::makeGrContextCurrent now that
GrGLInterface is used to set the context on every Skia GL call.

Tested by every canvas layout test.

  • platform/graphics/chromium/FontLinux.cpp:

(WebCore::Font::drawGlyphs):

  • platform/graphics/skia/FontSkia.cpp:

(WebCore::Font::drawGlyphs):

  • platform/graphics/skia/GraphicsContextSkia.cpp:

(WebCore::GraphicsContext::clearRect):
(WebCore::GraphicsContext::clip):
(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::strokeArc):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::strokeRect):

  • platform/graphics/skia/ImageBufferSkia.cpp:

(WebCore::ImageBuffer::ImageBuffer):
(WebCore::ImageBuffer::~ImageBuffer):
(WebCore::ImageBuffer::copyImage):
(WebCore::ImageBuffer::draw):
(WebCore::ImageBuffer::drawPattern):
(WebCore::ImageBuffer::getUnmultipliedImageData):
(WebCore::ImageBuffer::getPremultipliedImageData):
(WebCore::ImageBuffer::putUnmultipliedImageData):
(WebCore::ImageBuffer::putPremultipliedImageData):
(WebCore::ImageBuffer::toDataURL):

  • platform/graphics/skia/ImageSkia.cpp:

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

  • platform/graphics/skia/PlatformContextSkia.cpp:

(WebCore::PlatformContextSkia::clipPathAntiAliased):
(WebCore::PlatformContextSkia::setGraphicsContext3D):

  • platform/graphics/skia/PlatformContextSkia.h:
  • platform/graphics/skia/SkiaFontWin.cpp:

(WebCore::paintSkiaText):

Source/WebKit/chromium: [Skia/Chrome]
https://bugs.webkit.org/show_bug.cgi?id=68096

This change removes WebGraphicsContext3D::grGLInterface(). It has been
superceded by WebGraphicsContext3D::createGrGLInterface which sets up
the per-GL call callback used to set the correct context.

Patch by Brian Salomon <bsalomon@google.com> on 2011-09-15
Reviewed by Stephen White.

  • public/WebGraphicsContext3D.h:
  • src/GraphicsContext3DChromium.cpp:

(WebCore::GraphicsContext3DPrivate::grContext):

  • src/WebGraphicsContext3D.cpp:

(WebKit::WebGraphicsContext3D::createGrGLInterface):

Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r95184 r95192  
     12011-09-15  Brian Salomon  <bsalomon@google.com>
     2
     3        [Skia/Chrome] Cleanup unneeded code now that GrGLInterface is used to set GL ctx per GL call.
     4        https://bugs.webkit.org/show_bug.cgi?id=68096
     5
     6        Reviewed by Stephen White.
     7
     8        This change removes PlatformContextSkia::makeGrContextCurrent now that
     9        GrGLInterface is used to set the context on every Skia GL call.
     10
     11        Tested by every canvas layout test.
     12
     13        * platform/graphics/chromium/FontLinux.cpp:
     14        (WebCore::Font::drawGlyphs):
     15        * platform/graphics/skia/FontSkia.cpp:
     16        (WebCore::Font::drawGlyphs):
     17        * platform/graphics/skia/GraphicsContextSkia.cpp:
     18        (WebCore::GraphicsContext::clearRect):
     19        (WebCore::GraphicsContext::clip):
     20        (WebCore::GraphicsContext::drawConvexPolygon):
     21        (WebCore::GraphicsContext::drawEllipse):
     22        (WebCore::GraphicsContext::drawFocusRing):
     23        (WebCore::GraphicsContext::drawLine):
     24        (WebCore::GraphicsContext::drawLineForTextChecking):
     25        (WebCore::GraphicsContext::drawLineForText):
     26        (WebCore::GraphicsContext::drawRect):
     27        (WebCore::GraphicsContext::fillPath):
     28        (WebCore::GraphicsContext::fillRect):
     29        (WebCore::GraphicsContext::fillRoundedRect):
     30        (WebCore::GraphicsContext::strokeArc):
     31        (WebCore::GraphicsContext::strokePath):
     32        (WebCore::GraphicsContext::strokeRect):
     33        * platform/graphics/skia/ImageBufferSkia.cpp:
     34        (WebCore::ImageBuffer::ImageBuffer):
     35        (WebCore::ImageBuffer::~ImageBuffer):
     36        (WebCore::ImageBuffer::copyImage):
     37        (WebCore::ImageBuffer::draw):
     38        (WebCore::ImageBuffer::drawPattern):
     39        (WebCore::ImageBuffer::getUnmultipliedImageData):
     40        (WebCore::ImageBuffer::getPremultipliedImageData):
     41        (WebCore::ImageBuffer::putUnmultipliedImageData):
     42        (WebCore::ImageBuffer::putPremultipliedImageData):
     43        (WebCore::ImageBuffer::toDataURL):
     44        * platform/graphics/skia/ImageSkia.cpp:
     45        (WebCore::BitmapImage::draw):
     46        (WebCore::BitmapImageSingleFrameSkia::draw):
     47        * platform/graphics/skia/PlatformContextSkia.cpp:
     48        (WebCore::PlatformContextSkia::clipPathAntiAliased):
     49        (WebCore::PlatformContextSkia::setGraphicsContext3D):
     50        * platform/graphics/skia/PlatformContextSkia.h:
     51        * platform/graphics/skia/SkiaFontWin.cpp:
     52        (WebCore::paintSkiaText):
     53
    1542011-09-15  Peter Beverloo  <peter@chromium.org>
    255
  • trunk/Source/WebCore/platform/graphics/chromium/FontLinux.cpp

    r90872 r95192  
    111111    }
    112112
    113     gc->platformContext()->makeGrContextCurrent();
    114 
    115113    SkCanvas* canvas = gc->platformContext()->canvas();
    116114    TextDrawingModeFlags textMode = gc->platformContext()->getTextDrawingMode();
  • trunk/Source/WebCore/platform/graphics/skia/FontSkia.cpp

    r94019 r95192  
    127127    }
    128128
    129     gc->platformContext()->makeGrContextCurrent();
    130 
    131129    SkCanvas* canvas = gc->platformContext()->canvas();
    132130    TextDrawingModeFlags textMode = gc->platformContext()->getTextDrawingMode();
  • trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

    r94897 r95192  
    336336        ClipRectToCanvas(*platformContext()->canvas(), r, &r);
    337337
    338     platformContext()->makeGrContextCurrent();
    339 
    340338    SkPaint paint;
    341339    platformContext()->setupPaintForFilling(&paint);
     
    353351        return;
    354352
    355     platformContext()->makeGrContextCurrent();
    356353    platformContext()->canvas()->clipRect(r);
    357354}
     
    457454        return;
    458455
    459     platformContext()->makeGrContextCurrent();
    460 
    461456    SkPath path;
    462457    setPathFromConvexPoints(&path, numPoints, points);
     
    506501        return;
    507502
    508     platformContext()->makeGrContextCurrent();
    509503    SkPaint paint;
    510504    platformContext()->setupPaintForFilling(&paint);
     
    563557        return;
    564558
    565     platformContext()->makeGrContextCurrent();
    566559    SkRegion focusRingRegion;
    567560    const SkScalar focusRingOutset = getFocusRingOutset(width);
     
    597590    if (!isPointSkiaSafe(getCTM(), point1) || !isPointSkiaSafe(getCTM(), point2))
    598591        return;
    599 
    600     platformContext()->makeGrContextCurrent();
    601592
    602593    FloatPoint p1 = point1;
     
    643634    if (paintingDisabled())
    644635        return;
    645 
    646     platformContext()->makeGrContextCurrent();
    647636
    648637    // Create the pattern we'll use to draw the underline.
     
    726715        return;
    727716
    728     platformContext()->makeGrContextCurrent();
    729 
    730717    int thickness = SkMax32(static_cast<int>(strokeThickness()), 1);
    731718    SkRect r;
     
    748735        return;
    749736
    750     platformContext()->makeGrContextCurrent();
    751 
    752737    SkRect r = rect;
    753738    if (!isRectSkiaSafe(getCTM(), r)) {
     
    768753      return;
    769754
    770     platformContext()->makeGrContextCurrent();
    771 
    772755    const GraphicsContextState& state = m_state;
    773756    path.setFillType(state.fillRule == RULE_EVENODD ?
     
    793776    platformContext()->save();
    794777
    795     platformContext()->makeGrContextCurrent();
    796 
    797778    SkPaint paint;
    798779    platformContext()->setupPaintForFilling(&paint);
     
    806787    if (paintingDisabled())
    807788        return;
    808 
    809     platformContext()->makeGrContextCurrent();
    810789
    811790    SkRect r = rect;
     
    841820        return;
    842821
    843     platformContext()->makeGrContextCurrent();
    844 
    845822    SkRect r = rect;
    846823    if (!isRectSkiaSafe(getCTM(), r))
     
    11301107        return;
    11311108
    1132     platformContext()->makeGrContextCurrent();
    1133 
    11341109    SkPaint paint;
    11351110    SkRect oval = r;
     
    11631138        return;
    11641139
    1165     platformContext()->makeGrContextCurrent();
    1166 
    11671140    SkPaint paint;
    11681141    platformContext()->setupPaintForStroking(&paint, 0, 0);
     
    11771150    if (!isRectSkiaSafe(getCTM(), rect))
    11781151        return;
    1179 
    1180     platformContext()->makeGrContextCurrent();
    11811152
    11821153    SkPaint paint;
  • trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp

    r95177 r95192  
    8787        GraphicsContext3D* context3D = SharedGraphicsContext3D::create(0);
    8888        if (context3D) {
    89             context3D->makeContextCurrent();
    9089            GrContext* gr = context3D->grContext();
    9190            if (gr) {
     
    119118        m_data.m_platformLayer->setTextureId(0);
    120119#endif
    121     if (m_context && m_context->platformContext()) {
    122         // This is so that the SkGpuDevice destructor has the correct context.
    123         m_context->platformContext()->makeGrContextCurrent();
    124     }
    125120}
    126121
     
    138133{
    139134    ASSERT(copyBehavior == CopyBackingStore);
    140     m_context->platformContext()->makeGrContextCurrent();
    141135    return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), true);
    142136}
     
    155149                       CompositeOperator op, bool useLowQualityScale)
    156150{
    157     // Set both graphics contexts current. This looks a little weird, but is
    158     // necessary since we may be drawing from an accelerated to
    159     // non-accelerated context (e.g., printing), or vice versa. Note that it
    160     // only works because the context is actually the same underlying context
    161     // (or null), since we use one context for accelerated drawing. If that
    162     // assumption changes, we'll have to revisit this code.
    163     context->platformContext()->makeGrContextCurrent();
    164     m_context->platformContext()->makeGrContextCurrent();
    165151    RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context);
    166152    context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale);
     
    170156                              const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
    171157{
    172     context->platformContext()->makeGrContextCurrent();
    173158    RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context);
    174159    image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
     
    287272PassRefPtr<ByteArray> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const
    288273{
    289     m_context->platformContext()->makeGrContextCurrent();
    290274    return getImageData<Unmultiplied>(rect, *context()->platformContext()->canvas()->getDevice(), m_size);
    291275}
     
    293277PassRefPtr<ByteArray> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const
    294278{
    295     m_context->platformContext()->makeGrContextCurrent();
    296279    return getImageData<Premultiplied>(rect, *context()->platformContext()->canvas()->getDevice(), m_size);
    297280}
     
    368351void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint)
    369352{
    370     m_context->platformContext()->makeGrContextCurrent();
    371353    putImageData<Unmultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas()->getDevice(), m_size);
    372354}
     
    374356void ImageBuffer::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint)
    375357{
    376     m_context->platformContext()->makeGrContextCurrent();
    377358    putImageData<Premultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas()->getDevice(), m_size);
    378359}
     
    404385String ImageBuffer::toDataURL(const String& mimeType, const double* quality) const
    405386{
    406     m_context->platformContext()->makeGrContextCurrent();
    407387    SkDevice* device = context()->platformContext()->canvas()->getDevice();
    408388    return ImageToDataURL(device->accessBitmap(false), mimeType, quality);
  • trunk/Source/WebCore/platform/graphics/skia/ImageSkia.cpp

    r94185 r95192  
    423423        return;  // Nothing to draw.
    424424
    425     ctxt->platformContext()->makeGrContextCurrent();
    426 
    427425    paintSkBitmap(ctxt->platformContext(),
    428426                  *bm,
     
    449447        return;  // Nothing to draw.
    450448
    451     ctxt->platformContext()->makeGrContextCurrent();
    452 
    453449    paintSkBitmap(ctxt->platformContext(),
    454450                  m_nativeImage,
  • trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp

    r94589 r95192  
    268268void PlatformContextSkia::clipPathAntiAliased(const SkPath& clipPath)
    269269{
    270     makeGrContextCurrent();
    271270    if (m_canvas->getTopDevice()->getDeviceCapabilities() & SkDevice::kVector_Capability) {
    272271        // When the output is a vector device, like PDF, we don't need antialiased clips.
     
    657656}
    658657
    659 void PlatformContextSkia::makeGrContextCurrent()
    660 {
    661     if (m_gpuContext)
    662         m_gpuContext->makeContextCurrent();
    663 }
    664 
    665658} // namespace WebCore
  • trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h

    r94589 r95192  
    175175    bool isAccelerated() const { return m_gpuContext; }
    176176    void setGraphicsContext3D(GraphicsContext3D*);
    177     void makeGrContextCurrent();
    178177
    179178private:
  • trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp

    r95097 r95192  
    184184    TextDrawingModeFlags textMode = platformContext->getTextDrawingMode();
    185185
    186     // If platformContext is GPU-backed make its GL context current.
    187     platformContext->makeGrContextCurrent();
    188 
    189186    // Filling (if necessary). This is the common case.
    190187    SkPaint paint;
  • trunk/Source/WebKit/chromium/ChangeLog

    r95188 r95192  
     12011-09-15  Brian Salomon  <bsalomon@google.com>
     2
     3        [Skia/Chrome]
     4        https://bugs.webkit.org/show_bug.cgi?id=68096
     5
     6        This change removes WebGraphicsContext3D::grGLInterface(). It has been
     7        superceded by WebGraphicsContext3D::createGrGLInterface which sets up
     8        the per-GL call callback used to set the correct context.
     9
     10        Reviewed by Stephen White.
     11
     12        * public/WebGraphicsContext3D.h:
     13        * src/GraphicsContext3DChromium.cpp:
     14        (WebCore::GraphicsContext3DPrivate::grContext):
     15        * src/WebGraphicsContext3D.cpp:
     16        (WebKit::WebGraphicsContext3D::createGrGLInterface):
     17
    1182011-09-15  Xianzhu Wang  <wangxianzhu@chromium.org>
    219
  • trunk/Source/WebKit/chromium/public/WebGraphicsContext3D.h

    r94971 r95192  
    367367
    368368#if WEBKIT_USING_SKIA
    369     // FIXME: This function is superceded by onCreateGrGLInterface. It should be removed after subclass implementations are removed from Chromium.
    370     virtual GrGLInterface* grGLInterface() { return 0; }
    371 
    372369    GrGLInterface* createGrGLInterface();
    373370#endif
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp

    r95156 r95192  
    203203    if (!m_grContext) {
    204204        SkAutoTUnref<GrGLInterface> interface(m_impl->createGrGLInterface());
    205         // FIXME: Remove this block after the WebGraphicsContext3D subclasses in Chromium no longer override grGLInterface().
    206         if (!interface.get()) {
    207             GrGLInterface* fallbackInterface = m_impl->grGLInterface();
    208             if (fallbackInterface) {
    209                 fallbackInterface->ref(); // balance out the SkAutoTUnref
    210                 interface.reset(fallbackInterface);
    211             }
    212         }
    213         // This is the end of the block to remove.
    214205        m_grContext = GrContext::Create(kOpenGL_Shaders_GrEngine, reinterpret_cast<GrPlatform3DContext>(interface.get()));
    215206        if (m_grContext)
  • trunk/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp

    r94359 r95192  
    3333#if WEBKIT_USING_SKIA
    3434
    35 #if GR_GL_PER_GL_FUNC_CALLBACK
    3635namespace {
    3736    void bindWebGraphicsContext3DGLContextCallback(const GrGLInterface* interface)
     
    4039    }
    4140}
    42 #endif
    4341
    4442GrGLInterface* WebGraphicsContext3D::createGrGLInterface()
    4543{
    4644    GrGLInterface* interface = onCreateGrGLInterface();
    47 #if GR_GL_PER_GL_FUNC_CALLBACK
    4845    if (interface) {
    4946        interface->fCallback = bindWebGraphicsContext3DGLContextCallback;
    5047        interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this);
    5148    }
    52 #endif
    5349    return interface;
    5450}
Note: See TracChangeset for help on using the changeset viewer.