Chromium Code Reviews| 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 "platform/graphics/RecordingImageBufferSurface.h" | 5 #include "platform/graphics/RecordingImageBufferSurface.h" |
| 6 | 6 |
| 7 #include "platform/Histogram.h" | 7 #include "platform/Histogram.h" |
| 8 #include "platform/graphics/CanvasMetrics.h" | 8 #include "platform/graphics/CanvasMetrics.h" |
| 9 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" | 9 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" |
| 10 #include "platform/graphics/GraphicsContext.h" | 10 #include "platform/graphics/GraphicsContext.h" |
| 11 #include "platform/graphics/ImageBuffer.h" | 11 #include "platform/graphics/ImageBuffer.h" |
| 12 #include "third_party/skia/include/core/SkCanvas.h" | 12 #include "third_party/skia/include/core/SkCanvas.h" |
| 13 #include "third_party/skia/include/core/SkPictureRecorder.h" | 13 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 14 #include "wtf/PassRefPtr.h" | 14 #include "wtf/PassRefPtr.h" |
| 15 #include "wtf/PtrUtil.h" | 15 #include "wtf/PtrUtil.h" |
| 16 #include <memory> | 16 #include <memory> |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 RecordingImageBufferSurface::RecordingImageBufferSurface(const IntSize& size, st d::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory, Opaci tyMode opacityMode) | 20 RecordingImageBufferSurface::RecordingImageBufferSurface(const IntSize& size, st d::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory, Opaci tyMode opacityMode, sk_sp<SkColorSpace> colorSpace) |
| 21 : ImageBufferSurface(size, opacityMode) | 21 : ImageBufferSurface(size, opacityMode, colorSpace) |
|
Stephen White
2016/08/11 20:41:27
std::move()?
Justin Novosad
2016/08/12 17:40:18
Done.
| |
| 22 , m_imageBuffer(0) | 22 , m_imageBuffer(0) |
| 23 , m_currentFramePixelCount(0) | 23 , m_currentFramePixelCount(0) |
| 24 , m_previousFramePixelCount(0) | 24 , m_previousFramePixelCount(0) |
| 25 , m_frameWasCleared(true) | 25 , m_frameWasCleared(true) |
| 26 , m_didRecordDrawCommandsInCurrentFrame(false) | 26 , m_didRecordDrawCommandsInCurrentFrame(false) |
| 27 , m_currentFrameHasExpensiveOp(false) | 27 , m_currentFrameHasExpensiveOp(false) |
| 28 , m_previousFrameHasExpensiveOp(false) | 28 , m_previousFrameHasExpensiveOp(false) |
| 29 , m_fallbackFactory(std::move(fallbackFactory)) | 29 , m_fallbackFactory(std::move(fallbackFactory)) |
| 30 { | 30 { |
| 31 initializeCurrentFrame(); | 31 initializeCurrentFrame(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 CHECK(reason != FallbackReasonUnknown); | 75 CHECK(reason != FallbackReasonUnknown); |
| 76 | 76 |
| 77 if (m_fallbackSurface) { | 77 if (m_fallbackSurface) { |
| 78 ASSERT(!m_currentFrame); | 78 ASSERT(!m_currentFrame); |
| 79 return; | 79 return; |
| 80 } | 80 } |
| 81 | 81 |
| 82 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, canvasFallbackHistogra m, new EnumerationHistogram("Canvas.DisplayListFallbackReason", FallbackReasonCo unt)); | 82 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, canvasFallbackHistogra m, new EnumerationHistogram("Canvas.DisplayListFallbackReason", FallbackReasonCo unt)); |
| 83 canvasFallbackHistogram.count(reason); | 83 canvasFallbackHistogram.count(reason); |
| 84 | 84 |
| 85 m_fallbackSurface = m_fallbackFactory->createSurface(size(), getOpacityMode( )); | 85 m_fallbackSurface = m_fallbackFactory->createSurface(size(), getOpacityMode( ), colorSpace()); |
| 86 m_fallbackSurface->setImageBuffer(m_imageBuffer); | 86 m_fallbackSurface->setImageBuffer(m_imageBuffer); |
| 87 | 87 |
| 88 if (m_previousFrame) { | 88 if (m_previousFrame) { |
| 89 m_previousFrame->playback(m_fallbackSurface->canvas()); | 89 m_previousFrame->playback(m_fallbackSurface->canvas()); |
| 90 m_previousFrame.clear(); | 90 m_previousFrame.clear(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 if (m_currentFrame) { | 93 if (m_currentFrame) { |
| 94 m_currentFrame->finishRecordingAsPicture()->playback(m_fallbackSurface-> canvas()); | 94 m_currentFrame->finishRecordingAsPicture()->playback(m_fallbackSurface-> canvas()); |
| 95 m_currentFrame.reset(); | 95 m_currentFrame.reset(); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 | 360 |
| 361 void RecordingImageBufferSurface::setIsHidden(bool hidden) | 361 void RecordingImageBufferSurface::setIsHidden(bool hidden) |
| 362 { | 362 { |
| 363 if (m_fallbackSurface) | 363 if (m_fallbackSurface) |
| 364 m_fallbackSurface->setIsHidden(hidden); | 364 m_fallbackSurface->setIsHidden(hidden); |
| 365 else | 365 else |
| 366 ImageBufferSurface::setIsHidden(hidden); | 366 ImageBufferSurface::setIsHidden(hidden); |
| 367 } | 367 } |
| 368 | 368 |
| 369 } // namespace blink | 369 } // namespace blink |
| OLD | NEW |