OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2012 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. | |
4 | |
5 #include "cc/image.h" | |
6 | |
7 #include "skia/ext/lazy_pixel_ref.h" | |
8 | |
9 namespace cc { | |
10 | |
11 scoped_refptr<Image> Image::Create(SkPixelRef* pixel_ref) { | |
12 return make_scoped_refptr(new Image(skia::AdoptRef(pixel_ref))); | |
13 } | |
14 | |
15 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
| |
16 pixel_ref_(pixel_ref) { | |
17 } | |
18 | |
19 Image::~Image() {} | |
20 | |
21 void Image::Decode() { | |
22 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
| |
23 } | |
24 | |
25 bool Image::PrepareToDecode() { | |
26 // TODO(qinmin): passing the correct clip rect to PrepareToDecode(). | |
27 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
| |
28 skia::LazyPixelRef::PrepareParams()); | |
29 } | |
30 | |
31 } // namespace cc | |
OLD | NEW |