diff options
author | maruel@google.com <maruel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-15 12:27:03 +0000 |
---|---|---|
committer | maruel@google.com <maruel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-15 12:27:03 +0000 |
commit | 1eb89e8fbf2d31247f5ceb271d8887a63d4a2bcf (patch) | |
tree | b78be07dbada3ac0f6d2435558e4a6aaba198ffc /chrome/common/gfx | |
parent | ea15e98a9353494df754a11fb49f0e4b8c0d4789 (diff) | |
download | chromium_src-1eb89e8fbf2d31247f5ceb271d8887a63d4a2bcf.zip chromium_src-1eb89e8fbf2d31247f5ceb271d8887a63d4a2bcf.tar.gz chromium_src-1eb89e8fbf2d31247f5ceb271d8887a63d4a2bcf.tar.bz2 |
Large patch set (159 files total) to cleanup the includes.
- Slightly reduce the size of the generated .lib files ~3%.
- Reduce the number of implicit and explicit atl and windows includes. hooray!
- Help incremental build by reducing the number of unnecessary included files.
- Split some template class in two, one base class for the common code and the specialization that inherits from the base class.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@937 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/gfx')
-rw-r--r-- | chrome/common/gfx/chrome_font.cc | 25 | ||||
-rw-r--r-- | chrome/common/gfx/chrome_font.h | 30 |
2 files changed, 36 insertions, 19 deletions
diff --git a/chrome/common/gfx/chrome_font.cc b/chrome/common/gfx/chrome_font.cc index 198227e..670eeb2 100644 --- a/chrome/common/gfx/chrome_font.cc +++ b/chrome/common/gfx/chrome_font.cc @@ -26,11 +26,14 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include "chrome/common/gfx/chrome_font.h" -#include <algorithm> +#include <windows.h> #include <math.h> +#include <algorithm> + #include "base/logging.h" #include "base/win_util.h" #include "chrome/app/locales/locale_settings.h" @@ -105,6 +108,26 @@ int ChromeFont::FontSize() { return font_size; } +ChromeFont::HFontRef::HFontRef(HFONT hfont, + int height, + int baseline, + int ave_char_width, + int style, + int dlu_base_x) + : hfont_(hfont), + height_(height), + baseline_(baseline), + ave_char_width_(ave_char_width), + style_(style), + dlu_base_x_(dlu_base_x) { + DLOG_ASSERT(hfont); +} + +ChromeFont::HFontRef::~HFontRef() { + DeleteObject(hfont_); +} + + ChromeFont ChromeFont::DeriveFont(int size_delta, int style) const { LOGFONT font_info; GetObject(hfont(), sizeof(LOGFONT), &font_info); diff --git a/chrome/common/gfx/chrome_font.h b/chrome/common/gfx/chrome_font.h index ad0fd8d..e831b6d 100644 --- a/chrome/common/gfx/chrome_font.h +++ b/chrome/common/gfx/chrome_font.h @@ -27,12 +27,17 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef CHROME_COMMON_GFX_CHROME_FONT_H__ -#define CHROME_COMMON_GFX_CHROME_FONT_H__ +#ifndef CHROME_COMMON_GFX_CHROME_FONT_H_ +#define CHROME_COMMON_GFX_CHROME_FONT_H_ + +#include "build/build_config.h" -#include <windows.h> #include <string> +#if defined(OS_WIN) +typedef struct HFONT__* HFONT; +#endif + #include "base/basictypes.h" #include "base/ref_counted.h" @@ -127,19 +132,8 @@ class ChromeFont { int baseline, int ave_char_width, int style, - int dlu_base_x) - : hfont_(hfont), - height_(height), - baseline_(baseline), - ave_char_width_(ave_char_width), - style_(style), - dlu_base_x_(dlu_base_x) { - DLOG_ASSERT(hfont); - } - - ~HFontRef() { - DeleteObject(hfont_); - } + int dlu_base_x); + ~HFontRef(); // Accessors HFONT hfont() const { return hfont_; } @@ -158,7 +152,7 @@ class ChromeFont { // Constants used in converting dialog units to pixels. const int dlu_base_x_; - DISALLOW_EVIL_CONSTRUCTORS(HFontRef); + DISALLOW_COPY_AND_ASSIGN(HFontRef); }; @@ -178,4 +172,4 @@ class ChromeFont { scoped_refptr<HFontRef> font_ref_; }; -#endif // CHROME_COMMON_GFX_CHROME_FONT_H__ +#endif // CHROME_COMMON_GFX_CHROME_FONT_H_ |