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

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

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 #include "cc/resources/texture_mailbox.h" 5 #include "cc/resources/texture_mailbox.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/resources/shared_bitmap.h" 8 #include "cc/resources/shared_bitmap.h"
9 9
10 namespace cc { 10 namespace cc {
(...skipping 10 matching lines...) Expand all
21 21
22 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox, 22 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox,
23 uint32 target, 23 uint32 target,
24 uint32 sync_point) 24 uint32 sync_point)
25 : mailbox_holder_(mailbox, target, sync_point), 25 : mailbox_holder_(mailbox, target, sync_point),
26 shared_bitmap_(NULL), 26 shared_bitmap_(NULL),
27 allow_overlay_(false), 27 allow_overlay_(false),
28 nearest_neighbor_(false) { 28 nearest_neighbor_(false) {
29 } 29 }
30 30
31 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox,
32 uint32 target,
33 uint32 sync_point,
34 const gfx::Size& size,
35 bool allow_overlay)
36 : mailbox_holder_(mailbox, target, sync_point),
37 shared_bitmap_(NULL),
danakj 2015/05/29 20:04:15 nullptr
achaulk 2015/06/01 15:43:10 Done.
38 size_(size),
39 allow_overlay_(allow_overlay),
40 nearest_neighbor_(false) {
41 }
danakj 2015/05/29 20:04:15 can you DCHECK_IMPLIES(allow_overlay, !size.IsEmpt
achaulk 2015/06/01 15:43:10 Done.
42
31 TextureMailbox::TextureMailbox(SharedBitmap* shared_bitmap, 43 TextureMailbox::TextureMailbox(SharedBitmap* shared_bitmap,
32 const gfx::Size& size) 44 const gfx::Size& size)
33 : shared_bitmap_(shared_bitmap), 45 : shared_bitmap_(shared_bitmap),
34 shared_memory_size_(size), 46 size_(size),
35 allow_overlay_(false), 47 allow_overlay_(false),
36 nearest_neighbor_(false) { 48 nearest_neighbor_(false) {
37 // If an embedder of cc gives an invalid TextureMailbox, we should crash 49 // If an embedder of cc gives an invalid TextureMailbox, we should crash
38 // here to identify the offender. 50 // here to identify the offender.
39 CHECK(SharedBitmap::VerifySizeInBytes(shared_memory_size_)); 51 CHECK(SharedBitmap::VerifySizeInBytes(size_));
40 } 52 }
41 53
42 TextureMailbox::~TextureMailbox() {} 54 TextureMailbox::~TextureMailbox() {}
43 55
44 bool TextureMailbox::Equals(const TextureMailbox& other) const { 56 bool TextureMailbox::Equals(const TextureMailbox& other) const {
45 if (other.IsTexture()) { 57 if (other.IsTexture()) {
46 return IsTexture() && !memcmp(mailbox_holder_.mailbox.name, 58 return IsTexture() && !memcmp(mailbox_holder_.mailbox.name,
47 other.mailbox_holder_.mailbox.name, 59 other.mailbox_holder_.mailbox.name,
48 sizeof(mailbox_holder_.mailbox.name)); 60 sizeof(mailbox_holder_.mailbox.name));
49 } else if (other.IsSharedMemory()) { 61 } else if (other.IsSharedMemory()) {
50 return IsSharedMemory() && (shared_bitmap_ == other.shared_bitmap_); 62 return IsSharedMemory() && (shared_bitmap_ == other.shared_bitmap_);
51 } 63 }
52 64
53 DCHECK(!other.IsValid()); 65 DCHECK(!other.IsValid());
54 return !IsValid(); 66 return !IsValid();
55 } 67 }
56 68
57 size_t TextureMailbox::SharedMemorySizeInBytes() const { 69 size_t TextureMailbox::SharedMemorySizeInBytes() const {
58 // UncheckedSizeInBytes is okay because we VerifySizeInBytes in the 70 // UncheckedSizeInBytes is okay because we VerifySizeInBytes in the
59 // constructor and the field is immutable. 71 // constructor and the field is immutable.
60 return SharedBitmap::UncheckedSizeInBytes(shared_memory_size_); 72 return SharedBitmap::UncheckedSizeInBytes(size_);
61 } 73 }
62 74
63 } // namespace cc 75 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698