Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp

Issue 2425113002: Fix the linear-rgb canvas color space so that it renders (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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( 20 RecordingImageBufferSurface::RecordingImageBufferSurface(
21 const IntSize& size, 21 const IntSize& size,
22 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory, 22 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> fallbackFactory,
23 OpacityMode opacityMode, 23 OpacityMode opacityMode,
24 sk_sp<SkColorSpace> colorSpace) 24 sk_sp<SkColorSpace> colorSpace,
25 : ImageBufferSurface(size, opacityMode, std::move(colorSpace)), 25 SkColorType colorType)
26 : ImageBufferSurface(size, opacityMode, std::move(colorSpace), colorType),
26 m_imageBuffer(0), 27 m_imageBuffer(0),
27 m_currentFramePixelCount(0), 28 m_currentFramePixelCount(0),
28 m_previousFramePixelCount(0), 29 m_previousFramePixelCount(0),
29 m_frameWasCleared(true), 30 m_frameWasCleared(true),
30 m_didRecordDrawCommandsInCurrentFrame(false), 31 m_didRecordDrawCommandsInCurrentFrame(false),
31 m_currentFrameHasExpensiveOp(false), 32 m_currentFrameHasExpensiveOp(false),
32 m_previousFrameHasExpensiveOp(false), 33 m_previousFrameHasExpensiveOp(false),
33 m_fallbackFactory(std::move(fallbackFactory)) { 34 m_fallbackFactory(std::move(fallbackFactory)) {
34 initializeCurrentFrame(); 35 initializeCurrentFrame();
35 } 36 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 ASSERT(!m_currentFrame); 88 ASSERT(!m_currentFrame);
88 return; 89 return;
89 } 90 }
90 91
91 DEFINE_THREAD_SAFE_STATIC_LOCAL( 92 DEFINE_THREAD_SAFE_STATIC_LOCAL(
92 EnumerationHistogram, canvasFallbackHistogram, 93 EnumerationHistogram, canvasFallbackHistogram,
93 new EnumerationHistogram("Canvas.DisplayListFallbackReason", 94 new EnumerationHistogram("Canvas.DisplayListFallbackReason",
94 FallbackReasonCount)); 95 FallbackReasonCount));
95 canvasFallbackHistogram.count(reason); 96 canvasFallbackHistogram.count(reason);
96 97
97 m_fallbackSurface = 98 m_fallbackSurface = m_fallbackFactory->createSurface(
98 m_fallbackFactory->createSurface(size(), getOpacityMode(), colorSpace()); 99 size(), getOpacityMode(), colorSpace(), colorType());
99 m_fallbackSurface->setImageBuffer(m_imageBuffer); 100 m_fallbackSurface->setImageBuffer(m_imageBuffer);
100 101
101 if (m_previousFrame) { 102 if (m_previousFrame) {
102 m_previousFrame->playback(m_fallbackSurface->canvas()); 103 m_previousFrame->playback(m_fallbackSurface->canvas());
103 m_previousFrame.reset(); 104 m_previousFrame.reset();
104 } 105 }
105 106
106 if (m_currentFrame) { 107 if (m_currentFrame) {
107 m_currentFrame->finishRecordingAsPicture()->playback( 108 m_currentFrame->finishRecordingAsPicture()->playback(
108 m_fallbackSurface->canvas()); 109 m_fallbackSurface->canvas());
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 386 }
386 387
387 void RecordingImageBufferSurface::setIsHidden(bool hidden) { 388 void RecordingImageBufferSurface::setIsHidden(bool hidden) {
388 if (m_fallbackSurface) 389 if (m_fallbackSurface)
389 m_fallbackSurface->setIsHidden(hidden); 390 m_fallbackSurface->setIsHidden(hidden);
390 else 391 else
391 ImageBufferSurface::setIsHidden(hidden); 392 ImageBufferSurface::setIsHidden(hidden);
392 } 393 }
393 394
394 } // namespace blink 395 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698