OLD | NEW |
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 20 matching lines...) Expand all Loading... |
31 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox, | 31 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox, |
32 uint32 target, | 32 uint32 target, |
33 uint32 sync_point, | 33 uint32 sync_point, |
34 const gfx::Size& size_in_pixels, | 34 const gfx::Size& size_in_pixels, |
35 bool allow_overlay) | 35 bool allow_overlay) |
36 : mailbox_holder_(mailbox, target, sync_point), | 36 : mailbox_holder_(mailbox, target, sync_point), |
37 shared_bitmap_(nullptr), | 37 shared_bitmap_(nullptr), |
38 size_in_pixels_(size_in_pixels), | 38 size_in_pixels_(size_in_pixels), |
39 allow_overlay_(allow_overlay), | 39 allow_overlay_(allow_overlay), |
40 nearest_neighbor_(false) { | 40 nearest_neighbor_(false) { |
41 DCHECK_IMPLIES(allow_overlay, !size_in_pixels.IsEmpty()); | 41 DCHECK(!allow_overlay || !size_in_pixels.IsEmpty()); |
42 } | 42 } |
43 | 43 |
44 TextureMailbox::TextureMailbox(SharedBitmap* shared_bitmap, | 44 TextureMailbox::TextureMailbox(SharedBitmap* shared_bitmap, |
45 const gfx::Size& size_in_pixels) | 45 const gfx::Size& size_in_pixels) |
46 : shared_bitmap_(shared_bitmap), | 46 : shared_bitmap_(shared_bitmap), |
47 size_in_pixels_(size_in_pixels), | 47 size_in_pixels_(size_in_pixels), |
48 allow_overlay_(false), | 48 allow_overlay_(false), |
49 nearest_neighbor_(false) { | 49 nearest_neighbor_(false) { |
50 // If an embedder of cc gives an invalid TextureMailbox, we should crash | 50 // If an embedder of cc gives an invalid TextureMailbox, we should crash |
51 // here to identify the offender. | 51 // here to identify the offender. |
(...skipping 15 matching lines...) Expand all Loading... |
67 return !IsValid(); | 67 return !IsValid(); |
68 } | 68 } |
69 | 69 |
70 size_t TextureMailbox::SharedMemorySizeInBytes() const { | 70 size_t TextureMailbox::SharedMemorySizeInBytes() const { |
71 // UncheckedSizeInBytes is okay because we VerifySizeInBytes in the | 71 // UncheckedSizeInBytes is okay because we VerifySizeInBytes in the |
72 // constructor and the field is immutable. | 72 // constructor and the field is immutable. |
73 return SharedBitmap::UncheckedSizeInBytes(size_in_pixels_); | 73 return SharedBitmap::UncheckedSizeInBytes(size_in_pixels_); |
74 } | 74 } |
75 | 75 |
76 } // namespace cc | 76 } // namespace cc |
OLD | NEW |