Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3581)

Unified Diff: cc/image.cc

Issue 11453014: Implement the logic to kick off image decoding jobs for TileManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698