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

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

Issue 2643343002: DrawingBuffer: Use gfx::GpuMemoryBuffer directly and set color space (Closed)
Patch Set: Fix buffer format Created 3 years, 11 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 22 matching lines...) Expand all
33 33
34 #include "cc/layers/texture_layer_client.h" 34 #include "cc/layers/texture_layer_client.h"
35 #include "gpu/command_buffer/common/mailbox.h" 35 #include "gpu/command_buffer/common/mailbox.h"
36 #include "gpu/command_buffer/common/sync_token.h" 36 #include "gpu/command_buffer/common/sync_token.h"
37 #include "platform/PlatformExport.h" 37 #include "platform/PlatformExport.h"
38 #include "platform/geometry/IntSize.h" 38 #include "platform/geometry/IntSize.h"
39 #include "platform/graphics/GraphicsTypes3D.h" 39 #include "platform/graphics/GraphicsTypes3D.h"
40 #include "platform/graphics/gpu/WebGLImageConversion.h" 40 #include "platform/graphics/gpu/WebGLImageConversion.h"
41 #include "third_party/khronos/GLES2/gl2.h" 41 #include "third_party/khronos/GLES2/gl2.h"
42 #include "third_party/skia/include/core/SkBitmap.h" 42 #include "third_party/skia/include/core/SkBitmap.h"
43 #include "ui/gfx/color_space.h"
43 #include "wtf/Deque.h" 44 #include "wtf/Deque.h"
44 #include "wtf/Noncopyable.h" 45 #include "wtf/Noncopyable.h"
45 #include "wtf/RefCounted.h" 46 #include "wtf/RefCounted.h"
46 #include "wtf/Vector.h" 47 #include "wtf/Vector.h"
47 #include <memory> 48 #include <memory>
48 49
49 namespace cc { 50 namespace cc {
50 class SharedBitmap; 51 class SharedBitmap;
51 } 52 }
52 53
54 namespace gfx {
55 class GpuMemoryBuffer;
56 }
57
53 namespace gpu { 58 namespace gpu {
54 namespace gles2 { 59 namespace gles2 {
55 class GLES2Interface; 60 class GLES2Interface;
56 } 61 }
57 } 62 }
58 63
59 namespace WTF { 64 namespace WTF {
60 class ArrayBufferContents; 65 class ArrayBufferContents;
61 } 66 }
62 67
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // emulation is required. 299 // emulation is required.
295 GLenum creationInternalColorFormat = 0; 300 GLenum creationInternalColorFormat = 0;
296 GLenum colorFormat = 0; 301 GLenum colorFormat = 0;
297 }; 302 };
298 303
299 struct ColorBuffer : public RefCounted<ColorBuffer> { 304 struct ColorBuffer : public RefCounted<ColorBuffer> {
300 ColorBuffer(DrawingBuffer*, 305 ColorBuffer(DrawingBuffer*,
301 const ColorBufferParameters&, 306 const ColorBufferParameters&,
302 const IntSize&, 307 const IntSize&,
303 GLuint textureId, 308 GLuint textureId,
304 GLuint imageId); 309 GLuint imageId,
310 std::unique_ptr<gfx::GpuMemoryBuffer>);
305 ~ColorBuffer(); 311 ~ColorBuffer();
306 312
307 // The owning DrawingBuffer. Note that DrawingBuffer is explicitly destroyed 313 // The owning DrawingBuffer. Note that DrawingBuffer is explicitly destroyed
308 // by the beginDestruction method, which will eventually drain all of its 314 // by the beginDestruction method, which will eventually drain all of its
309 // ColorBuffers. 315 // ColorBuffers.
310 RefPtr<DrawingBuffer> drawingBuffer; 316 RefPtr<DrawingBuffer> drawingBuffer;
311 317
312 const ColorBufferParameters parameters; 318 const ColorBufferParameters parameters;
313 const IntSize size; 319 const IntSize size;
314 320
315 const GLuint textureId = 0; 321 const GLuint textureId = 0;
316 const GLuint imageId = 0; 322 const GLuint imageId = 0;
323 std::unique_ptr<gfx::GpuMemoryBuffer> gpuMemoryBuffer;
317 324
318 // The mailbox used to send this buffer to the compositor. 325 // The mailbox used to send this buffer to the compositor.
319 gpu::Mailbox mailbox; 326 gpu::Mailbox mailbox;
320 327
321 // The sync token for when this buffer was sent to the compositor. 328 // The sync token for when this buffer was sent to the compositor.
322 gpu::SyncToken produceSyncToken; 329 gpu::SyncToken produceSyncToken;
323 330
324 // The sync token for when this buffer was received back from the 331 // The sync token for when this buffer was received back from the
325 // compositor. 332 // compositor.
326 gpu::SyncToken receiveSyncToken; 333 gpu::SyncToken receiveSyncToken;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 483
477 // True if commit() has been called since the last time markContentsChanged() 484 // True if commit() has been called since the last time markContentsChanged()
478 // had been called. 485 // had been called.
479 bool m_contentsChangeCommitted = false; 486 bool m_contentsChangeCommitted = false;
480 bool m_bufferClearNeeded = false; 487 bool m_bufferClearNeeded = false;
481 488
482 // Whether the client wants a depth or stencil buffer. 489 // Whether the client wants a depth or stencil buffer.
483 const bool m_wantDepth; 490 const bool m_wantDepth;
484 const bool m_wantStencil; 491 const bool m_wantStencil;
485 492
493 // The color space of this buffer. All buffers are assumed to be sRGB until
494 // a mechanism for creating otherwise is exposed to the web.
495 const gfx::ColorSpace m_colorSpace;
496
486 enum AntialiasingMode { 497 enum AntialiasingMode {
487 None, 498 None,
488 MSAAImplicitResolve, 499 MSAAImplicitResolve,
489 MSAAExplicitResolve, 500 MSAAExplicitResolve,
490 ScreenSpaceAntialiasing, 501 ScreenSpaceAntialiasing,
491 }; 502 };
492 503
493 AntialiasingMode m_antiAliasingMode = None; 504 AntialiasingMode m_antiAliasingMode = None;
494 505
495 int m_maxTextureSize = 0; 506 int m_maxTextureSize = 0;
(...skipping 20 matching lines...) Expand all
516 // RuntimeEnabledFeatures::webGLImageChromiumEnabled() call with 527 // RuntimeEnabledFeatures::webGLImageChromiumEnabled() call with
517 // shouldUseChromiumImage() calls, and set m_chromiumImageUsage to 528 // shouldUseChromiumImage() calls, and set m_chromiumImageUsage to
518 // DisallowChromiumImage in the case of OffscreenCanvas. 529 // DisallowChromiumImage in the case of OffscreenCanvas.
519 ChromiumImageUsage m_chromiumImageUsage; 530 ChromiumImageUsage m_chromiumImageUsage;
520 bool shouldUseChromiumImage(); 531 bool shouldUseChromiumImage();
521 }; 532 };
522 533
523 } // namespace blink 534 } // namespace blink
524 535
525 #endif // DrawingBuffer_h 536 #endif // DrawingBuffer_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/DEPS ('k') | third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698