12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file. 42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef UI_GFX_IMAGE_IMAGE_PNG_REP_H_ 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define UI_GFX_IMAGE_IMAGE_PNG_REP_H_ 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/memory/ref_counted_memory.h" 958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "ui/gfx/gfx_export.h" 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace gfx { 12c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)class Size; 132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// An ImagePNGRep represents a bitmap's png encoded data and the scale factor it 152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// was intended for. 164e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)struct GFX_EXPORT ImagePNGRep { 1768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) public: 182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ImagePNGRep(); 192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ImagePNGRep(const scoped_refptr<base::RefCountedMemory>& data, 2068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) float data_scale); 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ~ImagePNGRep(); 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 23c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Width and height of the image, in pixels. 24c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // If the image is invalid, returns gfx::Size(0, 0). 25c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Warning: This operation processes the entire image stream, so its result 26c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // should be cached if it is needed multiple times. 27c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) gfx::Size Size() const; 28c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) scoped_refptr<base::RefCountedMemory> raw_data; 3068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) float scale; 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} // namespace gfx 342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif // UI_GFX_IMAGE_IMAGE_PNG_REP_H_ 36