Changeset 66785 in webkit
- Timestamp:
- Sep 3, 2010 6:24:33 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r66784 r66785 389 389 (WebCore::GraphicsContext3D::ensureContext): 390 390 (WebCore::GraphicsContext3D::isErrorGeneratedOnOutOfBoundsAccesses): 391 392 2010-09-03 James Robinson <jamesr@chromium.org> 393 394 Reviewed by Darin Fisher. 395 396 [chromium] Implement ImageBufferSkia::draw on the GPU when possible 397 https://bugs.webkit.org/show_bug.cgi?id=45207 398 399 When drawing from an ImageBuffer into a GraphicsContext, attempt to do the 400 draw in hardware when possible. This is how canvas 2d's drawImage(canvas, ...) 401 is implemented. Adds new API to DrawingBuffer to request a texture containing 402 the DrawingBuffer's current rendering results. 403 404 Test: covered fast/canvas/drawImage.html and all other tests that draw from one 405 2d canvas into another. 406 407 * html/canvas/CanvasRenderingContext2D.cpp: 408 (WebCore::CanvasRenderingContext2D::drawImage): 409 * platform/graphics/chromium/DrawingBufferChromium.cpp: 410 (WebCore::DrawingBuffer::getRenderingResultsAsTexture): 411 * platform/graphics/gpu/DrawingBuffer.h: 412 * platform/graphics/skia/ImageBufferSkia.cpp: 413 (WebCore::ImageBuffer::draw): 391 414 392 415 2010-09-03 James Robinson <jamesr@chromium.org> -
trunk/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r66782 r66785 1289 1289 canvas()->setOriginTainted(); 1290 1290 1291 #if ENABLE(ACCELERATED_2D_CANVAS) 1292 // If we're drawing from one accelerated canvas 2d to another, avoid calling sourceCanvas->makeRenderingResultsAvailable() 1293 // as that will do a readback to software. 1294 CanvasRenderingContext* sourceContext = sourceCanvas->renderingContext(); 1295 // FIXME: Implement an accelerated path for drawing from a WebGL canvas to a 2d canvas when possible. 1296 if (!isAccelerated() || !sourceContext || !sourceContext->isAccelerated() || !sourceContext->is2d()) 1297 sourceCanvas->makeRenderingResultsAvailable(); 1298 #else 1291 1299 sourceCanvas->makeRenderingResultsAvailable(); 1300 #endif 1292 1301 1293 1302 c->drawImageBuffer(buffer, DeviceColorSpace, destRect, sourceRect, state().m_globalComposite); -
trunk/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
r66780 r66785 120 120 } 121 121 122 unsigned DrawingBuffer::getRenderingResultsAsTexture() 123 { 124 return m_internal->offscreenColorTexture; 122 125 } 126 127 } -
trunk/WebCore/platform/graphics/gpu/DrawingBuffer.h
r66746 r66785 59 59 IntSize size() const { return m_size; } 60 60 61 unsigned getRenderingResultsAsTexture(); 62 61 63 class WillPublishCallback : public Noncopyable { 62 64 public: -
trunk/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
r65921 r66785 37 37 #include "BitmapImage.h" 38 38 #include "BitmapImageSingleFrameSkia.h" 39 #include "DrawingBuffer.h" 40 #include "GLES2Canvas.h" 39 41 #include "GraphicsContext.h" 40 42 #include "ImageData.h" 43 #include "PNGImageEncoder.h" 41 44 #include "PlatformContextSkia.h" 42 #include "PNGImageEncoder.h"43 45 #include "SkColorPriv.h" 44 46 #include "SkiaUtils.h" … … 109 111 CompositeOperator op, bool useLowQualityScale) 110 112 { 113 if (m_data.m_platformContext.useGPU() && context->platformContext()->useGPU()) { 114 DrawingBuffer* sourceDrawingBuffer = m_data.m_platformContext.gpuCanvas()->drawingBuffer(); 115 unsigned sourceTexture = sourceDrawingBuffer->getRenderingResultsAsTexture(); 116 FloatRect destRectFlipped(destRect); 117 destRectFlipped.setY(destRect.y() + destRect.height()); 118 destRectFlipped.setHeight(-destRect.height()); 119 context->platformContext()->gpuCanvas()->drawTexturedRect(sourceTexture, m_size, srcRect, destRectFlipped, styleColorSpace, op); 120 return; 121 } 122 111 123 RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context); 112 124 context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale);
Note: See TracChangeset
for help on using the changeset viewer.