| 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/graphics/CanvasMetrics.h" | 8 #include "platform/graphics/CanvasMetrics.h" |
| 8 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" | 9 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" |
| 9 #include "platform/graphics/GraphicsContext.h" | 10 #include "platform/graphics/GraphicsContext.h" |
| 10 #include "platform/graphics/ImageBuffer.h" | 11 #include "platform/graphics/ImageBuffer.h" |
| 11 #include "public/platform/Platform.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/PassOwnPtr.h" | 14 #include "wtf/PassOwnPtr.h" |
| 15 #include "wtf/PassRefPtr.h" | 15 #include "wtf/PassRefPtr.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 RecordingImageBufferSurface::RecordingImageBufferSurface(const IntSize& size, Pa
ssOwnPtr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory, OpacityMod
e opacityMode) | 19 RecordingImageBufferSurface::RecordingImageBufferSurface(const IntSize& size, Pa
ssOwnPtr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory, OpacityMod
e opacityMode) |
| 20 : ImageBufferSurface(size, opacityMode) | 20 : ImageBufferSurface(size, opacityMode) |
| 21 , m_imageBuffer(0) | 21 , m_imageBuffer(0) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return m_fallbackSurface->writePixels(origInfo, pixels, rowBytes, x, y); | 68 return m_fallbackSurface->writePixels(origInfo, pixels, rowBytes, x, y); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void RecordingImageBufferSurface::fallBackToRasterCanvas(FallbackReason reason) | 71 void RecordingImageBufferSurface::fallBackToRasterCanvas(FallbackReason reason) |
| 72 { | 72 { |
| 73 if (m_fallbackSurface) { | 73 if (m_fallbackSurface) { |
| 74 ASSERT(!m_currentFrame); | 74 ASSERT(!m_currentFrame); |
| 75 return; | 75 return; |
| 76 } | 76 } |
| 77 | 77 |
| 78 Platform::current()->histogramEnumeration("Canvas.DisplayListFallbackReason"
, reason, FallbackReasonCount); | 78 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, canvasFallbackHistogra
m, new EnumerationHistogram("Canvas.DisplayListFallbackReason", FallbackReasonCo
unt)); |
| 79 canvasFallbackHistogram.count(reason); |
| 79 | 80 |
| 80 m_fallbackSurface = m_fallbackFactory->createSurface(size(), opacityMode()); | 81 m_fallbackSurface = m_fallbackFactory->createSurface(size(), opacityMode()); |
| 81 m_fallbackSurface->setImageBuffer(m_imageBuffer); | 82 m_fallbackSurface->setImageBuffer(m_imageBuffer); |
| 82 | 83 |
| 83 if (m_previousFrame) { | 84 if (m_previousFrame) { |
| 84 m_previousFrame->playback(m_fallbackSurface->canvas()); | 85 m_previousFrame->playback(m_fallbackSurface->canvas()); |
| 85 m_previousFrame.clear(); | 86 m_previousFrame.clear(); |
| 86 } | 87 } |
| 87 | 88 |
| 88 if (m_currentFrame) { | 89 if (m_currentFrame) { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 344 |
| 344 void RecordingImageBufferSurface::setIsHidden(bool hidden) | 345 void RecordingImageBufferSurface::setIsHidden(bool hidden) |
| 345 { | 346 { |
| 346 if (m_fallbackSurface) | 347 if (m_fallbackSurface) |
| 347 m_fallbackSurface->setIsHidden(hidden); | 348 m_fallbackSurface->setIsHidden(hidden); |
| 348 else | 349 else |
| 349 ImageBufferSurface::setIsHidden(hidden); | 350 ImageBufferSurface::setIsHidden(hidden); |
| 350 } | 351 } |
| 351 | 352 |
| 352 } // namespace blink | 353 } // namespace blink |
| OLD | NEW |