blob: 3662818ef4118a5c573156b58b6b6673ee8ccf46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_OUTPUT_COPY_OUTPUT_RESULT_H_
#define CC_OUTPUT_COPY_OUTPUT_RESULT_H_
#include "base/memory/scoped_ptr.h"
#include "cc/base/cc_export.h"
#include "cc/resources/single_release_callback.h"
#include "cc/resources/texture_mailbox.h"
#include "ui/gfx/geometry/size.h"
class SkBitmap;
namespace cc {
class TextureMailbox;
class CC_EXPORT CopyOutputResult {
public:
static scoped_ptr<CopyOutputResult> CreateEmptyResult() {
return make_scoped_ptr(new CopyOutputResult);
}
static scoped_ptr<CopyOutputResult> CreateBitmapResult(
scoped_ptr<SkBitmap> bitmap) {
return make_scoped_ptr(new CopyOutputResult(bitmap.Pass()));
}
static scoped_ptr<CopyOutputResult> CreateTextureResult(
const gfx::Size& size,
const TextureMailbox& texture_mailbox,
scoped_ptr<SingleReleaseCallback> release_callback) {
return make_scoped_ptr(
new CopyOutputResult(size, texture_mailbox, release_callback.Pass()));
}
~CopyOutputResult();
bool IsEmpty() const { return !HasBitmap() && !HasTexture(); }
bool HasBitmap() const { return !!bitmap_; }
bool HasTexture() const { return texture_mailbox_.IsValid(); }
gfx::Size size() const { return size_; }
scoped_ptr<SkBitmap> TakeBitmap();
void TakeTexture(TextureMailbox* texture_mailbox,
scoped_ptr<SingleReleaseCallback>* release_callback);
private:
CopyOutputResult();
explicit CopyOutputResult(scoped_ptr<SkBitmap> bitmap);
explicit CopyOutputResult(const gfx::Size& size,
const TextureMailbox& texture_mailbox,
scoped_ptr<SingleReleaseCallback> release_callback);
gfx::Size size_;
scoped_ptr<SkBitmap> bitmap_;
TextureMailbox texture_mailbox_;
scoped_ptr<SingleReleaseCallback> release_callback_;
};
} // namespace cc
#endif // CC_OUTPUT_COPY_OUTPUT_RESULT_H_
|