Changeset 83960 in webkit


Ignore:
Timestamp:
Apr 15, 2011 2:28:50 AM (13 years ago)
Author:
caseq@chromium.org
Message:

2011-04-15 Andrey Kosyakov <caseq@chromium.org>

Unreviewed, rolling out r83949.
http://trac.webkit.org/changeset/83949
https://bugs.webkit.org/show_bug.cgi?id=57960

broke 31 tests in chromium win & linux

  • platform/chromium/test_expectations.txt:

2011-04-15 Andrey Kosyakov <caseq@chromium.org>

Unreviewed, rolling out r83949.
http://trac.webkit.org/changeset/83949
https://bugs.webkit.org/show_bug.cgi?id=57960

broke 31 tests in chromium win & linux

  • platform/graphics/chromium/GLES2Canvas.cpp: (WebCore::GLES2Canvas::drawTexturedRect):
  • platform/graphics/chromium/GLES2Canvas.h:
  • platform/graphics/gpu/Texture.cpp: (WebCore::copySubRect): (WebCore::Texture::load): (WebCore::Texture::updateSubRect):
  • platform/graphics/gpu/Texture.h:
  • platform/graphics/skia/ImageBufferSkia.cpp: (WebCore::getImageData): (WebCore::putImageData): (WebCore::ImageBuffer::putUnmultipliedImageData): (WebCore::ImageBuffer::putPremultipliedImageData):
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r83959 r83960  
     12011-04-15  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Unreviewed, rolling out r83949.
     4        http://trac.webkit.org/changeset/83949
     5        https://bugs.webkit.org/show_bug.cgi?id=57960
     6
     7        broke 31 tests in chromium win & linux
     8
     9        * platform/chromium/test_expectations.txt:
     10
    1112011-04-15  Philippe Normand  <pnormand@igalia.com>
    212
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r83949 r83960  
    699699// selection
    700700BUGCR10369 LINUX : editing/selection/5354455-2.html = FAIL
    701 
    702 BUGCR79477 LINUX WIN : canvas/philip/tests/2d.gradient.interpolate.colouralpha.html = TEXT
    703701
    704702// TODO(erg): Attempted to rebaseline these tests as part of the above
  • trunk/Source/WebCore/ChangeLog

    r83957 r83960  
     12011-04-15  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Unreviewed, rolling out r83949.
     4        http://trac.webkit.org/changeset/83949
     5        https://bugs.webkit.org/show_bug.cgi?id=57960
     6
     7        broke 31 tests in chromium win & linux
     8
     9        * platform/graphics/chromium/GLES2Canvas.cpp:
     10        (WebCore::GLES2Canvas::drawTexturedRect):
     11        * platform/graphics/chromium/GLES2Canvas.h:
     12        * platform/graphics/gpu/Texture.cpp:
     13        (WebCore::copySubRect):
     14        (WebCore::Texture::load):
     15        (WebCore::Texture::updateSubRect):
     16        * platform/graphics/gpu/Texture.h:
     17        * platform/graphics/skia/ImageBufferSkia.cpp:
     18        (WebCore::getImageData):
     19        (WebCore::putImageData):
     20        (WebCore::ImageBuffer::putUnmultipliedImageData):
     21        (WebCore::ImageBuffer::putPremultipliedImageData):
     22
    1232011-04-15  Ben Taylor  <bentaylor.solx86@gmail.com>
    224
  • trunk/Source/WebCore/platform/graphics/chromium/GLES2Canvas.cpp

    r83949 r83960  
    3333#include "GLES2Canvas.h"
    3434
    35 #include "ByteArray.h"
    3635#include "DrawingBuffer.h"
    3736#include "FloatRect.h"
     
    5958namespace WebCore {
    6059
    61 using WTF::ByteArray;
    62 
    6360// Number of line segments used to approximate bezier curves.
    6461const int pathTesselation = 30;
     
    410407void GLES2Canvas::drawTexturedRect(Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace colorSpace, CompositeOperator compositeOp)
    411408{
    412     drawTexturedRect(texture, srcRect, dstRect, m_state->m_ctm, m_state->m_alpha, colorSpace, compositeOp, m_state->clippingEnabled() ? ApplyClipping : 0);
    413 }
    414 
    415 void GLES2Canvas::drawTexturedRect(Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha, ColorSpace colorSpace, CompositeOperator compositeOp, unsigned drawTextureFlags)
     409    drawTexturedRect(texture, srcRect, dstRect, m_state->m_ctm, m_state->m_alpha, colorSpace, compositeOp, m_state->clippingEnabled());
     410}
     411
     412
     413void GLES2Canvas::drawTexturedRect(Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha, ColorSpace colorSpace, CompositeOperator compositeOp, bool clip)
    416414{
    417415    bindFramebuffer();
    418    
    419     if (drawTextureFlags & MultiplySourceAlpha) {
    420         // The multiply option hijacks the blend func, so it can't be combined with a compositing op
    421         ASSERT(CompositeCopy == compositeOp);
    422         // Custom composite operation that performs alpha multiplication on color components
    423         m_context->graphicsContext3D()->enable(GraphicsContext3D::BLEND);
    424         m_context->graphicsContext3D()->blendFuncSeparate(GraphicsContext3D::SRC_ALPHA, GraphicsContext3D::ZERO, GraphicsContext3D::ONE, GraphicsContext3D::ZERO);
    425     } else
    426         m_context->applyCompositeOperator(compositeOp);
    427     applyClipping(drawTextureFlags & ApplyClipping);
     416    m_context->applyCompositeOperator(compositeOp);
     417    applyClipping(clip);
    428418    const TilingData& tiles = texture->tiles();
    429419    IntRect tileIdxRect = tiles.overlappedTileIndices(srcRect);
     
    914904}
    915905
    916 void GLES2Canvas::putImageData(void* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, Texture::Format format, float alpha, ColorSpace colorSpace, CompositeOperator op, unsigned drawTextureFlags)
    917 {
    918     ASSERT(source);
    919     IntRect clippedSourceRect(0, 0, sourceSize.width(), sourceSize.height());
    920     clippedSourceRect.intersect(sourceRect);
    921     int deltaX = clippedSourceRect.x() - sourceRect.x();
    922     int deltaY = clippedSourceRect.y() - sourceRect.y();
    923     IntPoint adjustedDestPoint(destPoint.x() + deltaX, destPoint.y() + deltaY);   
    924     IntRect destRect(adjustedDestPoint, clippedSourceRect.size());
    925     IntRect canvasRect(0, 0, m_size.width(), m_size.height());
    926     destRect.intersect(canvasRect);
    927     deltaX = destRect.x() - adjustedDestPoint.x();
    928     deltaY = destRect.y() - adjustedDestPoint.y();
    929     clippedSourceRect.move(deltaX, deltaY);
    930     clippedSourceRect.setSize(destRect.size());
    931     if (!clippedSourceRect.width() || !clippedSourceRect.height())
    932         return;
    933     RefPtr<Texture> uploadTexture = m_context->createTexture(format, clippedSourceRect.width(), clippedSourceRect.height());
    934     IntRect texUpdateRect(0, 0, clippedSourceRect.width(), clippedSourceRect.height());
    935     // To get the row stride right, we still take the width of the full buffer for the source size.
    936     IntSize adjustedSourceSize(sourceSize.width(), texUpdateRect.height());
    937     uploadTexture->updateSubRect(((char*)source) + (clippedSourceRect.y() * sourceSize.width() + clippedSourceRect.x()) * 4, adjustedSourceSize, texUpdateRect);
    938     AffineTransform identity;
    939     drawTexturedRect(uploadTexture.get(), texUpdateRect, destRect, identity, alpha, colorSpace, op, drawTextureFlags);
    940 }
    941 
    942 void GLES2Canvas::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint)
    943 {
    944     IntPoint newDestPoint(destPoint.x() + sourceRect.x(), destPoint.y() + sourceRect.y());
    945     putImageData(source->data(), sourceSize, sourceRect, newDestPoint, Texture::RGBA8, 1.0f, ColorSpaceDeviceRGB, CompositeCopy, MultiplySourceAlpha);
    946 }
    947 
    948 void GLES2Canvas::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint)
    949 {
    950     IntPoint newDestPoint(destPoint.x() + sourceRect.x(), destPoint.y() + sourceRect.y());
    951     putImageData(source->data(), sourceSize, sourceRect, newDestPoint, Texture::RGBA8, 1.0f, ColorSpaceDeviceRGB, CompositeCopy, 0);
    952 }
    953 
    954906void GLES2Canvas::checkGLError(const char* header)
    955907{
  • trunk/Source/WebCore/platform/graphics/chromium/GLES2Canvas.h

    r83949 r83960  
    4444#include <wtf/Vector.h>
    4545
    46 namespace WTF {
    47 class ByteArray;
    48 }
    49 
    5046namespace WebCore {
    5147
     
    6056    WTF_MAKE_NONCOPYABLE(GLES2Canvas);
    6157public:
    62     enum DrawTextureFlags {
    63         ApplyClipping =         1 << 0,
    64         MultiplySourceAlpha =   1 << 1
    65     };
    66 
    6758    GLES2Canvas(SharedGraphicsContext3D*, DrawingBuffer*, const IntSize&);
    6859    ~GLES2Canvas();
     
    9889    // This version is called by BitmapImage::draw().
    9990    void drawTexturedRect(Texture*, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace, CompositeOperator);
    100     // This version is called by the above, by putImageData, and by the software->hardware uploads.
    101     void drawTexturedRect(Texture*, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform&, float alpha, ColorSpace, CompositeOperator, unsigned drawTextureFlags);
     91    // This version is called by the above, and by the software->hardware uploads.
     92    void drawTexturedRect(Texture*, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform&, float alpha, ColorSpace, CompositeOperator, bool clip);
    10293    Texture* createTexture(NativeImagePtr, Texture::Format, int width, int height);
    10394    Texture* getTexture(NativeImagePtr);
    104     void putImageData(void* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, Texture::Format, float alpha, ColorSpace, CompositeOperator, unsigned drawTextureFlags);
    105     void putUnmultipliedImageData(WTF::ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint);
    106     void putPremultipliedImageData(WTF::ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint);
    10795
    10896    SharedGraphicsContext3D* context() const { return m_context; }
  • trunk/Source/WebCore/platform/graphics/gpu/Texture.cpp

    r83949 r83960  
    121121
    122122template <bool swizzle>
    123 static void copySubRect(uint32_t* src, int srcX, int srcY, uint32_t* dst, int width, int height, int srcStride)
     123static uint32_t* copySubRect(uint32_t* src, int srcX, int srcY, uint32_t* dst, int width, int height, int srcStride)
    124124{
    125125    uint32_t* srcOffset = src + srcX + srcY * srcStride;
     126
     127    if (!swizzle && width == srcStride)
     128        return srcOffset;
     129
    126130    if (swizzle) {
    127131        uint32_t* dstPixel = dst;
     
    138142        }
    139143    }
     144    return dst;
    140145}
    141146
    142147void Texture::load(void* pixels)
    143148{
    144     updateSubRect(pixels, IntSize(m_tiles.totalSizeX(), m_tiles.totalSizeY()), IntRect(0, 0, m_tiles.totalSizeX(), m_tiles.totalSizeY()));
     149    updateSubRect(pixels, IntRect(0, 0, m_tiles.totalSizeX(), m_tiles.totalSizeY()));
    145150}
    146151
    147152void Texture::updateSubRect(void* pixels, const IntRect& updateRect)
    148153{
    149     updateSubRect(pixels, IntSize(m_tiles.totalSizeX(), m_tiles.totalSizeY()), updateRect);
    150 }
    151 
    152 void Texture::updateSubRect(void* pixels, const IntSize& pixelBufferSize, const IntRect& updateRect)
    153 {
    154     IntSize updateBounds = pixelBufferSize.shrunkTo(IntSize(m_tiles.totalSizeX(), m_tiles.totalSizeY()));
    155154    IntRect updateRectSanitized(updateRect);
    156     updateRectSanitized.intersect(IntRect(0, 0, updateBounds.width(), updateBounds.height()));
     155    updateRectSanitized.intersect(IntRect(0, 0, m_tiles.totalSizeX(), m_tiles.totalSizeY()));
    157156
    158157    uint32_t* pixels32 = static_cast<uint32_t*>(pixels);
     
    165164        // FIXME:  This could use PBO's to save doing an extra copy here.
    166165    }
    167 
    168166    int tempBuffSize = // Temporary buffer size is the smaller of the max texture size or the updateRectSanitized
    169167        min(m_tiles.maxTextureSize(), m_tiles.borderTexels() + updateRectSanitized.width()) *
    170168        min(m_tiles.maxTextureSize(), m_tiles.borderTexels() + updateRectSanitized.height());
    171     bool needTempBuff = swizzle || updateRect.width() != m_tiles.totalSizeX() || updateRect.width() != pixelBufferSize.width() || m_tiles.numTilesX() > 1;
    172     OwnArrayPtr<uint32_t> tempBuff;
    173     if (needTempBuff)
    174         tempBuff = adoptArrayPtr(new uint32_t[tempBuffSize]);
     169    OwnArrayPtr<uint32_t> tempBuff = adoptArrayPtr(new uint32_t[tempBuffSize]);
    175170
    176171    for (int tile = 0; tile < m_tiles.numTiles(); tile++) {
     
    187182            continue;
    188183
     184        // Copy sub rectangle out of larger pixel data
    189185        uint32_t* uploadBuff = 0;
    190         if (needTempBuff) {
    191             uploadBuff = tempBuff.get();
    192             // Copy sub rectangle out of larger pixel data
    193             if (swizzle) {
    194                 copySubRect<true>(
    195                 pixels32, updateRectIntersected.x(), updateRectIntersected.y(),
    196                 uploadBuff, updateRectIntersected.width(), updateRectIntersected.height(), pixelBufferSize.width());
    197             } else {
    198                 copySubRect<false>(
    199                 pixels32, updateRectIntersected.x(), updateRectIntersected.y(),
    200                 uploadBuff, updateRectIntersected.width(), updateRectIntersected.height(), pixelBufferSize.width());
    201             }
     186        if (swizzle) {
     187            uploadBuff = copySubRect<true>(
     188            pixels32, updateRectIntersected.x(), updateRectIntersected.y(),
     189            tempBuff.get(), updateRectIntersected.width(), updateRectIntersected.height(), m_tiles.totalSizeX());
    202190        } else {
    203             uploadBuff = pixels32 + updateRectIntersected.x() + updateRectIntersected.y() * pixelBufferSize.width();
     191            uploadBuff = copySubRect<false>(
     192            pixels32, updateRectIntersected.x(), updateRectIntersected.y(),
     193            tempBuff.get(), updateRectIntersected.width(), updateRectIntersected.height(), m_tiles.totalSizeX());
    204194        }
    205195
  • trunk/Source/WebCore/platform/graphics/gpu/Texture.h

    r83949 r83960  
    4343
    4444class IntRect;
    45 class IntSize;
    4645
    4746class Texture : public RefCounted<Texture> {
     
    5352    void load(void* pixels);
    5453    void updateSubRect(void* pixels, const IntRect&);
    55     void updateSubRect(void* pixels, const IntSize&, const IntRect&);
    5654    Format format() const { return m_format; }
    5755    const TilingData& tiles() const { return m_tiles; }
  • trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp

    r83949 r83960  
    232232            if (multiplied == Unmultiplied) {
    233233                unsigned char a = SkGetPackedA32(srcPMColor);
    234                 unsigned char halfA = a >> 1;
    235                 destPixel[0] = a ? (SkGetPackedR32(srcPMColor) * 255 + halfA) / a : 0;
    236                 destPixel[1] = a ? (SkGetPackedG32(srcPMColor) * 255 + halfA) / a : 0;
    237                 destPixel[2] = a ? (SkGetPackedB32(srcPMColor) * 255 + halfA) / a : 0;
     234                destPixel[0] = a ? SkGetPackedR32(srcPMColor) * 255 / a : 0;
     235                destPixel[1] = a ? SkGetPackedG32(srcPMColor) * 255 / a : 0;
     236                destPixel[2] = a ? SkGetPackedB32(srcPMColor) * 255 / a : 0;
    238237                destPixel[3] = a;
    239238            } else {
     
    319318            if (multiplied == Unmultiplied) {
    320319                unsigned char alpha = srcPixel[3];
    321                 unsigned char r = SkMulDiv255Round(srcPixel[0], alpha);
    322                 unsigned char g = SkMulDiv255Round(srcPixel[1], alpha);
    323                 unsigned char b = SkMulDiv255Round(srcPixel[2], alpha);
     320                unsigned char r = SkMulDiv255Ceiling(srcPixel[0], alpha);
     321                unsigned char g = SkMulDiv255Ceiling(srcPixel[1], alpha);
     322                unsigned char b = SkMulDiv255Ceiling(srcPixel[2], alpha);
    324323                destRow[x] = SkPackARGB32(alpha, r, g, b);
    325324            } else
     
    336335void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint)
    337336{
    338     PlatformContextSkia* platformContext = context()->platformContext();
    339     if (platformContext->useGPU()) {
    340         platformContext->prepareForHardwareDraw();
    341         platformContext->gpuCanvas()->putUnmultipliedImageData(source, sourceSize, sourceRect, destPoint);
    342         return;
    343     }
    344     putImageData<Unmultiplied>(source, sourceSize, sourceRect, destPoint, platformContext->canvas()->getDevice(), m_size);
     337    context()->platformContext()->syncSoftwareCanvas();
     338    putImageData<Unmultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas()->getDevice(), m_size);
    345339}
    346340
    347341void ImageBuffer::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint)
    348342{
    349     PlatformContextSkia* platformContext = context()->platformContext();
    350     if (platformContext->useGPU()) {
    351         platformContext->prepareForHardwareDraw();
    352         platformContext->gpuCanvas()->putPremultipliedImageData(source, sourceSize, sourceRect, destPoint);
    353         return;
    354     }
     343    context()->platformContext()->syncSoftwareCanvas();
    355344    putImageData<Premultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas()->getDevice(), m_size);
    356345}
Note: See TracChangeset for help on using the changeset viewer.