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

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: adding more null checks 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') | cc/tile_manager.h » ('J')
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 47d1b23d59d04e808837d423d7a9fdccaf0fd2b2..f190430a79844dc5f4f816773f7d88f47ec69f3c 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::vector<SkPixelRef*>& result) {
reveman 2012/12/10 17:58:12 should this be a std::vector<LazyPixelRef*> and we
qinmin 2012/12/10 22:52:51 Done.
+ 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 (int i = 0; i < pixel_refs->size() / sizeof(SkPixelRef*); ++i) {
+ if (*refs && (*refs)->getURI() && strncmp(
+ (*refs)->getURI(), labelLazyDecoded, sizeof(labelLazyDecoded))) {
+ result.push_back(*refs);
+ }
+ refs++;
+ }
+ pixel_refs->unref();
+}
+
} // namespace cc
« no previous file with comments | « cc/picture.h ('k') | cc/picture_pile_impl.h » ('j') | cc/tile_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698