| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_UTILITY_CLOUD_PRINT_BITMAP_IMAGE_H_ | 5 #ifndef CHROME_UTILITY_CLOUD_PRINT_BITMAP_IMAGE_H_ |
| 6 #define CHROME_UTILITY_CLOUD_PRINT_BITMAP_IMAGE_H_ | 6 #define CHROME_UTILITY_CLOUD_PRINT_BITMAP_IMAGE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "ui/gfx/geometry/point.h" | 13 #include "ui/gfx/geometry/point.h" |
| 13 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
| 14 | 15 |
| 15 namespace cloud_print { | 16 namespace cloud_print { |
| 16 | 17 |
| 17 class BitmapImage { | 18 class BitmapImage { |
| 18 public: | 19 public: |
| 19 enum Colorspace { | 20 enum Colorspace { |
| 20 // These are the only types PWGEncoder currently supports. | 21 // These are the only types PWGEncoder currently supports. |
| 21 RGBA, | 22 RGBA, |
| 22 BGRA | 23 BGRA |
| 23 }; | 24 }; |
| 24 | 25 |
| 25 BitmapImage(const gfx::Size& size, Colorspace colorspace); | 26 BitmapImage(const gfx::Size& size, Colorspace colorspace); |
| 26 ~BitmapImage(); | 27 ~BitmapImage(); |
| 27 | 28 |
| 28 uint8_t channels() const; | 29 uint8_t channels() const; |
| 29 const gfx::Size& size() const { return size_; } | 30 const gfx::Size& size() const { return size_; } |
| 30 Colorspace colorspace() const { return colorspace_; } | 31 Colorspace colorspace() const { return colorspace_; } |
| 31 | 32 |
| 32 const uint8_t* pixel_data() const { return data_.get(); } | 33 const uint8_t* pixel_data() const { return data_.get(); } |
| 33 uint8_t* pixel_data() { return data_.get(); } | 34 uint8_t* pixel_data() { return data_.get(); } |
| 34 | 35 |
| 35 const uint8_t* GetPixel(const gfx::Point& point) const; | 36 const uint8_t* GetPixel(const gfx::Point& point) const; |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 gfx::Size size_; | 39 gfx::Size size_; |
| 39 Colorspace colorspace_; | 40 Colorspace colorspace_; |
| 40 scoped_ptr<uint8_t[]> data_; | 41 std::unique_ptr<uint8_t[]> data_; |
| 41 | 42 |
| 42 DISALLOW_COPY_AND_ASSIGN(BitmapImage); | 43 DISALLOW_COPY_AND_ASSIGN(BitmapImage); |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 } // namespace cloud_print | 46 } // namespace cloud_print |
| 46 | 47 |
| 47 #endif // CHROME_UTILITY_CLOUD_PRINT_BITMAP_IMAGE_H_ | 48 #endif // CHROME_UTILITY_CLOUD_PRINT_BITMAP_IMAGE_H_ |
| OLD | NEW |