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

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

Issue 2820823004: Make Canvas2DLayerBridge use SkColorSpaceXformCanvas (Closed)
Patch Set: Put behind flag Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 30 matching lines...) Expand all
41 #include "platform/graphics/gpu/SharedContextRateLimiter.h" 41 #include "platform/graphics/gpu/SharedContextRateLimiter.h"
42 #include "platform/graphics/paint/PaintCanvas.h" 42 #include "platform/graphics/paint/PaintCanvas.h"
43 #include "platform/instrumentation/tracing/TraceEvent.h" 43 #include "platform/instrumentation/tracing/TraceEvent.h"
44 #include "platform/wtf/PtrUtil.h" 44 #include "platform/wtf/PtrUtil.h"
45 #include "public/platform/Platform.h" 45 #include "public/platform/Platform.h"
46 #include "public/platform/WebCompositorSupport.h" 46 #include "public/platform/WebCompositorSupport.h"
47 #include "public/platform/WebGraphicsContext3DProvider.h" 47 #include "public/platform/WebGraphicsContext3DProvider.h"
48 #include "public/platform/WebScheduler.h" 48 #include "public/platform/WebScheduler.h"
49 #include "public/platform/WebTraceLocation.h" 49 #include "public/platform/WebTraceLocation.h"
50 #include "skia/ext/texture_handle.h" 50 #include "skia/ext/texture_handle.h"
51 #include "third_party/skia/include/core/SkColorSpaceXformCanvas.h"
51 #include "third_party/skia/include/core/SkData.h" 52 #include "third_party/skia/include/core/SkData.h"
52 #include "third_party/skia/include/core/SkSurface.h" 53 #include "third_party/skia/include/core/SkSurface.h"
53 #include "third_party/skia/include/gpu/GrContext.h" 54 #include "third_party/skia/include/gpu/GrContext.h"
54 #include "third_party/skia/include/gpu/GrTexture.h" 55 #include "third_party/skia/include/gpu/GrTexture.h"
55 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" 56 #include "third_party/skia/include/gpu/gl/GrGLTypes.h"
56 57
57 namespace { 58 namespace {
58 enum { 59 enum {
59 InvalidMailboxIndex = -1, 60 InvalidMailboxIndex = -1,
60 MaxCanvasAnimationBacklog = 2, // Make sure the the GPU is never more than 61 MaxCanvasAnimationBacklog = 2, // Make sure the the GPU is never more than
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 if (rate_limiter_) 773 if (rate_limiter_)
773 rate_limiter_->Reset(); 774 rate_limiter_->Reset();
774 } 775 }
775 } 776 }
776 777
777 void Canvas2DLayerBridge::FlushRecordingOnly() { 778 void Canvas2DLayerBridge::FlushRecordingOnly() {
778 DCHECK(!destruction_in_progress_); 779 DCHECK(!destruction_in_progress_);
779 780
780 if (have_recorded_draw_commands_ && GetOrCreateSurface()) { 781 if (have_recorded_draw_commands_ && GetOrCreateSurface()) {
781 TRACE_EVENT0("cc", "Canvas2DLayerBridge::flushRecordingOnly"); 782 TRACE_EVENT0("cc", "Canvas2DLayerBridge::flushRecordingOnly");
782 recorder_->finishRecordingAsPicture()->playback( 783
783 GetOrCreateSurface()->getCanvas()); 784 SkCanvas* canvas = GetOrCreateSurface()->getCanvas();
785 std::unique_ptr<SkCanvas> color_transform_canvas;
786 if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled() &&
787 !sk_surfaces_use_color_space_) {
788 color_transform_canvas =
789 SkCreateColorSpaceXformCanvas(canvas, color_space_.ToSkColorSpace());
msarett1 2017/04/17 18:57:50 Just curious, is color_space_ always sRGB?
ccameron 2017/04/17 19:35:13 For legacy canvas, yes. For the rasterization of w
790 canvas = color_transform_canvas.get();
791 }
792
793 recorder_->finishRecordingAsPicture()->playback(canvas);
784 if (is_deferral_enabled_) 794 if (is_deferral_enabled_)
785 StartRecording(); 795 StartRecording();
786 have_recorded_draw_commands_ = false; 796 have_recorded_draw_commands_ = false;
787 } 797 }
788 } 798 }
789 799
790 void Canvas2DLayerBridge::Flush() { 800 void Canvas2DLayerBridge::Flush() {
791 if (!did_draw_since_last_flush_) 801 if (!did_draw_since_last_flush_)
792 return; 802 return;
793 TRACE_EVENT0("cc", "Canvas2DLayerBridge::flush"); 803 TRACE_EVENT0("cc", "Canvas2DLayerBridge::flush");
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 default; 1127 default;
1118 1128
1119 void Canvas2DLayerBridge::Logger::ReportHibernationEvent( 1129 void Canvas2DLayerBridge::Logger::ReportHibernationEvent(
1120 HibernationEvent event) { 1130 HibernationEvent event) {
1121 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernation_histogram, 1131 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernation_histogram,
1122 ("Canvas.HibernationEvents", kHibernationEventCount)); 1132 ("Canvas.HibernationEvents", kHibernationEventCount));
1123 hibernation_histogram.Count(event); 1133 hibernation_histogram.Count(event);
1124 } 1134 }
1125 1135
1126 } // namespace blink 1136 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698