Fixed SF Bug #781355. It was a problem with the clipping region. (By
default when drawing the ctrl characters a different drawtext method is called than for normal text and this one didn't take care of the clipping region correctly.) Also fixed a couple buffer overflow errors. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -405,7 +405,7 @@ void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font, int ybase,
|
|||||||
SetFont(font);
|
SetFont(font);
|
||||||
hdc->SetTextForeground(wxColourFromCA(fore));
|
hdc->SetTextForeground(wxColourFromCA(fore));
|
||||||
hdc->SetTextBackground(wxColourFromCA(back));
|
hdc->SetTextBackground(wxColourFromCA(back));
|
||||||
//FillRectangle(rc, back);
|
FillRectangle(rc, back);
|
||||||
|
|
||||||
// ybase is where the baseline should be, but wxWin uses the upper left
|
// ybase is where the baseline should be, but wxWin uses the upper left
|
||||||
// corner, so I need to calculate the real position for the text...
|
// corner, so I need to calculate the real position for the text...
|
||||||
@@ -418,11 +418,12 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font, int ybase,
|
|||||||
SetFont(font);
|
SetFont(font);
|
||||||
hdc->SetTextForeground(wxColourFromCA(fore));
|
hdc->SetTextForeground(wxColourFromCA(fore));
|
||||||
hdc->SetTextBackground(wxColourFromCA(back));
|
hdc->SetTextBackground(wxColourFromCA(back));
|
||||||
//FillRectangle(rc, back);
|
FillRectangle(rc, back);
|
||||||
hdc->SetClippingRegion(wxRectFromPRectangle(rc));
|
hdc->SetClippingRegion(wxRectFromPRectangle(rc));
|
||||||
|
|
||||||
// see comments above
|
// see comments above
|
||||||
hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent);
|
hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent);
|
||||||
|
hdc->DestroyClippingRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -450,7 +451,7 @@ void SurfaceImpl::MeasureWidths(Font &font, const char *s, int len, int *positio
|
|||||||
#ifndef __WXMAC__
|
#ifndef __WXMAC__
|
||||||
// Calculate the position of each character based on the widths of
|
// Calculate the position of each character based on the widths of
|
||||||
// the previous characters
|
// the previous characters
|
||||||
int* tpos = new int[len];
|
int* tpos = new int[len+1];
|
||||||
int totalWidth = 0;
|
int totalWidth = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i=0; i<str.Length(); i++) {
|
for (i=0; i<str.Length(); i++) {
|
||||||
@@ -465,7 +466,7 @@ void SurfaceImpl::MeasureWidths(Font &font, const char *s, int len, int *positio
|
|||||||
// on OS X widths can be fractions of pixels wide when more than one
|
// on OS X widths can be fractions of pixels wide when more than one
|
||||||
// are drawn together, so the sum of all character widths is not necessarily
|
// are drawn together, so the sum of all character widths is not necessarily
|
||||||
// (and probably not) the same as the whole string width.
|
// (and probably not) the same as the whole string width.
|
||||||
int* tpos = new int[len];
|
int* tpos = new int[len+1];
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i=0; i<str.Length(); i++) {
|
for (i=0; i<str.Length(); i++) {
|
||||||
int w, h;
|
int w, h;
|
||||||
|
@@ -395,7 +395,7 @@ methodOverrideMap = {
|
|||||||
int len = end - start;
|
int len = end - start;
|
||||||
if (!len) return wxEmptyString;
|
if (!len) return wxEmptyString;
|
||||||
|
|
||||||
wxMemoryBuffer mbuf(len+1);
|
wxMemoryBuffer mbuf(len+2);
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||||
SendMsg(%s, 0, (long)buf);
|
SendMsg(%s, 0, (long)buf);
|
||||||
mbuf.UngetWriteBuf(len);
|
mbuf.UngetWriteBuf(len);
|
||||||
|
@@ -1121,7 +1121,7 @@ wxString wxStyledTextCtrl::GetSelectedText() {
|
|||||||
int len = end - start;
|
int len = end - start;
|
||||||
if (!len) return wxEmptyString;
|
if (!len) return wxEmptyString;
|
||||||
|
|
||||||
wxMemoryBuffer mbuf(len+1);
|
wxMemoryBuffer mbuf(len+2);
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||||
SendMsg(2161, 0, (long)buf);
|
SendMsg(2161, 0, (long)buf);
|
||||||
mbuf.UngetWriteBuf(len);
|
mbuf.UngetWriteBuf(len);
|
||||||
|
@@ -405,7 +405,7 @@ void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font, int ybase,
|
|||||||
SetFont(font);
|
SetFont(font);
|
||||||
hdc->SetTextForeground(wxColourFromCA(fore));
|
hdc->SetTextForeground(wxColourFromCA(fore));
|
||||||
hdc->SetTextBackground(wxColourFromCA(back));
|
hdc->SetTextBackground(wxColourFromCA(back));
|
||||||
//FillRectangle(rc, back);
|
FillRectangle(rc, back);
|
||||||
|
|
||||||
// ybase is where the baseline should be, but wxWin uses the upper left
|
// ybase is where the baseline should be, but wxWin uses the upper left
|
||||||
// corner, so I need to calculate the real position for the text...
|
// corner, so I need to calculate the real position for the text...
|
||||||
@@ -418,11 +418,12 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font, int ybase,
|
|||||||
SetFont(font);
|
SetFont(font);
|
||||||
hdc->SetTextForeground(wxColourFromCA(fore));
|
hdc->SetTextForeground(wxColourFromCA(fore));
|
||||||
hdc->SetTextBackground(wxColourFromCA(back));
|
hdc->SetTextBackground(wxColourFromCA(back));
|
||||||
//FillRectangle(rc, back);
|
FillRectangle(rc, back);
|
||||||
hdc->SetClippingRegion(wxRectFromPRectangle(rc));
|
hdc->SetClippingRegion(wxRectFromPRectangle(rc));
|
||||||
|
|
||||||
// see comments above
|
// see comments above
|
||||||
hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent);
|
hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent);
|
||||||
|
hdc->DestroyClippingRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -450,7 +451,7 @@ void SurfaceImpl::MeasureWidths(Font &font, const char *s, int len, int *positio
|
|||||||
#ifndef __WXMAC__
|
#ifndef __WXMAC__
|
||||||
// Calculate the position of each character based on the widths of
|
// Calculate the position of each character based on the widths of
|
||||||
// the previous characters
|
// the previous characters
|
||||||
int* tpos = new int[len];
|
int* tpos = new int[len+1];
|
||||||
int totalWidth = 0;
|
int totalWidth = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i=0; i<str.Length(); i++) {
|
for (i=0; i<str.Length(); i++) {
|
||||||
@@ -465,7 +466,7 @@ void SurfaceImpl::MeasureWidths(Font &font, const char *s, int len, int *positio
|
|||||||
// on OS X widths can be fractions of pixels wide when more than one
|
// on OS X widths can be fractions of pixels wide when more than one
|
||||||
// are drawn together, so the sum of all character widths is not necessarily
|
// are drawn together, so the sum of all character widths is not necessarily
|
||||||
// (and probably not) the same as the whole string width.
|
// (and probably not) the same as the whole string width.
|
||||||
int* tpos = new int[len];
|
int* tpos = new int[len+1];
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i=0; i<str.Length(); i++) {
|
for (i=0; i<str.Length(); i++) {
|
||||||
int w, h;
|
int w, h;
|
||||||
|
@@ -395,7 +395,7 @@ methodOverrideMap = {
|
|||||||
int len = end - start;
|
int len = end - start;
|
||||||
if (!len) return wxEmptyString;
|
if (!len) return wxEmptyString;
|
||||||
|
|
||||||
wxMemoryBuffer mbuf(len+1);
|
wxMemoryBuffer mbuf(len+2);
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||||
SendMsg(%s, 0, (long)buf);
|
SendMsg(%s, 0, (long)buf);
|
||||||
mbuf.UngetWriteBuf(len);
|
mbuf.UngetWriteBuf(len);
|
||||||
|
@@ -1121,7 +1121,7 @@ wxString wxStyledTextCtrl::GetSelectedText() {
|
|||||||
int len = end - start;
|
int len = end - start;
|
||||||
if (!len) return wxEmptyString;
|
if (!len) return wxEmptyString;
|
||||||
|
|
||||||
wxMemoryBuffer mbuf(len+1);
|
wxMemoryBuffer mbuf(len+2);
|
||||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||||
SendMsg(2161, 0, (long)buf);
|
SendMsg(2161, 0, (long)buf);
|
||||||
mbuf.UngetWriteBuf(len);
|
mbuf.UngetWriteBuf(len);
|
||||||
|
Reference in New Issue
Block a user