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

Side by Side Diff: ui/gfx/image/image_skia_rep.h

Issue 10828296: Avoid crashing when an ImageSkia has no representations and is converted to SkBitmap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GFX_IMAGE_IMAGE_SKIA_REP_H_ 5 #ifndef UI_GFX_IMAGE_IMAGE_SKIA_REP_H_
6 #define UI_GFX_IMAGE_IMAGE_SKIA_REP_H_ 6 #define UI_GFX_IMAGE_IMAGE_SKIA_REP_H_
7 7
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "ui/base/layout.h" 9 #include "ui/base/layout.h"
10 #include "ui/base/ui_export.h" 10 #include "ui/base/ui_export.h"
(...skipping 28 matching lines...) Expand all
39 int pixel_height() const { return bitmap_.height(); } 39 int pixel_height() const { return bitmap_.height(); }
40 40
41 // Retrieves the scale that the bitmap will be painted at. 41 // Retrieves the scale that the bitmap will be painted at.
42 float GetScale() const; 42 float GetScale() const;
43 ui::ScaleFactor scale_factor() const { return scale_factor_; } 43 ui::ScaleFactor scale_factor() const { return scale_factor_; }
44 44
45 // Returns backing bitmap. 45 // Returns backing bitmap.
46 const SkBitmap& sk_bitmap() const { return bitmap_; } 46 const SkBitmap& sk_bitmap() const { return bitmap_; }
47 47
48 private: 48 private:
49 friend class ImageSkia;
50 SkBitmap& mutable_sk_bitmap() { return bitmap_; }
51
49 SkBitmap bitmap_; 52 SkBitmap bitmap_;
50 ui::ScaleFactor scale_factor_; 53 ui::ScaleFactor scale_factor_;
51 }; 54 };
52 55
53 } // namespace gfx 56 } // namespace gfx
54 57
55 #endif // UI_GFX_IMAGE_IMAGE_SKIA_REP_H_ 58 #endif // UI_GFX_IMAGE_IMAGE_SKIA_REP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698