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.
5 #ifndef CC_OUTPUT_COPY_OUTPUT_RESULT_H_
6 #define CC_OUTPUT_COPY_OUTPUT_RESULT_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/cc_export.h"
10 #include "ui/gfx/size.h"
17 class CC_EXPORT CopyOutputResult
{
19 static scoped_ptr
<CopyOutputResult
> CreateEmptyResult() {
20 return make_scoped_ptr(new CopyOutputResult
);
22 static scoped_ptr
<CopyOutputResult
> CreateBitmapResult(
23 scoped_ptr
<SkBitmap
> bitmap
) {
24 return make_scoped_ptr(new CopyOutputResult(bitmap
.Pass()));
26 static scoped_ptr
<CopyOutputResult
> CreateTextureResult(
28 scoped_ptr
<TextureMailbox
> texture_mailbox
) {
29 return make_scoped_ptr(new CopyOutputResult(size
, texture_mailbox
.Pass()));
34 bool IsEmpty() const { return !HasBitmap() && !HasTexture(); }
35 bool HasBitmap() const { return !!bitmap_
; }
36 bool HasTexture() const { return !!texture_mailbox_
; }
38 gfx::Size
size() const { return size_
; }
39 scoped_ptr
<SkBitmap
> TakeBitmap();
40 scoped_ptr
<TextureMailbox
> TakeTexture();
44 explicit CopyOutputResult(scoped_ptr
<SkBitmap
> bitmap
);
45 explicit CopyOutputResult(gfx::Size size
,
46 scoped_ptr
<TextureMailbox
> texture_mailbox
);
49 scoped_ptr
<SkBitmap
> bitmap_
;
50 scoped_ptr
<TextureMailbox
> texture_mailbox_
;
55 #endif // CC_OUTPUT_COPY_OUTPUT_RESULT_H_