OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "platform/graphics/RecordingImageBufferSurface.h" | 7 #include "platform/graphics/RecordingImageBufferSurface.h" |
8 | 8 |
9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
10 #include "platform/graphics/ImageBuffer.h" | 10 #include "platform/graphics/ImageBuffer.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 void RecordingImageBufferSurface::initializeCurrentFrame() | 31 void RecordingImageBufferSurface::initializeCurrentFrame() |
32 { | 32 { |
33 static SkRTreeFactory rTreeFactory; | 33 static SkRTreeFactory rTreeFactory; |
34 m_currentFrame = adoptPtr(new SkPictureRecorder); | 34 m_currentFrame = adoptPtr(new SkPictureRecorder); |
35 m_currentFrame->beginRecording(size().width(), size().height(), &rTreeFactor
y); | 35 m_currentFrame->beginRecording(size().width(), size().height(), &rTreeFactor
y); |
36 m_initialSaveCount = m_currentFrame->getRecordingCanvas()->getSaveCount(); | 36 m_initialSaveCount = m_currentFrame->getRecordingCanvas()->getSaveCount(); |
37 if (m_graphicsContext) { | 37 if (m_graphicsContext) { |
38 m_graphicsContext->resetCanvas(m_currentFrame->getRecordingCanvas()); | 38 m_graphicsContext->resetCanvas(m_currentFrame->getRecordingCanvas()); |
39 m_graphicsContext->setTrackOpaqueRegion(true); | 39 m_graphicsContext->setTrackOpaqueRegion(true); |
| 40 m_graphicsContext->setTreatOverwriteAsOpaque(true); |
40 } | 41 } |
41 } | 42 } |
42 | 43 |
43 void RecordingImageBufferSurface::setImageBuffer(ImageBuffer* imageBuffer) | 44 void RecordingImageBufferSurface::setImageBuffer(ImageBuffer* imageBuffer) |
44 { | 45 { |
45 m_graphicsContext = imageBuffer ? imageBuffer->context() : 0; | 46 m_graphicsContext = imageBuffer ? imageBuffer->context() : 0; |
46 if (m_currentFrame && m_graphicsContext) { | 47 if (m_currentFrame && m_graphicsContext) { |
47 m_graphicsContext->setTrackOpaqueRegion(true); | 48 m_graphicsContext->setTrackOpaqueRegion(true); |
| 49 m_graphicsContext->setTreatOverwriteAsOpaque(true); |
48 m_graphicsContext->resetCanvas(m_currentFrame->getRecordingCanvas()); | 50 m_graphicsContext->resetCanvas(m_currentFrame->getRecordingCanvas()); |
49 } | 51 } |
50 } | 52 } |
51 | 53 |
52 void RecordingImageBufferSurface::willReadback() | 54 void RecordingImageBufferSurface::willReadback() |
53 { | 55 { |
54 fallBackToRasterCanvas(); | 56 fallBackToRasterCanvas(); |
55 } | 57 } |
56 | 58 |
57 void RecordingImageBufferSurface::fallBackToRasterCanvas() | 59 void RecordingImageBufferSurface::fallBackToRasterCanvas() |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 140 |
139 SkCanvas* newCanvas = m_currentFrame->getRecordingCanvas(); | 141 SkCanvas* newCanvas = m_currentFrame->getRecordingCanvas(); |
140 newCanvas->concat(ctm); | 142 newCanvas->concat(ctm); |
141 newCanvas->clipRect(clip); | 143 newCanvas->clipRect(clip); |
142 | 144 |
143 m_frameWasCleared = false; | 145 m_frameWasCleared = false; |
144 return true; | 146 return true; |
145 } | 147 } |
146 | 148 |
147 } // namespace WebCore | 149 } // namespace WebCore |
OLD | NEW |