OLD | NEW |
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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 bool HTMLCanvasElement::shouldBeDirectComposited() const | 274 bool HTMLCanvasElement::shouldBeDirectComposited() const |
275 { | 275 { |
276 return (m_context && m_context->isAccelerated()) || (hasImageBuffer() && buf
fer()->isExpensiveToPaint()) || (!!m_surfaceLayerBridge); | 276 return (m_context && m_context->isAccelerated()) || (hasImageBuffer() && buf
fer()->isExpensiveToPaint()) || (!!m_surfaceLayerBridge); |
277 } | 277 } |
278 | 278 |
279 bool HTMLCanvasElement::isPaintable() const | 279 bool HTMLCanvasElement::isPaintable() const |
280 { | 280 { |
281 return (m_context && m_context->isPaintable()) || ImageBuffer::canCreateImag
eBuffer(size()); | 281 return (m_context && m_context->isPaintable()) || ImageBuffer::canCreateImag
eBuffer(size()); |
282 } | 282 } |
283 | 283 |
| 284 bool HTMLCanvasElement::isAccelerated() const |
| 285 { |
| 286 return m_context && m_context->isAccelerated(); |
| 287 } |
| 288 |
284 void HTMLCanvasElement::didDraw(const FloatRect& rect) | 289 void HTMLCanvasElement::didDraw(const FloatRect& rect) |
285 { | 290 { |
286 if (rect.isEmpty()) | 291 if (rect.isEmpty()) |
287 return; | 292 return; |
288 m_imageBufferIsClear = false; | 293 m_imageBufferIsClear = false; |
289 clearCopiedImage(); | 294 clearCopiedImage(); |
290 if (layoutObject()) | 295 if (layoutObject()) |
291 layoutObject()->setMayNeedPaintInvalidation(); | 296 layoutObject()->setMayNeedPaintInvalidation(); |
292 if (m_context && m_context->is2d() && m_context->shouldAntialias() && page()
&& page()->deviceScaleFactor() > 1.0f) { | 297 if (m_context && m_context->is2d() && m_context->shouldAntialias() && page()
&& page()->deviceScaleFactor() > 1.0f) { |
293 FloatRect inflatedRect = rect; | 298 FloatRect inflatedRect = rect; |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 bool HTMLCanvasElement::createSurfaceLayer() | 1303 bool HTMLCanvasElement::createSurfaceLayer() |
1299 { | 1304 { |
1300 DCHECK(!m_surfaceLayerBridge); | 1305 DCHECK(!m_surfaceLayerBridge); |
1301 mojom::blink::OffscreenCanvasSurfacePtr service; | 1306 mojom::blink::OffscreenCanvasSurfacePtr service; |
1302 Platform::current()->interfaceProvider()->getInterface(mojo::GetProxy(&servi
ce)); | 1307 Platform::current()->interfaceProvider()->getInterface(mojo::GetProxy(&servi
ce)); |
1303 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(ser
vice))); | 1308 m_surfaceLayerBridge = wrapUnique(new CanvasSurfaceLayerBridge(std::move(ser
vice))); |
1304 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height(
)); | 1309 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), this->height(
)); |
1305 } | 1310 } |
1306 | 1311 |
1307 } // namespace blink | 1312 } // namespace blink |
OLD | NEW |