Changeset 967723f in git


Ignore:
Timestamp:
14/06/10 05:24:46 (9 years ago)
Author:
Olly Betts <olly@…>
Branches:
add-show-splays, line_contents, master, stereo, svn/github/master, svn/origin/master, svn/survex-1_1, svn/tags/1.1.14, svn/tags/1.1.15, svn/tags/1.1.16, svn/tags/1.2.0, svn/tags/1.2.1, svn/tags/1.2.2, svn/tags/1.2.3, svn/tags/1.2.4, svn/tags/1.2.5, svn/tags/v1_1_13, svn/trunk, travis-osx
Children:
5f4a155
Parents:
739b92c
Message:

src/fnt.h,src/gla-gl.cc: Pass the length of the string to
fntTexFont::puts() rather than recalculating it inside the
method.

git-svn-id: file:///home/survex-svn/survex/branches/survex-1_1@3401 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r739b92c r967723f  
     1Mon Jun 14 04:23:22 GMT 2010  Olly Betts <olly@survex.com>
     2
     3        * src/fnt.h,src/gla-gl.cc: Pass the length of the string to
     4          fntTexFont::puts() rather than recalculating it inside the
     5          method.
     6
    17Sun Jun 13 12:57:08 GMT 2010  Olly Betts <olly@survex.com>
    28
  • src/fnt.h

    r739b92c r967723f  
    44//  Draw text using texture mapped fonts.
    55//
    6 //  Copyright (C) 2003,2004,2006 Olly Betts
     6//  Copyright (C) 2003,2004,2006,2010 Olly Betts
    77//
    88//     Based on code from PLIB - http://plib.sourceforge.net
     
    7979    }
    8080
    81     void puts(int x, int y, const wxChar *s) const {
     81    void puts(int x, int y, const wxChar *s, size_t len) const {
    8282        glBindTexture(GL_TEXTURE_2D, texture);
    8383        glMatrixMode(GL_MODELVIEW);
     
    8787        glListBase(list_base);
    8888        if (sizeof(wxChar) == 1) {
    89             glCallLists(strlen((const char *)s), GL_UNSIGNED_BYTE, s);
     89            glCallLists(len, GL_UNSIGNED_BYTE, s);
    9090        } else if (sizeof(wxChar) == 2) {
    91             size_t len = 0;
    92             while (s[len]) ++len;
    9391            glCallLists(len, GL_UNSIGNED_SHORT, s);
    9492        } else if (sizeof(wxChar) == 4) {
    95             size_t len = 0;
    96             while (s[len]) ++len;
    9793            glCallLists(len, GL_UNSIGNED_INT, s);
    9894        }
  • src/gla-gl.cc

    r739b92c r967723f  
    55//
    66//  Copyright (C) 2002-2003,2005 Mark R. Shinwell
    7 //  Copyright (C) 2003,2004,2005,2006,2007 Olly Betts
     7//  Copyright (C) 2003,2004,2005,2006,2007,2010 Olly Betts
    88//
    99//  This program is free software; you can redistribute it and/or modify
     
    817817    glEnable(GL_TEXTURE_2D);
    818818    glDisable(GL_DEPTH_TEST);
    819     m_Font.puts(x, y, str.c_str());
     819    m_Font.puts(x, y, str.data(), str.size());
    820820    glPopAttrib();
    821821#else
Note: See TracChangeset for help on using the changeset viewer.