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

Unified Diff: ui/views/controls/image_view.h

Issue 73893007: Makes ImageView do a bit more checking before assuming images equal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add scale check Created 7 years, 1 month 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 | ui/views/controls/image_view.cc » ('j') | ui/views/controls/image_view.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/image_view.h
diff --git a/ui/views/controls/image_view.h b/ui/views/controls/image_view.h
index 18c4ba13241ac01afe2d2604b3e361350dd32de5..5ca63dd54bdb2458c9e59c14de8e17bf8b867fbe 100644
--- a/ui/views/controls/image_view.h
+++ b/ui/views/controls/image_view.h
@@ -84,6 +84,11 @@ class VIEWS_EXPORT ImageView : public View {
virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE;
private:
+ // Returns true if |img| is the same as the last image we painted. This is
+ // intended to be a quick check, not exhaustive. In other words it's possible
+ // this may return false even though the images are in fact equal.
pkotwicz 2013/11/15 20:57:09 Nit: "this may return false" -> "that this returns
sky 2013/11/15 22:19:13 Done.
+ bool IsImageEqual(const gfx::ImageSkia& img) const;
+
// Compute the image origin given the desired size and the receiver alignment
// properties.
gfx::Point ComputeImageOrigin(const gfx::Size& image_size) const;
@@ -109,6 +114,13 @@ class VIEWS_EXPORT ImageView : public View {
// A flag controlling hit test handling for interactivity.
bool interactive_;
+ // Scale last painted at.
+ float last_paint_scale_;
+
+ // Address of bytes we last painted. This is used only for comparison, so its
+ // safe to cache.
+ void* last_painted_image_;
pkotwicz 2013/11/15 20:57:09 Maybe |last_painted_bitmap_| I try to reserve the
sky 2013/11/15 22:19:13 I went with last_painted_bitmap_pixels_
+
DISALLOW_COPY_AND_ASSIGN(ImageView);
};
« no previous file with comments | « no previous file | ui/views/controls/image_view.cc » ('j') | ui/views/controls/image_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698