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

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl.h

Issue 806653006: Update GPU memory buffers to use StrideInBytes internally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
(...skipping 15 matching lines...) Expand all
26 // thread as this function was called on and instance was created on. 26 // thread as this function was called on and instance was created on.
27 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( 27 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle(
28 const gfx::GpuMemoryBufferHandle& handle, 28 const gfx::GpuMemoryBufferHandle& handle,
29 const gfx::Size& size, 29 const gfx::Size& size,
30 Format format, 30 Format format,
31 const DestructionCallback& callback); 31 const DestructionCallback& callback);
32 32
33 // Type-checking upcast routine. Returns an NULL on failure. 33 // Type-checking upcast routine. Returns an NULL on failure.
34 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); 34 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer);
35 35
36 // Returns the number of bytes per pixel that must be used by an 36 // Returns the number of bits per pixel that must be used by an
37 // implementation when using |format|. 37 // implementation when using |format|.
38 static size_t BytesPerPixel(Format format); 38 static size_t BitsPerPixel(Format format);
39
40 // Returns the number of bytes that an implementation must use to store
41 // |pixel_count| number of pixels.
42 static size_t PixelsToBytes(
43 size_t pixel_count,
44 gfx::GpuMemoryBuffer::Format format);
reveman 2014/12/15 17:33:34 Hm, this doesn't work with stride != width * bytes
christiank 2014/12/16 12:02:52 You're right. This code is based on the assumption
reveman 2014/12/16 16:40:12 Thanks for explaining. Not supporting some dimens
christiank 2014/12/18 13:58:29 Sounds good to me. I have now replaced PixelsToByt
39 45
40 // Overridden from gfx::GpuMemoryBuffer: 46 // Overridden from gfx::GpuMemoryBuffer:
41 bool IsMapped() const override; 47 bool IsMapped() const override;
42 Format GetFormat() const override; 48 Format GetFormat() const override;
43 ClientBuffer AsClientBuffer() override; 49 ClientBuffer AsClientBuffer() override;
44 50
45 void set_destruction_sync_point(uint32 sync_point) { 51 void set_destruction_sync_point(uint32 sync_point) {
46 destruction_sync_point_ = sync_point; 52 destruction_sync_point_ = sync_point;
47 } 53 }
48 54
(...skipping 10 matching lines...) Expand all
59 bool mapped_; 65 bool mapped_;
60 uint32 destruction_sync_point_; 66 uint32 destruction_sync_point_;
61 67
62 private: 68 private:
63 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); 69 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl);
64 }; 70 };
65 71
66 } // namespace content 72 } // namespace content
67 73
68 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ 74 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698