| Index: Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp
|
| diff --git a/Source/core/fetch/MockImageResourceClient.h b/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp
|
| similarity index 61%
|
| copy from Source/core/fetch/MockImageResourceClient.h
|
| copy to Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp
|
| index 44993966cddc9aef313b97500533c047a045c618..d6c3159bafc4b23eb02cd3981ac43ee4ca8983d1 100644
|
| --- a/Source/core/fetch/MockImageResourceClient.h
|
| +++ b/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp
|
| @@ -28,43 +28,34 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef MockImageResourceClient_h
|
| -#define MockImageResourceClient_h
|
| +#include "config.h"
|
| +#include "platform/graphics/gpu/AcceleratedImageBufferSurface.h"
|
|
|
| -#include "core/fetch/ImageResourceClient.h"
|
| -
|
| -#include <gtest/gtest.h>
|
| +#include "platform/graphics/gpu/SharedGraphicsContext3D.h"
|
| +#include "third_party/skia/include/gpu/SkGpuDevice.h"
|
|
|
| namespace WebCore {
|
|
|
| -class MockImageResourceClient : public WebCore::ImageResourceClient {
|
| -public:
|
| - MockImageResourceClient()
|
| - : m_imageChangedCount(0)
|
| - , m_notifyFinishedCalled(false)
|
| - {
|
| - }
|
| -
|
| - virtual ~MockImageResourceClient() { }
|
| - virtual void imageChanged(ImageResource*, const IntRect*)
|
| - {
|
| - m_imageChangedCount++;
|
| - }
|
| -
|
| - virtual void notifyFinished(Resource*)
|
| - {
|
| - ASSERT_FALSE(m_notifyFinishedCalled);
|
| - m_notifyFinishedCalled = true;
|
| +AcceleratedImageBufferSurface::AcceleratedImageBufferSurface(const IntSize& size, OpacityMode opacityMode, int msaaSampleCount)
|
| + : ImageBufferSurface(size, opacityMode)
|
| +{
|
| + GrContext* grContext = SharedGraphicsContext3D::get()->grContext();
|
| + if (!grContext)
|
| + return;
|
| + RefPtr<SkGpuDevice> device = adoptRef(new SkGpuDevice(grContext, SkBitmap::kARGB_8888_Config, size.width(), size.height(), msaaSampleCount));
|
| + if (!device->accessRenderTarget())
|
| + return;
|
| + m_canvas = adoptPtr(new SkCanvas(device.get()));
|
| + clear();
|
| +}
|
| +
|
| +Platform3DObject AcceleratedImageBufferSurface::getBackingTexture() const
|
| +{
|
| + GrRenderTarget* renderTarget = m_canvas->getTopDevice()->accessRenderTarget();
|
| + if (renderTarget) {
|
| + return renderTarget->asTexture()->getTextureHandle();
|
| }
|
| -
|
| - int imageChangedCount() const { return m_imageChangedCount; }
|
| - bool notifyFinishedCalled() const { return m_notifyFinishedCalled; }
|
| -
|
| -private:
|
| - int m_imageChangedCount;
|
| - bool m_notifyFinishedCalled;
|
| -};
|
| + return 0;
|
| +}
|
|
|
| } // namespace WebCore
|
| -
|
| -#endif // ImageResourceTest_h
|
|
|