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

Unified Diff: ppapi/examples/2d/paint_manager_example.cc

Issue 10823378: Cache image data objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 8 years, 4 months 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 | « no previous file | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/examples/2d/paint_manager_example.cc
diff --git a/ppapi/examples/2d/paint_manager_example.cc b/ppapi/examples/2d/paint_manager_example.cc
index 86bdbe79ed8f9f2a8e820cd682f24c57cbb413d7..430f42259cccbecf26ad2589285ded3891d0cc2a 100644
--- a/ppapi/examples/2d/paint_manager_example.cc
+++ b/ppapi/examples/2d/paint_manager_example.cc
@@ -78,7 +78,9 @@ class MyInstance : public pp::Instance, public pp::PaintManager::Client {
// PaintManager::Client implementation.
virtual bool OnPaint(pp::Graphics2D& graphics_2d,
const std::vector<pp::Rect>& paint_rects,
- const pp::Rect& paint_bounds) {
+ const pp::Rect& paint_bounds_unused) {
+ pp::Rect paint_bounds(paint_manager_.GetEffectiveSize());
+
// Make an image just large enough to hold all dirty rects. We won't
// actually paint all of these pixels below, but rather just the dirty
// ones. Since image allocation can be somewhat heavyweight, we wouldn't
@@ -96,6 +98,7 @@ class MyInstance : public pp::Instance, public pp::PaintManager::Client {
// Note that the aggregator used by the paint manager won't give us
// multiple regions that overlap, so we don't have to worry about double
// painting in this code.
+/*
for (size_t i = 0; i < paint_rects.size(); i++) {
// Since our image is just the invalid region, we need to offset the
// areas we paint by that much. This is just a light blue background.
@@ -106,6 +109,7 @@ class MyInstance : public pp::Instance, public pp::PaintManager::Client {
paint_rects[i].height(),
0xFFAAAAFF);
}
+ */
// Paint the square black. Because we're lazy, we do this outside of the
// loop above.
@@ -117,7 +121,7 @@ class MyInstance : public pp::Instance, public pp::PaintManager::Client {
square.height(),
0xFF000000);
- graphics_2d.PaintImageData(updated_image, paint_bounds.point());
+ graphics_2d.ReplaceContents(&updated_image);
return true;
}
« no previous file with comments | « no previous file | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698