| OLD | NEW |
| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
| 10 #include "ui/base/layout.h" | 10 #include "ui/base/layout.h" |
| 11 #include "ui/base/ui_export.h" | 11 #include "ui/base/ui_export.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 class Size; |
| 14 | 15 |
| 15 // An ImageSkiaRep represents a bitmap and the scale factor it is intended for. | 16 // An ImageSkiaRep represents a bitmap and the scale factor it is intended for. |
| 16 class UI_EXPORT ImageSkiaRep { | 17 class UI_EXPORT ImageSkiaRep { |
| 17 public: | 18 public: |
| 18 // Create null bitmap. | 19 // Create null bitmap. |
| 19 ImageSkiaRep(); | 20 ImageSkiaRep(); |
| 20 ~ImageSkiaRep(); | 21 ~ImageSkiaRep(); |
| 21 | 22 |
| 22 // Creates a bitmap with kARGB_8888_Config config with given DIP |width| and | 23 // Creates a bitmap with kARGB_8888_Config config with given |size| in DIP. |
| 23 // |height| and |scale_factor|. | 24 // This allocates pixels in the bitmap. |
| 24 // Allocates pixels. | 25 ImageSkiaRep(const gfx::Size& size, ui::ScaleFactor scale_factor); |
| 25 ImageSkiaRep(int width, int height, ui::ScaleFactor scale_factor); | |
| 26 | 26 |
| 27 // Creates a bitmap with a default scale factor of 1x. | 27 // Creates a bitmap with a default scale factor of 1x. |
| 28 // Adds ref to |src|. | 28 // Adds ref to |src|. |
| 29 // TODO(pkotwicz): This is temporary and should be removed ASAP. | 29 // TODO(pkotwicz): This is temporary and should be removed ASAP. |
| 30 ImageSkiaRep(const SkBitmap& src); | 30 ImageSkiaRep(const SkBitmap& src); |
| 31 | 31 |
| 32 // Creates a bitmap with given scale factor. | 32 // Creates a bitmap with given scale factor. |
| 33 // Adds ref to |src|. | 33 // Adds ref to |src|. |
| 34 ImageSkiaRep(const SkBitmap& src, ui::ScaleFactor scale_factor); | 34 ImageSkiaRep(const SkBitmap& src, ui::ScaleFactor scale_factor); |
| 35 | 35 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 57 const SkBitmap& sk_bitmap() const { return bitmap_; } | 57 const SkBitmap& sk_bitmap() const { return bitmap_; } |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 SkBitmap bitmap_; | 60 SkBitmap bitmap_; |
| 61 ui::ScaleFactor scale_factor_; | 61 ui::ScaleFactor scale_factor_; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace gfx | 64 } // namespace gfx |
| 65 | 65 |
| 66 #endif // UI_GFX_IMAGE_IMAGE_SKIA_REP_H_ | 66 #endif // UI_GFX_IMAGE_IMAGE_SKIA_REP_H_ |
| OLD | NEW |