blob: 55213cde6b86a6c56e09061e85e65a50b4dea35c (
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
|
// 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.
#include "cc/output/copy_output_result.h"
#include "base/logging.h"
#include "cc/resources/texture_mailbox.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace cc {
CopyOutputResult::CopyOutputResult() {}
CopyOutputResult::CopyOutputResult(scoped_ptr<SkBitmap> bitmap)
: size_(bitmap->width(), bitmap->height()),
bitmap_(bitmap.Pass()) {
DCHECK(bitmap_);
}
CopyOutputResult::CopyOutputResult(gfx::Size size,
scoped_ptr<TextureMailbox> texture_mailbox)
: size_(size),
texture_mailbox_(texture_mailbox.Pass()) {
DCHECK(texture_mailbox_);
DCHECK(texture_mailbox_->IsTexture());
}
CopyOutputResult::~CopyOutputResult() {
if (texture_mailbox_)
texture_mailbox_->RunReleaseCallback(0, false);
}
scoped_ptr<SkBitmap> CopyOutputResult::TakeBitmap() {
return bitmap_.Pass();
}
scoped_ptr<TextureMailbox> CopyOutputResult::TakeTexture() {
return texture_mailbox_.Pass();
}
} // namespace cc
|