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

Unified Diff: ui/gfx/image/image_skia_rep.h

Issue 277773002: Add ImageSkiaRep::unscaled that tells if the image is for unscaled image. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « ui/gfx/image/image_skia.cc ('k') | ui/gfx/image/image_skia_rep.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image_skia_rep.h
diff --git a/ui/gfx/image/image_skia_rep.h b/ui/gfx/image/image_skia_rep.h
index 7a1e83709ab9c9e830b83a0568a7aa96b15f289a..a08970b81722564b43de74b92cb114b9b2e66b1a 100644
--- a/ui/gfx/image/image_skia_rep.h
+++ b/ui/gfx/image/image_skia_rep.h
@@ -12,6 +12,8 @@
namespace gfx {
// An ImageSkiaRep represents a bitmap and the scale factor it is intended for.
+// 0.0f scale is used to indicate that this ImageSkiaRep is used for unscaled
+// image (the image that only returns 1.0f scale image).
class GFX_EXPORT ImageSkiaRep {
public:
// Create null bitmap.
@@ -19,7 +21,9 @@ class GFX_EXPORT ImageSkiaRep {
~ImageSkiaRep();
// Creates a bitmap with kARGB_8888_Config config with given |size| in DIP.
- // This allocates pixels in the bitmap.
+ // This allocates pixels in the bitmap. Specifying 0 scale means the image
+ // is for unscaled image. (unscaled() returns truen, and scale() returns
+ // 1.0f;)
ImageSkiaRep(const gfx::Size& size, float scale);
// Creates a bitmap with given scale.
@@ -41,7 +45,12 @@ class GFX_EXPORT ImageSkiaRep {
}
// Retrieves the scale that the bitmap will be painted at.
- float scale() const { return scale_; }
+ float scale() const { return unscaled() ? 1.0f : scale_; }
+
+ bool unscaled() const { return scale_ == 0.0f; }
+
+ // Mark the image to be used as scaled image.
+ void SetScaled();
// Returns backing bitmap.
const SkBitmap& sk_bitmap() const { return bitmap_; }
@@ -51,6 +60,7 @@ class GFX_EXPORT ImageSkiaRep {
SkBitmap& mutable_sk_bitmap() { return bitmap_; }
SkBitmap bitmap_;
+
float scale_;
};
« no previous file with comments | « ui/gfx/image/image_skia.cc ('k') | ui/gfx/image/image_skia_rep.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698