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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 2101823002: Revert of Make 2D canvas disable gpu acceleration when getImageData is called (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 if (ro && (!m_context || !m_context->isAccelerated())) { 311 if (ro && (!m_context || !m_context->isAccelerated())) {
312 LayoutRect mappedDirtyRect(enclosingIntRect(mapRect(m_dirtyRect, srcRect , FloatRect(ro->contentBoxRect())))); 312 LayoutRect mappedDirtyRect(enclosingIntRect(mapRect(m_dirtyRect, srcRect , FloatRect(ro->contentBoxRect()))));
313 // For querying PaintLayer::compositingState() 313 // For querying PaintLayer::compositingState()
314 // FIXME: is this invalidation using the correct compositing state? 314 // FIXME: is this invalidation using the correct compositing state?
315 DisableCompositingQueryAsserts disabler; 315 DisableCompositingQueryAsserts disabler;
316 ro->invalidatePaintRectangle(mappedDirtyRect); 316 ro->invalidatePaintRectangle(mappedDirtyRect);
317 } 317 }
318 m_dirtyRect = FloatRect(); 318 m_dirtyRect = FloatRect();
319 } 319 }
320 320
321 void HTMLCanvasElement::didDisableAcceleration()
322 {
323 // We must force a paint invalidation on the canvas even if it's
324 // content did not change because it layer was destroyed.
325 didDraw(FloatRect(0, 0, size().width(), size().height()));
326 }
327
328 void HTMLCanvasElement::restoreCanvasMatrixClipStack(SkCanvas* canvas) const 321 void HTMLCanvasElement::restoreCanvasMatrixClipStack(SkCanvas* canvas) const
329 { 322 {
330 if (m_context) 323 if (m_context)
331 m_context->restoreCanvasMatrixClipStack(canvas); 324 m_context->restoreCanvasMatrixClipStack(canvas);
332 } 325 }
333 326
334 void HTMLCanvasElement::doDeferredPaintInvalidation() 327 void HTMLCanvasElement::doDeferredPaintInvalidation()
335 { 328 {
336 DCHECK(!m_dirtyRect.isEmpty()); 329 DCHECK(!m_dirtyRect.isEmpty());
337 if (!m_context->is2d()) { 330 if (!m_context->is2d()) {
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 1187
1195 bool HTMLCanvasElement::createSurfaceLayer() 1188 bool HTMLCanvasElement::createSurfaceLayer()
1196 { 1189 {
1197 DCHECK(!m_surfaceLayerBridge); 1190 DCHECK(!m_surfaceLayerBridge);
1198 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl()); 1191 std::unique_ptr<CanvasSurfaceLayerBridgeClient> bridgeClient = wrapUnique(ne w CanvasSurfaceLayerBridgeClientImpl());
1199 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient))); 1192 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(bri dgeClient)));
1200 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( )); 1193 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height( ));
1201 } 1194 }
1202 1195
1203 } // namespace blink 1196 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698