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

Side by Side Diff: cc/resources/texture_mailbox.h

Issue 1142343008: cc: Rework overlays to not use the ResourceProvider and pass texture size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 // 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 CC_RESOURCES_TEXTURE_MAILBOX_H_ 5 #ifndef CC_RESOURCES_TEXTURE_MAILBOX_H_
6 #define CC_RESOURCES_TEXTURE_MAILBOX_H_ 6 #define CC_RESOURCES_TEXTURE_MAILBOX_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
11 #include "cc/base/cc_export.h" 11 #include "cc/base/cc_export.h"
12 #include "gpu/command_buffer/common/mailbox_holder.h" 12 #include "gpu/command_buffer/common/mailbox_holder.h"
13 #include "ui/gfx/geometry/size.h" 13 #include "ui/gfx/geometry/size.h"
14 14
15 namespace cc { 15 namespace cc {
16 class SharedBitmap; 16 class SharedBitmap;
17 17
18 // TODO(skaslev, danakj) Rename this class more apropriately since now it 18 // TODO(skaslev, danakj) Rename this class more apropriately since now it
19 // can hold a shared memory resource as well as a texture mailbox. 19 // can hold a shared memory resource as well as a texture mailbox.
20 class CC_EXPORT TextureMailbox { 20 class CC_EXPORT TextureMailbox {
21 public: 21 public:
22 TextureMailbox(); 22 TextureMailbox();
23 explicit TextureMailbox(const gpu::MailboxHolder& mailbox_holder); 23 explicit TextureMailbox(const gpu::MailboxHolder& mailbox_holder);
24 TextureMailbox(const gpu::Mailbox& mailbox, uint32 target, uint32 sync_point); 24 TextureMailbox(const gpu::Mailbox& mailbox, uint32 target, uint32 sync_point);
25 TextureMailbox(const gpu::Mailbox& mailbox,
26 uint32 target,
27 uint32 sync_point,
28 const gfx::Size& size,
danakj 2015/05/29 20:04:15 size_in_pixels?
achaulk 2015/06/01 15:43:10 Done.
29 bool allow_overlay);
25 TextureMailbox(SharedBitmap* shared_bitmap, const gfx::Size& size); 30 TextureMailbox(SharedBitmap* shared_bitmap, const gfx::Size& size);
26 31
27 ~TextureMailbox(); 32 ~TextureMailbox();
28 33
29 bool IsValid() const { return IsTexture() || IsSharedMemory(); } 34 bool IsValid() const { return IsTexture() || IsSharedMemory(); }
30 bool IsTexture() const { return !mailbox_holder_.mailbox.IsZero(); } 35 bool IsTexture() const { return !mailbox_holder_.mailbox.IsZero(); }
31 bool IsSharedMemory() const { return shared_bitmap_ != NULL; } 36 bool IsSharedMemory() const { return shared_bitmap_ != NULL; }
32 37
33 bool Equals(const TextureMailbox&) const; 38 bool Equals(const TextureMailbox&) const;
34 39
35 const gpu::Mailbox& mailbox() const { return mailbox_holder_.mailbox; } 40 const gpu::Mailbox& mailbox() const { return mailbox_holder_.mailbox; }
36 const int8* name() const { return mailbox().name; } 41 const int8* name() const { return mailbox().name; }
37 uint32 target() const { return mailbox_holder_.texture_target; } 42 uint32 target() const { return mailbox_holder_.texture_target; }
38 uint32 sync_point() const { return mailbox_holder_.sync_point; } 43 uint32 sync_point() const { return mailbox_holder_.sync_point; }
39 void set_sync_point(int32 sync_point) { 44 void set_sync_point(int32 sync_point) {
40 mailbox_holder_.sync_point = sync_point; 45 mailbox_holder_.sync_point = sync_point;
41 } 46 }
42 47
43 bool allow_overlay() const { return allow_overlay_; } 48 bool allow_overlay() const { return allow_overlay_; }
44 void set_allow_overlay(bool allow_overlay) { allow_overlay_ = allow_overlay; }
45 bool nearest_neighbor() const { return nearest_neighbor_; } 49 bool nearest_neighbor() const { return nearest_neighbor_; }
46 void set_nearest_neighbor(bool nearest_neighbor) { 50 void set_nearest_neighbor(bool nearest_neighbor) {
47 nearest_neighbor_ = nearest_neighbor; 51 nearest_neighbor_ = nearest_neighbor;
48 } 52 }
53 gfx::Size size() const { return size_; }
danakj 2015/05/29 20:04:15 size_in_pixels? Can you comment when this is vali
achaulk 2015/06/01 15:43:10 Done.
49 54
50 SharedBitmap* shared_bitmap() const { return shared_bitmap_; } 55 SharedBitmap* shared_bitmap() const { return shared_bitmap_; }
51 gfx::Size shared_memory_size() const { return shared_memory_size_; }
52 size_t SharedMemorySizeInBytes() const; 56 size_t SharedMemorySizeInBytes() const;
53 57
54 private: 58 private:
55 gpu::MailboxHolder mailbox_holder_; 59 gpu::MailboxHolder mailbox_holder_;
56 SharedBitmap* shared_bitmap_; 60 SharedBitmap* shared_bitmap_;
57 gfx::Size shared_memory_size_; 61 gfx::Size size_;
58 bool allow_overlay_; 62 bool allow_overlay_;
59 bool nearest_neighbor_; 63 bool nearest_neighbor_;
60 }; 64 };
61 65
62 } // namespace cc 66 } // namespace cc
63 67
64 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_ 68 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698