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

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

Issue 2212163002: Add some plumbing for the color management of canvases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 4 years, 3 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 /* 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 class PLATFORM_EXPORT Canvas2DLayerBridge : public NON_EXPORTED_BASE(cc::Texture LayerClient), public WebThread::TaskObserver, public RefCounted<Canvas2DLayerBri dge> { 79 class PLATFORM_EXPORT Canvas2DLayerBridge : public NON_EXPORTED_BASE(cc::Texture LayerClient), public WebThread::TaskObserver, public RefCounted<Canvas2DLayerBri dge> {
80 WTF_MAKE_NONCOPYABLE(Canvas2DLayerBridge); 80 WTF_MAKE_NONCOPYABLE(Canvas2DLayerBridge);
81 public: 81 public:
82 enum AccelerationMode { 82 enum AccelerationMode {
83 DisableAcceleration, 83 DisableAcceleration,
84 EnableAcceleration, 84 EnableAcceleration,
85 ForceAccelerationForTesting, 85 ForceAccelerationForTesting,
86 }; 86 };
87 87
88 Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider>, const Int Size&, int msaaSampleCount, OpacityMode, AccelerationMode); 88 Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider>, const Int Size&, int msaaSampleCount, OpacityMode, AccelerationMode, sk_sp<SkColorSpace>);
89
89 ~Canvas2DLayerBridge() override; 90 ~Canvas2DLayerBridge() override;
90 91
91 // cc::TextureLayerClient implementation. 92 // cc::TextureLayerClient implementation.
92 bool PrepareTextureMailbox( 93 bool PrepareTextureMailbox(
93 cc::TextureMailbox* outMailbox, 94 cc::TextureMailbox* outMailbox,
94 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback) override ; 95 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback) override ;
95 96
96 // Callback for mailboxes given to the compositor from PrepareTextureMailbox . 97 // Callback for mailboxes given to the compositor from PrepareTextureMailbox .
97 void mailboxReleased(const gpu::Mailbox&, const gpu::SyncToken&, 98 void mailboxReleased(const gpu::Mailbox&, const gpu::SyncToken&,
98 bool lostResource); 99 bool lostResource);
(...skipping 16 matching lines...) Expand all
115 bool writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in t x, int y); 116 bool writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in t x, int y);
116 void flush(); 117 void flush();
117 void flushGpu(); 118 void flushGpu();
118 void prepareSurfaceForPaintingIfNeeded(); 119 void prepareSurfaceForPaintingIfNeeded();
119 bool isHidden() { return m_isHidden; } 120 bool isHidden() { return m_isHidden; }
120 OpacityMode opacityMode() { return m_opacityMode; } 121 OpacityMode opacityMode() { return m_opacityMode; }
121 122
122 void beginDestruction(); 123 void beginDestruction();
123 void hibernate(); 124 void hibernate();
124 bool isHibernating() const { return m_hibernationImage.get(); } 125 bool isHibernating() const { return m_hibernationImage.get(); }
126 sk_sp<SkColorSpace> colorSpace() const { return m_colorSpace; }
125 127
126 PassRefPtr<SkImage> newImageSnapshot(AccelerationHint, SnapshotReason); 128 PassRefPtr<SkImage> newImageSnapshot(AccelerationHint, SnapshotReason);
127 129
128 // The values of the enum entries must not change because they are used for 130 // The values of the enum entries must not change because they are used for
129 // usage metrics histograms. New values can be added to the end. 131 // usage metrics histograms. New values can be added to the end.
130 enum HibernationEvent { 132 enum HibernationEvent {
131 HibernationScheduled = 0, 133 HibernationScheduled = 0,
132 HibernationAbortedDueToDestructionWhileHibernatePending = 1, 134 HibernationAbortedDueToDestructionWhileHibernatePending = 1,
133 HibernationAbortedDueToPendingDestruction = 2, 135 HibernationAbortedDueToPendingDestruction = 2,
134 HibernationAbortedDueToVisibilityChange = 3, 136 HibernationAbortedDueToVisibilityChange = 3,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // We should normally not have more that two active mailboxes at a time, 269 // We should normally not have more that two active mailboxes at a time,
268 // but sometime we may have three due to the async nature of mailbox han dling. 270 // but sometime we may have three due to the async nature of mailbox han dling.
269 MaxActiveMailboxes = 3, 271 MaxActiveMailboxes = 3,
270 }; 272 };
271 273
272 Deque<MailboxInfo, MaxActiveMailboxes> m_mailboxes; 274 Deque<MailboxInfo, MaxActiveMailboxes> m_mailboxes;
273 GLenum m_lastFilter; 275 GLenum m_lastFilter;
274 AccelerationMode m_accelerationMode; 276 AccelerationMode m_accelerationMode;
275 OpacityMode m_opacityMode; 277 OpacityMode m_opacityMode;
276 const IntSize m_size; 278 const IntSize m_size;
279 sk_sp<SkColorSpace> m_colorSpace;
277 int m_recordingPixelCount; 280 int m_recordingPixelCount;
278 281
279 #if USE_IOSURFACE_FOR_2D_CANVAS 282 #if USE_IOSURFACE_FOR_2D_CANVAS
280 // Each element in this vector represents an IOSurface backed texture that 283 // Each element in this vector represents an IOSurface backed texture that
281 // is ready to be reused. 284 // is ready to be reused.
282 // Elements in this vector can safely be purged in low memory conditions. 285 // Elements in this vector can safely be purged in low memory conditions.
283 Vector<ImageInfo> m_imageInfoCache; 286 Vector<ImageInfo> m_imageInfoCache;
284 #endif // USE_IOSURFACE_FOR_2D_CANVAS 287 #endif // USE_IOSURFACE_FOR_2D_CANVAS
285 }; 288 };
286 289
287 } // namespace blink 290 } // namespace blink
288 291
289 #endif 292 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698