Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4352)

Unified Diff: cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc

Issue 11074009: cc: Remove LayerTextureUpdater::Texture::updateRect() callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/frame_buffer_skpicture_canvas_layer_texture_updater.h ('k') | cc/image_layer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc
diff --git a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc
index adfcd07e46148404945533266e70c354a3996bc6..26a538dc3fa42fee00280eb004d9ba30b23e5f58 100644
--- a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc
+++ b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc
@@ -9,35 +9,12 @@
#include "FrameBufferSkPictureCanvasLayerTextureUpdater.h"
-#include "CCProxy.h"
#include "LayerPainterChromium.h"
-#include "SkCanvas.h"
-#include "SkGpuDevice.h"
-#include <public/WebGraphicsContext3D.h>
-#include <public/WebSharedGraphicsContext3D.h>
-
-using WebKit::WebGraphicsContext3D;
-using WebKit::WebSharedGraphicsContext3D;
namespace cc {
-static PassOwnPtr<SkCanvas> createAcceleratedCanvas(GrContext* grContext,
- IntSize canvasSize,
- unsigned textureId)
-{
- GrPlatformTextureDesc textureDesc;
- textureDesc.fFlags = kRenderTarget_GrPlatformTextureFlag;
- textureDesc.fWidth = canvasSize.width();
- textureDesc.fHeight = canvasSize.height();
- textureDesc.fConfig = kSkia8888_GrPixelConfig;
- textureDesc.fTextureHandle = textureId;
- SkAutoTUnref<GrTexture> target(grContext->createPlatformTexture(textureDesc));
- SkAutoTUnref<SkDevice> device(new SkGpuDevice(grContext, target.get()));
- return adoptPtr(new SkCanvas(device.get()));
-}
-
FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::Texture(FrameBufferSkPictureCanvasLayerTextureUpdater* textureUpdater, scoped_ptr<CCPrioritizedTexture> texture)
- : LayerTextureUpdater::Texture(texture.Pass())
+ : LayerTextureUpdater::Texture(texture.Pass())
, m_textureUpdater(textureUpdater)
{
}
@@ -46,13 +23,9 @@ FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::~Texture()
{
}
-void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCResourceProvider* resourceProvider, const IntRect& sourceRect, const IntSize& destOffset)
+void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::update(CCTextureUpdateQueue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, CCRenderingStats&)
{
- WebGraphicsContext3D* sharedContext = CCProxy::hasImplThread() ? WebSharedGraphicsContext3D::compositorThreadContext() : WebSharedGraphicsContext3D::mainThreadContext();
- GrContext* sharedGrContext = CCProxy::hasImplThread() ? WebSharedGraphicsContext3D::compositorThreadGrContext() : WebSharedGraphicsContext3D::mainThreadGrContext();
- if (!sharedContext || !sharedGrContext)
- return;
- textureUpdater()->updateTextureRect(sharedContext, sharedGrContext, resourceProvider, texture(), sourceRect, destOffset);
+ textureUpdater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate);
}
PassRefPtr<FrameBufferSkPictureCanvasLayerTextureUpdater> FrameBufferSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter)
@@ -80,40 +53,5 @@ LayerTextureUpdater::SampledTexelFormat FrameBufferSkPictureCanvasLayerTextureUp
return LayerTextureUpdater::SampledTexelFormatRGBA;
}
-void FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect(WebGraphicsContext3D* context, GrContext* grContext, CCResourceProvider* resourceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset)
-{
- texture->acquireBackingTexture(resourceProvider);
- // Flush the context in which the backing texture is created so that it
- // is available in other shared contexts. It is important to do here
- // because the backing texture is created in one context while it is
- // being written to in another.
- resourceProvider->flush();
- CCResourceProvider::ScopedWriteLockGL lock(resourceProvider, texture->resourceId());
-
- // Make sure ganesh uses the correct GL context.
- context->makeContextCurrent();
- // Create an accelerated canvas to draw on.
- OwnPtr<SkCanvas> canvas = createAcceleratedCanvas(grContext, texture->size(), lock.textureId());
-
- // The compositor expects the textures to be upside-down so it can flip
- // the final composited image. Ganesh renders the image upright so we
- // need to do a y-flip.
- canvas->translate(0.0, texture->size().height());
- canvas->scale(1.0, -1.0);
- // Clip to the destination on the texture that must be updated.
- canvas->clipRect(SkRect::MakeXYWH(destOffset.width(), destOffset.height(), sourceRect.width(), sourceRect.height()));
- // Translate the origin of contentRect to that of destRect.
- // Note that destRect is defined relative to sourceRect.
- canvas->translate(contentRect().x() - sourceRect.x() + destOffset.width(),
- contentRect().y() - sourceRect.y() + destOffset.height());
- drawPicture(canvas.get());
-
- // Flush ganesh context so that all the rendered stuff appears on the texture.
- grContext->flush();
-
- // Flush the GL context so rendering results from this context are visible in the compositor's context.
- context->flush();
-}
-
} // namespace cc
#endif // USE(ACCELERATED_COMPOSITING)
« no previous file with comments | « cc/frame_buffer_skpicture_canvas_layer_texture_updater.h ('k') | cc/image_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698