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