| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
| 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 8 * | 8 * |
| 9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
| 10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return buffer ? buffer->isAccelerated() : false; | 184 return buffer ? buffer->isAccelerated() : false; |
| 185 #elif ENABLE(ACCELERATED_2D_CANVAS) | 185 #elif ENABLE(ACCELERATED_2D_CANVAS) |
| 186 return m_context3D; | 186 return m_context3D; |
| 187 #else | 187 #else |
| 188 return false; | 188 return false; |
| 189 #endif | 189 #endif |
| 190 } | 190 } |
| 191 | 191 |
| 192 bool CanvasRenderingContext2D::paintsIntoCanvasBuffer() const | 192 bool CanvasRenderingContext2D::paintsIntoCanvasBuffer() const |
| 193 { | 193 { |
| 194 #if ENABLE(ACCELERATED_2D_CANVAS) | 194 #if ENABLE(ACCELERATED_2D_CANVAS) && USE(ACCELERATED_COMPOSITING) |
| 195 if (m_context3D) | 195 if (!isAccelerated()) |
| 196 return m_context3D->context()->paintsIntoCanvasBuffer(); | 196 return true; |
| 197 |
| 198 RenderBox* renderBox = canvas()->renderBox(); |
| 199 if (renderBox && renderBox->hasLayer() && renderBox->layer()->hasAccelerated
Compositing()) |
| 200 return false; |
| 197 #endif | 201 #endif |
| 198 return true; | 202 return true; |
| 199 } | 203 } |
| 200 | 204 |
| 201 | 205 |
| 202 void CanvasRenderingContext2D::reset() | 206 void CanvasRenderingContext2D::reset() |
| 203 { | 207 { |
| 204 m_stateStack.resize(1); | 208 m_stateStack.resize(1); |
| 205 m_stateStack.first() = State(); | 209 m_stateStack.first() = State(); |
| 206 m_path.clear(); | 210 m_path.clear(); |
| (...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2040 } | 2044 } |
| 2041 | 2045 |
| 2042 // Try to accelerate. | 2046 // Try to accelerate. |
| 2043 GraphicsContext* ctx = drawingContext(); | 2047 GraphicsContext* ctx = drawingContext(); |
| 2044 if (!ctx) { | 2048 if (!ctx) { |
| 2045 clearAcceleration(); | 2049 clearAcceleration(); |
| 2046 return; | 2050 return; |
| 2047 } | 2051 } |
| 2048 | 2052 |
| 2049 if (!m_context3D) { | 2053 if (!m_context3D) { |
| 2050 Page* page = canvas()->document()->page(); | 2054 m_context3D = SharedGraphicsContext3D::create(0); |
| 2051 m_context3D = SharedGraphicsContext3D::create(page->chrome()); | |
| 2052 if (!m_context3D) { | 2055 if (!m_context3D) { |
| 2053 clearAcceleration(); | 2056 clearAcceleration(); |
| 2054 return; | 2057 return; |
| 2055 } | 2058 } |
| 2056 } | 2059 } |
| 2057 | 2060 |
| 2058 if (m_drawingBuffer) { | 2061 if (m_drawingBuffer) { |
| 2059 if (!m_drawingBuffer->reset(canvas()->size())) { | 2062 if (!m_drawingBuffer->reset(canvas()->size())) { |
| 2060 clearAcceleration(); | 2063 clearAcceleration(); |
| 2061 return; | 2064 return; |
| 2062 } | 2065 } |
| 2063 } else { | 2066 } else { |
| 2064 m_drawingBuffer = m_context3D->context()->createDrawingBuffer(canvas()->
size()); | 2067 m_drawingBuffer = m_context3D->context()->createDrawingBuffer(canvas()->
size()); |
| 2065 if (!m_drawingBuffer) { | 2068 if (!m_drawingBuffer) { |
| 2066 clearAcceleration(); | 2069 clearAcceleration(); |
| 2067 return; | 2070 return; |
| 2068 } | 2071 } |
| 2069 } | 2072 } |
| 2070 | 2073 |
| 2071 ctx->setGraphicsContext3D(m_context3D->context(), m_drawingBuffer.get(), can
vas()->size()); | 2074 ctx->setGraphicsContext3D(m_context3D->context(), m_drawingBuffer.get(), can
vas()->size()); |
| 2072 } | 2075 } |
| 2073 #endif | 2076 #endif |
| 2074 | 2077 |
| 2075 } // namespace WebCore | 2078 } // namespace WebCore |
| OLD | NEW |