| Index: third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
|
| index 1d3494c7a70498af49840f41a83b6cfd71d367c3..d1f305d1b878f65dc20522116998343b0293a356 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
|
| @@ -148,19 +148,19 @@
|
| m_client->restoreCanvasMatrixClipStack(canvas);
|
| }
|
|
|
| -PassRefPtr<SkImage> ImageBuffer::newSkImageSnapshot(AccelerationHint hint) const
|
| +PassRefPtr<SkImage> ImageBuffer::newSkImageSnapshot() const
|
| {
|
| if (m_snapshotState == InitialSnapshotState)
|
| m_snapshotState = DidAcquireSnapshot;
|
|
|
| if (!isSurfaceValid())
|
| return nullptr;
|
| - return m_surface->newImageSnapshot(hint);
|
| -}
|
| -
|
| -PassRefPtr<Image> ImageBuffer::newImageSnapshot(AccelerationHint hint) const
|
| -{
|
| - RefPtr<SkImage> snapshot = newSkImageSnapshot(hint);
|
| + return m_surface->newImageSnapshot();
|
| +}
|
| +
|
| +PassRefPtr<Image> ImageBuffer::newImageSnapshot() const
|
| +{
|
| + RefPtr<SkImage> snapshot = newSkImageSnapshot();
|
| if (!snapshot)
|
| return nullptr;
|
| return StaticBitmapImage::create(snapshot);
|
| @@ -180,19 +180,15 @@
|
|
|
| bool ImageBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, Platform3DObject texture, GLenum internalFormat, GLenum destType, GLint level, bool premultiplyAlpha, bool flipY)
|
| {
|
| + if (!m_surface->isAccelerated() || !isSurfaceValid())
|
| + return false;
|
| +
|
| if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(GL_TEXTURE_2D, internalFormat, destType, level))
|
| return false;
|
|
|
| - if (!isSurfaceValid())
|
| - return false;
|
| -
|
| - RefPtr<const SkImage> textureImage = m_surface->newImageSnapshot(PreferAcceleration);
|
| + RefPtr<const SkImage> textureImage = m_surface->newImageSnapshot();
|
| if (!textureImage)
|
| return false;
|
| -
|
| - if (!m_surface->isAccelerated())
|
| - return false;
|
| -
|
|
|
| ASSERT(textureImage->isTextureBacked()); // isAccelerated() check above should guarantee this
|
| // Get the texture ID, flushing pending operations if needed.
|
| @@ -290,11 +286,6 @@
|
| result.transfer(contents);
|
| return true;
|
| }
|
| -
|
| - ASSERT(canvas());
|
| - RefPtr<SkImage> snapshot = m_surface->newImageSnapshot(PreferNoAcceleration);
|
| - if (!snapshot)
|
| - return false;
|
|
|
| const bool mayHaveStrayArea =
|
| m_surface->isAccelerated() // GPU readback may fail silently
|
| @@ -312,6 +303,10 @@
|
| SkAlphaType alphaType = (multiplied == Premultiplied) ? kPremul_SkAlphaType : kUnpremul_SkAlphaType;
|
| SkImageInfo info = SkImageInfo::Make(rect.width(), rect.height(), kRGBA_8888_SkColorType, alphaType);
|
|
|
| + ASSERT(canvas());
|
| + RefPtr<SkImage> snapshot = m_surface->newImageSnapshot();
|
| + if (!snapshot)
|
| + return false;
|
| snapshot->readPixels(info, result.data(), 4 * rect.width(), rect.x(), rect.y());
|
| result.transfer(contents);
|
| return true;
|
|
|