OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_OUTPUT_COPY_OUTPUT_RESULT_H_ |
| 6 #define CC_OUTPUT_COPY_OUTPUT_RESULT_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "cc/resources/single_release_callback.h" |
| 10 #include "cc/resources/texture_mailbox.h" |
| 11 #include "ui/gfx/geometry/size.h" |
| 12 |
| 13 class SkBitmap; |
| 14 |
| 15 namespace cc { |
| 16 class TextureMailbox; |
| 17 |
| 18 class CopyOutputResult { |
| 19 public: |
| 20 static scoped_ptr<CopyOutputResult> CreateEmptyResult() { |
| 21 return make_scoped_ptr(new CopyOutputResult); |
| 22 } |
| 23 static scoped_ptr<CopyOutputResult> CreateBitmapResult( |
| 24 scoped_ptr<SkBitmap> bitmap) { |
| 25 return make_scoped_ptr(new CopyOutputResult(bitmap.Pass())); |
| 26 } |
| 27 static scoped_ptr<CopyOutputResult> CreateTextureResult( |
| 28 const gfx::Size& size, |
| 29 const TextureMailbox& texture_mailbox, |
| 30 scoped_ptr<SingleReleaseCallback> release_callback) { |
| 31 return make_scoped_ptr( |
| 32 new CopyOutputResult(size, texture_mailbox, release_callback.Pass())); |
| 33 } |
| 34 |
| 35 ~CopyOutputResult(); |
| 36 |
| 37 bool IsEmpty() const { return !HasBitmap() && !HasTexture(); } |
| 38 bool HasBitmap() const { return !!bitmap_; } |
| 39 bool HasTexture() const { return texture_mailbox_.IsValid(); } |
| 40 |
| 41 gfx::Size size() const { return size_; } |
| 42 scoped_ptr<SkBitmap> TakeBitmap(); |
| 43 void TakeTexture(TextureMailbox* texture_mailbox, |
| 44 scoped_ptr<SingleReleaseCallback>* release_callback); |
| 45 |
| 46 private: |
| 47 CopyOutputResult(); |
| 48 explicit CopyOutputResult(scoped_ptr<SkBitmap> bitmap); |
| 49 explicit CopyOutputResult(const gfx::Size& size, |
| 50 const TextureMailbox& texture_mailbox, |
| 51 scoped_ptr<SingleReleaseCallback> release_callback); |
| 52 |
| 53 gfx::Size size_; |
| 54 scoped_ptr<SkBitmap> bitmap_; |
| 55 TextureMailbox texture_mailbox_; |
| 56 scoped_ptr<SingleReleaseCallback> release_callback_; |
| 57 }; |
| 58 |
| 59 } // namespace cc |
| 60 |
| 61 #endif // CC_OUTPUT_COPY_OUTPUT_RESULT_H_ |
OLD | NEW |