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

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: addressing comments 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/picture_pile_impl.cc » ('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..7e4a10d40e78d869bd37154839a4f7763f2c778c 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,23 @@ void Picture::Raster(SkCanvas* canvas) {
canvas->restore();
}
+void Picture::GatherPixelRefs(const gfx::Rect& rect,
+ std::vector<SkPixelRef*>& result) {
+ DCHECK(picture_);
+ SkAutoDataUnref pixel_refs(SkPictureUtils::GatherPixelRefs(
+ picture_.get(), SkRect::MakeXYWH(rect.x(),
+ rect.y(),
+ rect.width(),
+ rect.height())));
+ void* data = const_cast<void*>(pixel_refs->data());
+ SkPixelRef** refs = reinterpret_cast<SkPixelRef**>(data);
+ for (int i = 0; i < pixel_refs->size() / sizeof(SkPixelRef*); ++i) {
+ if (memcmp((*refs)->getURI(), labelLazyDecoded,
reveman 2012/12/07 21:14:54 should this be strcmp? memcmp is allowed to read p
qinmin 2012/12/07 23:41:55 ok, using strncmp instead On 2012/12/07 21:14:54,
+ sizeof(labelLazyDecoded))) {
+ result.push_back(*refs);
+ }
+ refs++;
+ }
+}
+
} // namespace cc
« no previous file with comments | « cc/picture.h ('k') | cc/picture_pile_impl.h » ('j') | cc/picture_pile_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698