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

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

Issue 1752083003: mac: Use IOSurfaces in Canvas2DLayerBridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp36_canvas2d_refactor
Patch Set: Compile error. Created 4 years, 9 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 void setLoggerForTesting(PassOwnPtr<Logger>); 126 void setLoggerForTesting(PassOwnPtr<Logger>);
127 127
128 private: 128 private:
129 struct MailboxInfo { 129 struct MailboxInfo {
130 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 130 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
131 WebExternalTextureMailbox m_mailbox; 131 WebExternalTextureMailbox m_mailbox;
132 RefPtr<SkImage> m_image; 132 RefPtr<SkImage> m_image;
133 RefPtr<Canvas2DLayerBridge> m_parentLayerBridge; 133 RefPtr<Canvas2DLayerBridge> m_parentLayerBridge;
134 134
135 // If this mailbox wraps an IOSurface-backed texture, the ids of the
136 // CHROMIUM image and the texture.
137 GLuint m_CHROMIUMImageId = 0;
Justin Novosad 2016/03/02 16:33:45 Can we use "#if OS(MACOSX)" for this (and the code
138 GLuint m_textureId = 0;
139
135 MailboxInfo(const MailboxInfo&); 140 MailboxInfo(const MailboxInfo&);
136 MailboxInfo() {} 141 MailboxInfo() {}
137 }; 142 };
138 143
139 Canvas2DLayerBridge(PassOwnPtr<WebGraphicsContext3DProvider>, const IntSize& , int msaaSampleCount, OpacityMode, AccelerationMode); 144 Canvas2DLayerBridge(PassOwnPtr<WebGraphicsContext3DProvider>, const IntSize& , int msaaSampleCount, OpacityMode, AccelerationMode);
140 WebGraphicsContext3D* context(); 145 WebGraphicsContext3D* context();
141 void startRecording(); 146 void startRecording();
142 void skipQueuedDrawCommands(); 147 void skipQueuedDrawCommands();
143 void flushRecordingOnly(); 148 void flushRecordingOnly();
144 void unregisterTaskObserver(); 149 void unregisterTaskObserver();
145 void reportSurfaceCreationFailure(); 150 void reportSurfaceCreationFailure();
146 151
147 // WebThread::TaskOberver implementation 152 // WebThread::TaskOberver implementation
148 void willProcessTask() override; 153 void willProcessTask() override;
149 void didProcessTask() override; 154 void didProcessTask() override;
150 155
151 SkSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration); 156 SkSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration);
152 bool shouldAccelerate(AccelerationHint) const; 157 bool shouldAccelerate(AccelerationHint) const;
153 158
154 // Returns the GL filter associated with |m_filterQuality|. 159 // Returns the GL filter associated with |m_filterQuality|.
155 GLenum getGLFilter(); 160 GLenum getGLFilter();
156 161
162 // Creates an IOSurface-backed texture. Copies |image| into the texture.
163 // Prepares a mailbox from the texture. Stores all information in a newly
164 // created MailboxInfo, which resides in |m_mailboxes|. Returns whether the
165 // mailbox was successfully prepared. |mailbox| is an out parameter only
166 // populated on success.
167 bool prepareIOSurfaceMailboxFromImage(RefPtr<SkImage>&, WebExternalTextureMa ilbox*);
168
169 // Creates an IOSurface-backed texture. Returns whether the texture ewas
170 // successfully created. |texture| and |imageId| are out parameters. The
171 // caller takes ownership of both the texture and the image.
172 bool createIOSurfaceBackedTexture(GLuint* texture, GLuint* imageId);
173
157 // Prepends a new MailboxInfo object to |m_mailboxes|, and returns a 174 // Prepends a new MailboxInfo object to |m_mailboxes|, and returns a
158 // reference. The reference is no longer valid after |m_mailboxes| is 175 // reference. The reference is no longer valid after |m_mailboxes| is
159 // mutated. 176 // mutated.
160 MailboxInfo& createMailboxInfo(); 177 MailboxInfo& createMailboxInfo();
161 178
162 // Returns whether the mailbox was successfully prepared from the SkImage. 179 // Returns whether the mailbox was successfully prepared from the SkImage.
163 // The mailbox is an out parameter only populated on success. 180 // The mailbox is an out parameter only populated on success.
164 bool prepareMailboxFromImage(RefPtr<SkImage>&, WebExternalTextureMailbox*); 181 bool prepareMailboxFromImage(RefPtr<SkImage>&, WebExternalTextureMailbox*);
165 182
166 OwnPtr<SkPictureRecorder> m_recorder; 183 OwnPtr<SkPictureRecorder> m_recorder;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 GLenum m_lastFilter; 217 GLenum m_lastFilter;
201 AccelerationMode m_accelerationMode; 218 AccelerationMode m_accelerationMode;
202 OpacityMode m_opacityMode; 219 OpacityMode m_opacityMode;
203 IntSize m_size; 220 IntSize m_size;
204 int m_recordingPixelCount; 221 int m_recordingPixelCount;
205 }; 222 };
206 223
207 } // namespace blink 224 } // namespace blink
208 225
209 #endif 226 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698