Commit 3cfed6aa authored by Oleg.Korshul's avatar Oleg.Korshul

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47399 954022d7-b5bf-4e40-9824-e11837661b57
parent 3b24555e
......@@ -224,6 +224,61 @@ TGlyphBitmap.prototype =
}
},
drawCropInRect : function(context2D, x, y, clipRect)
{
var _x = x;
var _y = y;
var _r = x + this.nWidth;
var _b = y + this.nHeight;
var _dstX = 0;
var _dstY = 0;
var _dstW = this.nWidth;
var _dstH = this.nHeight;
if (_x < clipRect.l)
{
_dstX = clipRect.l - _x;
_x += _dstX;
_dstW -= _dstX;
}
if (_y < clipRect.t)
{
_dstY = clipRect.t - _y;
_y += _dstY;
_dstH -= _dstY;
}
if (_r > clipRect.r)
{
_dstW -= (_r - clipRect.r);
}
if (_b > clipRect.b)
{
_dstH -= (_b - clipRect.b);
}
if (_dstW <= 0 || _dstH <= 0)
return;
if (null != this.oGlyphData.TempImage)
{
context2D.drawImage(this.oGlyphData.TempImage, _dstX, _dstY, _dstW, _dstH, _x, _y, _dstW, _dstH);
this.oGlyphData.TempImage = null;
}
else if (null != this.oGlyphData.m_oCanvas)
{
// своя память
context2D.drawImage(this.oGlyphData.m_oCanvas, _dstX, _dstY, _dstW, _dstH, _x, _y, _dstW, _dstH);
}
else
{
var _raster = this.oGlyphData.RasterData;
var __x = _raster.Line.Height * _raster.Index;
var __y = _raster.Line.Y;
context2D.drawImage(_raster.Chunk.CanvasImage, __x + _dstX, __y + _dstY, _dstW, _dstH, _x, _y, _dstW, _dstH);
}
},
Free : function()
{
if (null != this.oGlyphData.RasterData)
......
......@@ -1244,7 +1244,7 @@ CGraphics.prototype =
}
catch(err)
{
}
}
if (false === this.m_bIntegerGrid)
{
......@@ -1459,7 +1459,11 @@ CGraphics.prototype =
var nY = (this.m_oFontManager.m_oGlyphString.m_fY + pGlyph.fY - pGlyph.oBitmap.nY) >> 0;
pGlyph.oBitmap.oGlyphData.checkColor(this.m_oBrush.Color1.R,this.m_oBrush.Color1.G,this.m_oBrush.Color1.B,nW,nH);
pGlyph.oBitmap.draw(this.m_oContext, nX, nY);
if (null == this.TextClipRect)
pGlyph.oBitmap.draw(this.m_oContext, nX, nY, this.TextClipRect);
else
pGlyph.oBitmap.drawCropInRect(this.m_oContext, nX, nY, this.TextClipRect);
},
private_FillGlyphC : function(pGlyph,cropX,cropW)
{
......@@ -2518,5 +2522,15 @@ CGraphics.prototype =
{
if (bIsRestore)
this.RestoreGrState();
},
SetTextClipRect : function(_l, _t, _r, _b)
{
this.TextClipRect = {
l : _l,
t : _t,
r : _r,
b : _b
};
}
};
\ No newline at end of file
......@@ -780,12 +780,7 @@ function CDocMeta()
case 164:
{
// text clip rect
g.TextClipRect = {
l : s.GetDouble(),
t : s.GetDouble(),
r : s.GetDouble(),
b : s.GetDouble()
};
g.SetTextClipRect(s.GetDouble(), s.GetDouble(), s.GetDouble(), s.GetDouble());
break;
}
default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment