Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 (!sk_surfaces_use_color_space_) { | |
|
ccameron
2017/04/15 01:15:49
Is there a reason why we can't plumb the CanvasCol
Justin Novosad
2017/04/17 14:41:21
We could. I think that we originally thought gfx::
ccameron
2017/04/17 18:27:17
Okay -- I may add a CanvasColorSpace.h with some h
| |
| 787 color_transform_canvas = | |
| 788 SkCreateColorSpaceXformCanvas(canvas, color_space_.ToSkColorSpace()); | |
|
Justin Novosad
2017/04/17 14:41:21
Why is this necessary? In CreateSkSurface (above),
ccameron
2017/04/17 18:27:17
Tagging a surface with a color space opts us in to
msarett1
2017/04/17 18:42:46
+1, this is the recommended approach.
| |
| 789 canvas = color_transform_canvas.get(); | |
| 790 } | |
| 791 | |
| 792 recorder_->finishRecordingAsPicture()->playback(canvas); | |
| 784 if (is_deferral_enabled_) | 793 if (is_deferral_enabled_) |
| 785 StartRecording(); | 794 StartRecording(); |
| 786 have_recorded_draw_commands_ = false; | 795 have_recorded_draw_commands_ = false; |
| 787 } | 796 } |
| 788 } | 797 } |
| 789 | 798 |
| 790 void Canvas2DLayerBridge::Flush() { | 799 void Canvas2DLayerBridge::Flush() { |
| 791 if (!did_draw_since_last_flush_) | 800 if (!did_draw_since_last_flush_) |
| 792 return; | 801 return; |
| 793 TRACE_EVENT0("cc", "Canvas2DLayerBridge::flush"); | 802 TRACE_EVENT0("cc", "Canvas2DLayerBridge::flush"); |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1117 default; | 1126 default; |
| 1118 | 1127 |
| 1119 void Canvas2DLayerBridge::Logger::ReportHibernationEvent( | 1128 void Canvas2DLayerBridge::Logger::ReportHibernationEvent( |
| 1120 HibernationEvent event) { | 1129 HibernationEvent event) { |
| 1121 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernation_histogram, | 1130 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernation_histogram, |
| 1122 ("Canvas.HibernationEvents", kHibernationEventCount)); | 1131 ("Canvas.HibernationEvents", kHibernationEventCount)); |
| 1123 hibernation_histogram.Count(event); | 1132 hibernation_histogram.Count(event); |
| 1124 } | 1133 } |
| 1125 | 1134 |
| 1126 } // namespace blink | 1135 } // namespace blink |
| OLD | NEW |