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

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

Issue 2402273002: DrawingBuffer: Clean up GL state restoration (Closed)
Patch Set: Incorporate review feedback 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 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 class WebLayer; 70 class WebLayer;
71 71
72 // Manages a rendering target (framebuffer + attachment) for a canvas. Can 72 // Manages a rendering target (framebuffer + attachment) for a canvas. Can
73 // publish its rendering results to a WebLayer for compositing. 73 // publish its rendering results to a WebLayer for compositing.
74 class PLATFORM_EXPORT DrawingBuffer 74 class PLATFORM_EXPORT DrawingBuffer
75 : public NON_EXPORTED_BASE(cc::TextureLayerClient), 75 : public NON_EXPORTED_BASE(cc::TextureLayerClient),
76 public RefCounted<DrawingBuffer> { 76 public RefCounted<DrawingBuffer> {
77 WTF_MAKE_NONCOPYABLE(DrawingBuffer); 77 WTF_MAKE_NONCOPYABLE(DrawingBuffer);
78 78
79 public: 79 public:
80 class Client {
81 public:
82 // Returns true if the DrawingBuffer is currently bound for draw.
83 virtual bool DrawingBufferClientIsBoundForDraw() = 0;
84 virtual void DrawingBufferClientRestoreScissorTest() = 0;
85 // Restores the mask and clear value for color, depth, and stencil buffers.
86 virtual void DrawingBufferClientRestoreMaskAndClearValues() = 0;
87 virtual void DrawingBufferClientRestorePixelPackAlignment() = 0;
88 // Restores the GL_TEXTURE_2D binding for the active texture unit only.
89 virtual void DrawingBufferClientRestoreTexture2DBinding() = 0;
90 virtual void DrawingBufferClientRestoreRenderbufferBinding() = 0;
91 virtual void DrawingBufferClientRestoreFramebufferBinding() = 0;
92 virtual void DrawingBufferClientRestorePixelUnpackBufferBinding() = 0;
93 };
94
80 enum PreserveDrawingBuffer { 95 enum PreserveDrawingBuffer {
81 Preserve, 96 Preserve,
82 Discard, 97 Discard,
83 }; 98 };
84 enum WebGLVersion { 99 enum WebGLVersion {
85 WebGL1, 100 WebGL1,
86 WebGL2, 101 WebGL2,
87 }; 102 };
88 103
89 enum ChromiumImageUsage { 104 enum ChromiumImageUsage {
90 AllowChromiumImage, 105 AllowChromiumImage,
91 DisallowChromiumImage, 106 DisallowChromiumImage,
92 }; 107 };
93 108
94 static PassRefPtr<DrawingBuffer> create( 109 static PassRefPtr<DrawingBuffer> create(
95 std::unique_ptr<WebGraphicsContext3DProvider>, 110 std::unique_ptr<WebGraphicsContext3DProvider>,
111 Client*,
96 const IntSize&, 112 const IntSize&,
97 bool premultipliedAlpha, 113 bool premultipliedAlpha,
98 bool wantAlphaChannel, 114 bool wantAlphaChannel,
99 bool wantDepthBuffer, 115 bool wantDepthBuffer,
100 bool wantStencilBuffer, 116 bool wantStencilBuffer,
101 bool wantAntialiasing, 117 bool wantAntialiasing,
102 PreserveDrawingBuffer, 118 PreserveDrawingBuffer,
103 WebGLVersion, 119 WebGLVersion,
104 ChromiumImageUsage); 120 ChromiumImageUsage);
105 static void forceNextDrawingBufferCreationToFail(); 121 static void forceNextDrawingBufferCreationToFail();
106 122
107 ~DrawingBuffer() override; 123 ~DrawingBuffer() override;
108 124
109 // Destruction will be completed after all mailboxes are released. 125 // Destruction will be completed after all mailboxes are released.
110 void beginDestruction(); 126 void beginDestruction();
111 127
112 // Issues a glClear() on all framebuffers associated with this DrawingBuffer. 128 // Issues a glClear() on all framebuffers associated with this DrawingBuffer.
113 // The caller is responsible for making the context current and setting the
114 // clear values and masks. Modifies the framebuffer binding.
115 void clearFramebuffers(GLbitfield clearMask); 129 void clearFramebuffers(GLbitfield clearMask);
116 130
117 // Indicates whether the DrawingBuffer internally allocated a packed 131 // Indicates whether the DrawingBuffer internally allocated a packed
118 // depth-stencil renderbuffer in the situation where the end user only asked 132 // depth-stencil renderbuffer in the situation where the end user only asked
119 // for a depth buffer. In this case, we need to upgrade clears of the depth 133 // for a depth buffer. In this case, we need to upgrade clears of the depth
120 // buffer to clears of the depth and stencil buffers in order to avoid 134 // buffer to clears of the depth and stencil buffers in order to avoid
121 // performance problems on some GPUs. 135 // performance problems on some GPUs.
122 bool hasImplicitStencilBuffer() const { return m_hasImplicitStencilBuffer; } 136 bool hasImplicitStencilBuffer() const { return m_hasImplicitStencilBuffer; }
123 bool hasDepthBuffer() const { return !!m_depthStencilBuffer; } 137 bool hasDepthBuffer() const { return !!m_depthStencilBuffer; }
124 bool hasStencilBuffer() const { return !!m_depthStencilBuffer; } 138 bool hasStencilBuffer() const { return !!m_depthStencilBuffer; }
125 139
126 // Given the desired buffer size, provides the largest dimensions that will 140 // Given the desired buffer size, provides the largest dimensions that will
127 // fit in the pixel budget. 141 // fit in the pixel budget.
128 static IntSize adjustSize(const IntSize& desiredSize, 142 static IntSize adjustSize(const IntSize& desiredSize,
129 const IntSize& curSize, 143 const IntSize& curSize,
130 int maxTextureSize); 144 int maxTextureSize);
131 145
132 // Resizes (or allocates if necessary) all buffers attached to the default 146 // Resizes (or allocates if necessary) all buffers attached to the default
133 // framebuffer. Returns whether the operation was successful. Leaves GL 147 // framebuffer. Returns whether the operation was successful.
134 // bindings dirtied. 148 bool resize(const IntSize&);
135 bool reset(const IntSize&);
136 149
137 // Bind the default framebuffer to |target|. |target| must be 150 // Bind the default framebuffer to |target|. |target| must be
138 // GL_FRAMEBUFFER, GL_READ_FRAMEBUFFER, or GL_DRAW_FRAMEBUFFER. 151 // GL_FRAMEBUFFER, GL_READ_FRAMEBUFFER, or GL_DRAW_FRAMEBUFFER.
139 void bind(GLenum target); 152 void bind(GLenum target);
140 IntSize size() const { return m_size; } 153 IntSize size() const { return m_size; }
141 154
142 // Copies the multisample color buffer to the normal color buffer and leaves 155 // Resolves the multisample color buffer to the normal color buffer and leaves
143 // m_fbo bound. 156 // the resolved color buffer bound to GL_READ_FRAMEBUFFER and
144 void commit(); 157 // GL_DRAW_FRAMEBUFFER.
145 158 void resolveAndBindForReadAndDraw();
146 // commit should copy the full multisample buffer, and not respect the
147 // current scissor bounds. Track the state of the scissor test so that it
148 // can be disabled during calls to commit.
149 void setScissorEnabled(bool scissorEnabled) {
150 m_scissorEnabled = scissorEnabled;
151 }
152
153 // The DrawingBuffer needs to track the texture bound to texture unit 0.
154 // The bound texture is tracked to avoid costly queries during rendering.
155 void setTexture2DBinding(GLuint texture) { m_texture2DBinding = texture; }
156
157 void setPixelUnpackBufferBinding(GLuint buffer) {
158 DCHECK(m_webGLVersion > WebGL1);
159 m_pixelUnpackBufferBinding = buffer;
160 }
161
162 void notifyBufferDeleted(GLuint buffer) {
163 if (m_webGLVersion > WebGL1 && buffer == m_pixelUnpackBufferBinding) {
164 setPixelUnpackBufferBinding(0);
165 }
166 }
167
168 // The DrawingBuffer needs to track the currently bound framebuffer so it
169 // restore the binding when needed.
170 void setFramebufferBinding(GLenum target, GLuint fbo) {
171 switch (target) {
172 case GL_FRAMEBUFFER:
173 m_drawFramebufferBinding = fbo;
174 m_readFramebufferBinding = fbo;
175 break;
176 case GL_DRAW_FRAMEBUFFER:
177 m_drawFramebufferBinding = fbo;
178 break;
179 case GL_READ_FRAMEBUFFER:
180 m_readFramebufferBinding = fbo;
181 break;
182 default:
183 ASSERT(0);
184 }
185 }
186
187 // The DrawingBuffer needs to track the color mask and clear color so that
188 // it can restore it when needed.
189 void setClearColor(GLfloat* clearColor) {
190 memcpy(m_clearColor, clearColor, 4 * sizeof(GLfloat));
191 }
192
193 void setColorMask(GLboolean* colorMask) {
194 memcpy(m_colorMask, colorMask, 4 * sizeof(GLboolean));
195 }
196
197 // The DrawingBuffer needs to track the currently bound renderbuffer so it
198 // restore the binding when needed.
199 void setRenderbufferBinding(GLuint renderbuffer) {
200 m_renderbufferBinding = renderbuffer;
201 }
202
203 // Track the currently active texture unit. Texture unit 0 is used as host for
204 // a scratch texture.
205 void setActiveTextureUnit(GLint textureUnit) {
206 m_activeTextureUnit = textureUnit;
207 }
208 159
209 bool multisample() const; 160 bool multisample() const;
210 161
211 GLuint framebuffer() const;
212
213 bool discardFramebufferSupported() const { 162 bool discardFramebufferSupported() const {
214 return m_discardFramebufferSupported; 163 return m_discardFramebufferSupported;
215 } 164 }
216 165
217 void markContentsChanged(); 166 void markContentsChanged();
218 void setBufferClearNeeded(bool); 167 void setBufferClearNeeded(bool);
219 bool bufferClearNeeded() const; 168 bool bufferClearNeeded() const;
220 void setIsHidden(bool); 169 void setIsHidden(bool);
221 void setFilterQuality(SkFilterQuality); 170 void setFilterQuality(SkFilterQuality);
222 171
(...skipping 16 matching lines...) Expand all
239 bool PrepareTextureMailbox( 188 bool PrepareTextureMailbox(
240 cc::TextureMailbox* outMailbox, 189 cc::TextureMailbox* outMailbox,
241 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback) override; 190 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback) override;
242 191
243 // Returns a StaticBitmapImage backed by a texture containing the current 192 // Returns a StaticBitmapImage backed by a texture containing the current
244 // contents of the front buffer. This is done without any pixel copies. The 193 // contents of the front buffer. This is done without any pixel copies. The
245 // texture in the ImageBitmap is from the active ContextProvider on the 194 // texture in the ImageBitmap is from the active ContextProvider on the
246 // DrawingBuffer. 195 // DrawingBuffer.
247 PassRefPtr<StaticBitmapImage> transferToStaticBitmapImage(); 196 PassRefPtr<StaticBitmapImage> transferToStaticBitmapImage();
248 197
249 // Destroys the TEXTURE_2D binding for the owned context
250 bool copyToPlatformTexture(gpu::gles2::GLES2Interface*, 198 bool copyToPlatformTexture(gpu::gles2::GLES2Interface*,
251 GLuint texture, 199 GLuint texture,
252 GLenum internalFormat, 200 GLenum internalFormat,
253 GLenum destType, 201 GLenum destType,
254 GLint level, 202 GLint level,
255 bool premultiplyAlpha, 203 bool premultiplyAlpha,
256 bool flipY, 204 bool flipY,
257 SourceDrawingBuffer); 205 SourceDrawingBuffer);
258 206
259 void setPackAlignment(GLint param);
260
261 bool paintRenderingResultsToImageData(int&, 207 bool paintRenderingResultsToImageData(int&,
262 int&, 208 int&,
263 SourceDrawingBuffer, 209 SourceDrawingBuffer,
264 WTF::ArrayBufferContents&); 210 WTF::ArrayBufferContents&);
265 211
266 int sampleCount() const { return m_sampleCount; } 212 int sampleCount() const { return m_sampleCount; }
267 bool explicitResolveOfMultisampleData() const { 213 bool explicitResolveOfMultisampleData() const {
268 return m_antiAliasingMode == MSAAExplicitResolve; 214 return m_antiAliasingMode == MSAAExplicitResolve;
269 } 215 }
270 216
271 void restorePixelUnpackBufferBindings(); 217 // Rebind the read and draw framebuffers that WebGL is expecting.
272
273 // Bind to m_drawFramebufferBinding or m_readFramebufferBinding if it's not 0.
274 // Otherwise, bind to the default FBO.
275 void restoreFramebufferBindings(); 218 void restoreFramebufferBindings();
276 219
277 void restoreTextureBindings(); 220 // Restore all state that may have been dirtied by any call.
221 void restoreAllState();
278 222
279 void addNewMailboxCallback(std::unique_ptr<WTF::Closure> closure) { 223 void addNewMailboxCallback(std::unique_ptr<WTF::Closure> closure) {
280 m_newMailboxCallback = std::move(closure); 224 m_newMailboxCallback = std::move(closure);
281 } 225 }
282 226
283 protected: // For unittests 227 protected: // For unittests
284 DrawingBuffer(std::unique_ptr<WebGraphicsContext3DProvider>, 228 DrawingBuffer(std::unique_ptr<WebGraphicsContext3DProvider>,
285 std::unique_ptr<Extensions3DUtil>, 229 std::unique_ptr<Extensions3DUtil>,
230 Client*,
286 bool discardFramebufferSupported, 231 bool discardFramebufferSupported,
287 bool wantAlphaChannel, 232 bool wantAlphaChannel,
288 bool premultipliedAlpha, 233 bool premultipliedAlpha,
289 PreserveDrawingBuffer, 234 PreserveDrawingBuffer,
290 WebGLVersion, 235 WebGLVersion,
291 bool wantsDepth, 236 bool wantsDepth,
292 bool wantsStencil, 237 bool wantsStencil,
293 ChromiumImageUsage); 238 ChromiumImageUsage);
294 239
295 bool initialize(const IntSize&, bool useMultisampling); 240 bool initialize(const IntSize&, bool useMultisampling);
296 241
297 // Shared memory bitmaps that were released by the compositor and can be used 242 // Shared memory bitmaps that were released by the compositor and can be used
298 // again by this DrawingBuffer. 243 // again by this DrawingBuffer.
299 struct RecycledBitmap { 244 struct RecycledBitmap {
300 std::unique_ptr<cc::SharedBitmap> bitmap; 245 std::unique_ptr<cc::SharedBitmap> bitmap;
301 IntSize size; 246 IntSize size;
302 }; 247 };
303 Vector<RecycledBitmap> m_recycledBitmaps; 248 Vector<RecycledBitmap> m_recycledBitmaps;
304 249
305 private: 250 private:
251 friend class ScopedStateRestorer;
252 friend class ColorBuffer;
253
254 // This structure should wrap all public entrypoints that may modify GL state.
255 // It will restore all state when it drops out of scope.
256 class ScopedStateRestorer {
257 public:
258 ScopedStateRestorer(DrawingBuffer*);
259 ~ScopedStateRestorer();
260
261 // Mark parts of the state that are dirty and need to be restored.
262 void setClearStateDirty() { m_clearStateDirty = true; }
263 void setPixelPackAlignmentDirty() { m_pixelPackAlignmentDirty = true; }
264 void setTextureBindingDirty() { m_textureBindingDirty = true; }
265 void setRenderbufferBindingDirty() { m_renderbufferBindingDirty = true; }
266 void setFramebufferBindingDirty() { m_framebufferBindingDirty = true; }
267 void setPixelUnpackBufferBindingDirty() {
268 m_pixelUnpackBufferBindingDirty = true;
269 }
270
271 private:
272 RefPtr<DrawingBuffer> m_drawingBuffer;
273 bool m_clearStateDirty = false;
274 bool m_pixelPackAlignmentDirty = false;
275 bool m_textureBindingDirty = false;
276 bool m_renderbufferBindingDirty = false;
277 bool m_framebufferBindingDirty = false;
278 bool m_pixelUnpackBufferBindingDirty = false;
279 };
280
306 // All parameters necessary to generate the texture for the ColorBuffer. 281 // All parameters necessary to generate the texture for the ColorBuffer.
307 struct ColorBufferParameters { 282 struct ColorBufferParameters {
308 DISALLOW_NEW(); 283 DISALLOW_NEW();
309 GLenum target = 0; 284 GLenum target = 0;
310 GLenum internalColorFormat = 0; 285 GLenum internalColorFormat = 0;
311 286
312 // The internal color format used when allocating storage for the 287 // The internal color format used when allocating storage for the
313 // texture. This may be different from internalColorFormat if RGB 288 // texture. This may be different from internalColorFormat if RGB
314 // emulation is required. 289 // emulation is required.
315 GLenum creationInternalColorFormat = 0; 290 GLenum creationInternalColorFormat = 0;
(...skipping 26 matching lines...) Expand all
342 gpu::SyncToken produceSyncToken; 317 gpu::SyncToken produceSyncToken;
343 318
344 // The sync token for when this buffer was received back from the 319 // The sync token for when this buffer was received back from the
345 // compositor. 320 // compositor.
346 gpu::SyncToken receiveSyncToken; 321 gpu::SyncToken receiveSyncToken;
347 322
348 private: 323 private:
349 WTF_MAKE_NONCOPYABLE(ColorBuffer); 324 WTF_MAKE_NONCOPYABLE(ColorBuffer);
350 }; 325 };
351 326
327 // The same as clearFramebuffers(), but leaves GL state dirty.
328 void clearFramebuffersInternal(GLbitfield clearMask);
329
330 // The same as reset(), but leaves GL state dirty.
331 bool resizeFramebufferInternal(const IntSize&);
332
333 // The same as commit(), but leaves GL state dirty.
334 void resolveMultisampleFramebufferInternal();
335
352 bool prepareTextureMailboxInternal( 336 bool prepareTextureMailboxInternal(
353 cc::TextureMailbox* outMailbox, 337 cc::TextureMailbox* outMailbox,
354 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback, 338 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback,
355 bool forceGpuResult); 339 bool forceGpuResult);
356 340
357 // Helper functions to be called only by prepareTextureMailboxInternal. 341 // Helper functions to be called only by prepareTextureMailboxInternal.
358 bool finishPrepareTextureMailboxGpu( 342 bool finishPrepareTextureMailboxGpu(
359 cc::TextureMailbox* outMailbox, 343 cc::TextureMailbox* outMailbox,
360 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback); 344 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback);
361 bool finishPrepareTextureMailboxSoftware( 345 bool finishPrepareTextureMailboxSoftware(
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // implemented by forwarding all draw operations to a multisample 411 // implemented by forwarding all draw operations to a multisample
428 // renderbuffer, which is resolved before any read operations or swaps. 412 // renderbuffer, which is resolved before any read operations or swaps.
429 bool wantExplicitResolve(); 413 bool wantExplicitResolve();
430 414
431 // Whether the WebGL client wants a depth or stencil buffer. 415 // Whether the WebGL client wants a depth or stencil buffer.
432 bool wantDepthOrStencil(); 416 bool wantDepthOrStencil();
433 417
434 // The format to use when creating a multisampled renderbuffer. 418 // The format to use when creating a multisampled renderbuffer.
435 GLenum getMultisampledRenderbufferFormat(); 419 GLenum getMultisampledRenderbufferFormat();
436 420
421 // Weak, reset by beginDestruction.
422 Client* m_client = nullptr;
423
437 const PreserveDrawingBuffer m_preserveDrawingBuffer; 424 const PreserveDrawingBuffer m_preserveDrawingBuffer;
438 const WebGLVersion m_webGLVersion; 425 const WebGLVersion m_webGLVersion;
439 bool m_scissorEnabled = false;
440 GLuint m_texture2DBinding = 0;
441 GLuint m_pixelUnpackBufferBinding = 0;
442 GLuint m_drawFramebufferBinding = 0;
443 GLuint m_readFramebufferBinding = 0;
444 GLuint m_renderbufferBinding = 0;
445 GLenum m_activeTextureUnit = GL_TEXTURE0;
446 GLfloat m_clearColor[4];
447 GLboolean m_colorMask[4];
448 426
449 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; 427 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider;
450 // Lifetime is tied to the m_contextProvider. 428 // Lifetime is tied to the m_contextProvider.
451 gpu::gles2::GLES2Interface* m_gl; 429 gpu::gles2::GLES2Interface* m_gl;
452 std::unique_ptr<Extensions3DUtil> m_extensionsUtil; 430 std::unique_ptr<Extensions3DUtil> m_extensionsUtil;
453 IntSize m_size = {-1, -1}; 431 IntSize m_size = {-1, -1};
454 const bool m_discardFramebufferSupported; 432 const bool m_discardFramebufferSupported;
455 const bool m_wantAlphaChannel; 433 const bool m_wantAlphaChannel;
456 const bool m_premultipliedAlpha; 434 const bool m_premultipliedAlpha;
457 const bool m_softwareRendering; 435 const bool m_softwareRendering;
458 bool m_hasImplicitStencilBuffer = false; 436 bool m_hasImplicitStencilBuffer = false;
459 bool m_storageTextureSupported = false; 437 bool m_storageTextureSupported = false;
460 438
461 std::unique_ptr<WTF::Closure> m_newMailboxCallback; 439 std::unique_ptr<WTF::Closure> m_newMailboxCallback;
462 440
441 // The current state restorer, which is used to track state dirtying. It is in
442 // error to dirty state shared with WebGL while there is no existing state
443 // restorer. It is also in error to instantiate two state restorers at once.
444 ScopedStateRestorer* m_stateRestorer = nullptr;
445
463 // This is used when the user requests either a depth or stencil buffer. 446 // This is used when the user requests either a depth or stencil buffer.
464 GLuint m_depthStencilBuffer = 0; 447 GLuint m_depthStencilBuffer = 0;
465 448
466 // When wantExplicitResolve() returns true, the target of all draw 449 // When wantExplicitResolve() returns true, the target of all draw
467 // operations. 450 // operations.
468 GLuint m_multisampleFBO = 0; 451 GLuint m_multisampleFBO = 0;
469 452
470 // The id of the renderbuffer storage for |m_multisampleFBO|. 453 // The id of the renderbuffer storage for |m_multisampleFBO|.
471 GLuint m_multisampleRenderbuffer = 0; 454 GLuint m_multisampleRenderbuffer = 0;
472 455
(...skipping 26 matching lines...) Expand all
499 None, 482 None,
500 MSAAImplicitResolve, 483 MSAAImplicitResolve,
501 MSAAExplicitResolve, 484 MSAAExplicitResolve,
502 ScreenSpaceAntialiasing, 485 ScreenSpaceAntialiasing,
503 }; 486 };
504 487
505 AntialiasingMode m_antiAliasingMode = None; 488 AntialiasingMode m_antiAliasingMode = None;
506 489
507 int m_maxTextureSize = 0; 490 int m_maxTextureSize = 0;
508 int m_sampleCount = 0; 491 int m_sampleCount = 0;
509 int m_packAlignment = 4;
510 bool m_destructionInProgress = false; 492 bool m_destructionInProgress = false;
511 bool m_isHidden = false; 493 bool m_isHidden = false;
512 SkFilterQuality m_filterQuality = kLow_SkFilterQuality; 494 SkFilterQuality m_filterQuality = kLow_SkFilterQuality;
513 495
514 std::unique_ptr<WebExternalTextureLayer> m_layer; 496 std::unique_ptr<WebExternalTextureLayer> m_layer;
515 497
516 // Mailboxes that were released by the compositor can be used again by this 498 // Mailboxes that were released by the compositor can be used again by this
517 // DrawingBuffer. 499 // DrawingBuffer.
518 Deque<RefPtr<ColorBuffer>> m_recycledColorBufferQueue; 500 Deque<RefPtr<ColorBuffer>> m_recycledColorBufferQueue;
519 501
520 // If the width and height of the Canvas's backing store don't 502 // If the width and height of the Canvas's backing store don't
521 // match those that we were given in the most recent call to 503 // match those that we were given in the most recent call to
522 // reshape(), then we need an intermediate bitmap to read back the 504 // reshape(), then we need an intermediate bitmap to read back the
523 // frame buffer into. This seems to happen when CSS styles are 505 // frame buffer into. This seems to happen when CSS styles are
524 // used to resize the Canvas. 506 // used to resize the Canvas.
525 SkBitmap m_resizingBitmap; 507 SkBitmap m_resizingBitmap;
526 508
527 // In the case of OffscreenCanvas, we do not want to enable the 509 // In the case of OffscreenCanvas, we do not want to enable the
528 // WebGLImageChromium flag, so we replace all the 510 // WebGLImageChromium flag, so we replace all the
529 // RuntimeEnabledFeatures::webGLImageChromiumEnabled() call with 511 // RuntimeEnabledFeatures::webGLImageChromiumEnabled() call with
530 // shouldUseChromiumImage() calls, and set m_chromiumImageUsage to 512 // shouldUseChromiumImage() calls, and set m_chromiumImageUsage to
531 // DisallowChromiumImage in the case of OffscreenCanvas. 513 // DisallowChromiumImage in the case of OffscreenCanvas.
532 ChromiumImageUsage m_chromiumImageUsage; 514 ChromiumImageUsage m_chromiumImageUsage;
533 bool shouldUseChromiumImage(); 515 bool shouldUseChromiumImage();
534 }; 516 };
535 517
536 } // namespace blink 518 } // namespace blink
537 519
538 #endif // DrawingBuffer_h 520 #endif // DrawingBuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698