Chromium Code Reviews| Index: cc/image.cc |
| diff --git a/cc/image.cc b/cc/image.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..306ba489559acdba0e24cd56cfcfa8a8d0921d9d |
| --- /dev/null |
| +++ b/cc/image.cc |
| @@ -0,0 +1,31 @@ |
| +// Copyright 2012 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/image.h" |
| + |
| +#include "skia/ext/lazy_pixel_ref.h" |
| + |
| +namespace cc { |
| + |
| +scoped_refptr<Image> Image::Create(SkPixelRef* pixel_ref) { |
| + return make_scoped_refptr(new Image(skia::AdoptRef(pixel_ref))); |
| +} |
| + |
| +Image::Image(const skia::RefPtr<SkPixelRef>& pixel_ref) : |
|
Alpha Left Google
2012/12/05 20:24:28
I don't really know skia::RefPtr but it looks stra
qinmin
2012/12/07 05:06:28
Somehow this is commonly used in cc/, I am not sur
|
| + pixel_ref_(pixel_ref) { |
| +} |
| + |
| +Image::~Image() {} |
| + |
| +void Image::Decode() { |
| + static_cast<skia::LazyPixelRef*>(pixel_ref_.get())->Decode(); |
|
Alpha Left Google
2012/12/05 20:24:28
Nat can give more comments about this interface.
nduca
2012/12/06 08:46:53
I think we should make redecoding work. E.g. this
qinmin
2012/12/07 05:06:28
So we need a freeCachedPixelRef() in lazy_pixel_re
|
| +} |
| + |
| +bool Image::PrepareToDecode() { |
| + // TODO(qinmin): passing the correct clip rect to PrepareToDecode(). |
| + return static_cast<skia::LazyPixelRef*>(pixel_ref_.get())->PrepareToDecode( |
|
Alpha Left Google
2012/12/05 20:24:28
I think WebKit code for PrepareToDecode leaks reso
|
| + skia::LazyPixelRef::PrepareParams()); |
| +} |
| + |
| +} // namespace cc |