cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / cc / output / copy_output_result.h
blob04cf2c6d489bbd60595d8f8481e18ba3b9caa070
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"
12 class SkBitmap;
14 namespace cc {
15 class TextureMailbox;
17 class CC_EXPORT CopyOutputResult {
18 public:
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(
27 gfx::Size size,
28 scoped_ptr<TextureMailbox> texture_mailbox) {
29 return make_scoped_ptr(new CopyOutputResult(size, texture_mailbox.Pass()));
32 ~CopyOutputResult();
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();
42 private:
43 CopyOutputResult();
44 explicit CopyOutputResult(scoped_ptr<SkBitmap> bitmap);
45 explicit CopyOutputResult(gfx::Size size,
46 scoped_ptr<TextureMailbox> texture_mailbox);
48 gfx::Size size_;
49 scoped_ptr<SkBitmap> bitmap_;
50 scoped_ptr<TextureMailbox> texture_mailbox_;
53 } // namespace cc
55 #endif // CC_OUTPUT_COPY_OUTPUT_RESULT_H_