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

Unified Diff: cc/picture.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: fix for win_rel trybot 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
« no previous file with comments | « cc/picture.h ('k') | cc/picture_pile_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture.cc
diff --git a/cc/picture.cc b/cc/picture.cc
index 9ff58454889c5d237690cdd84552677adf8df938..0cd75be264b5a6e42b5f72f0e600ccfc9a075186 100644
--- a/cc/picture.cc
+++ b/cc/picture.cc
@@ -7,8 +7,15 @@
#include "cc/picture.h"
#include "cc/rendering_stats.h"
#include "third_party/skia/include/core/SkCanvas.h"
+#include "third_party/skia/include/core/SkData.h"
+#include "third_party/skia/include/utils/SkPictureUtils.h"
#include "ui/gfx/rect_conversions.h"
+namespace {
+// URI label for a lazily decoded SkPixelRef.
+const char labelLazyDecoded[] = "lazy";
+}
+
namespace cc {
scoped_refptr<Picture> Picture::Create(gfx::Rect layer_rect) {
@@ -88,4 +95,32 @@ void Picture::Raster(SkCanvas* canvas) {
canvas->restore();
}
+void Picture::GatherPixelRefs(const gfx::Rect& rect,
+ std::list<skia::LazyPixelRef*>& result) {
+ DCHECK(picture_);
+ SkData* pixel_refs = SkPictureUtils::GatherPixelRefs(
+ picture_.get(), SkRect::MakeXYWH(rect.x(),
+ rect.y(),
+ rect.width(),
+ rect.height()));
+ if (!pixel_refs)
+ return;
+
+ void* data = const_cast<void*>(pixel_refs->data());
+ if (!data) {
+ pixel_refs->unref();
+ return;
+ }
+
+ SkPixelRef** refs = reinterpret_cast<SkPixelRef**>(data);
+ for (unsigned int i = 0; i < pixel_refs->size() / sizeof(SkPixelRef*); ++i) {
+ if (*refs && (*refs)->getURI() && !strncmp(
+ (*refs)->getURI(), labelLazyDecoded, 4)) {
+ result.push_back(static_cast<skia::LazyPixelRef*>(*refs));
+ }
+ refs++;
+ }
+ pixel_refs->unref();
+}
+
} // namespace cc
« no previous file with comments | « cc/picture.h ('k') | cc/picture_pile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698