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
3 // found in the LICENSE file.
4 
5 #ifndef UI_GFX_IMAGE_IMAGE_PNG_REP_H_
6 #define UI_GFX_IMAGE_IMAGE_PNG_REP_H_
7 
8 #include "base/memory/ref_counted_memory.h"
9 #include "ui/gfx/gfx_export.h"
10 
11 namespace gfx {
12 class Size;
13 
14 // An ImagePNGRep represents a bitmap's png encoded data and the scale factor it
15 // was intended for.
16 struct GFX_EXPORT ImagePNGRep {
17  public:
18   ImagePNGRep();
19   ImagePNGRep(const scoped_refptr<base::RefCountedMemory>& data,
20               float data_scale);
21   ImagePNGRep(const ImagePNGRep& other);
22   ~ImagePNGRep();
23 
24   // Width and height of the image, in pixels.
25   // If the image is invalid, returns gfx::Size(0, 0).
26   // Warning: This operation processes the entire image stream, so its result
27   // should be cached if it is needed multiple times.
28   gfx::Size Size() const;
29 
30   scoped_refptr<base::RefCountedMemory> raw_data;
31   float scale = 1.0f;
32 };
33 
34 }  // namespace gfx
35 
36 #endif  // UI_GFX_IMAGE_IMAGE_PNG_REP_H_
37