Fix import error in mac_platform_backend.py
[chromium-blink-merge.git] / cc / output / copy_output_result.cc
blobadbb8de60d0b9c19e7304f5d0b06900d4d3f955e
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 #include "cc/output/copy_output_result.h"
7 #include "base/logging.h"
8 #include "cc/resources/single_release_callback.h"
9 #include "cc/resources/texture_mailbox.h"
10 #include "third_party/skia/include/core/SkBitmap.h"
12 namespace cc {
14 CopyOutputResult::CopyOutputResult() {}
16 CopyOutputResult::CopyOutputResult(scoped_ptr<SkBitmap> bitmap)
17 : size_(bitmap->width(), bitmap->height()),
18 bitmap_(bitmap.Pass()) {
19 DCHECK(bitmap_);
22 CopyOutputResult::CopyOutputResult(
23 const gfx::Size& size,
24 const TextureMailbox& texture_mailbox,
25 scoped_ptr<SingleReleaseCallback> release_callback)
26 : size_(size),
27 texture_mailbox_(texture_mailbox),
28 release_callback_(release_callback.Pass()) {
29 DCHECK(texture_mailbox_.IsTexture());
32 CopyOutputResult::~CopyOutputResult() {
33 if (release_callback_)
34 release_callback_->Run(0, false);
37 scoped_ptr<SkBitmap> CopyOutputResult::TakeBitmap() {
38 return bitmap_.Pass();
41 void CopyOutputResult::TakeTexture(
42 TextureMailbox* texture_mailbox,
43 scoped_ptr<SingleReleaseCallback>* release_callback) {
44 *texture_mailbox = texture_mailbox_;
45 *release_callback = release_callback_.Pass();
47 texture_mailbox_ = TextureMailbox();
50 } // namespace cc