Commit 61d762a5 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fillGlyph в отдельную функию

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53907 954022d7-b5bf-4e40-9824-e11837661b57
parent d0f4ebda
...@@ -839,51 +839,50 @@ DrawingContext.prototype = { ...@@ -839,51 +839,50 @@ DrawingContext.prototype = {
var setUpSize = this.font.FontSize; var setUpSize = this.font.FontSize;
return Height * setUpSize / UnitsPerEm; return Height * setUpSize / UnitsPerEm;
}, },
fillText: function (text, x, y, maxWidth, charWidths, angle) { fillGlyph: function (pGlyph, fmgr) {
var t = this; var nW = pGlyph.oBitmap.nWidth;
function fillGlyph(pGlyph,fmgr) { var nH = pGlyph.oBitmap.nHeight;
var nW = pGlyph.oBitmap.nWidth;
var nH = pGlyph.oBitmap.nHeight; if ( !(nW > 0 && nH > 0) ) {return;}
if ( !(nW > 0 && nH > 0) ) {return;} var nX = asc_floor(fmgr.m_oGlyphString.m_fX + pGlyph.fX + pGlyph.oBitmap.nX);
var nY = asc_floor(fmgr.m_oGlyphString.m_fY + pGlyph.fY - pGlyph.oBitmap.nY);
var nX = asc_floor(fmgr.m_oGlyphString.m_fX + pGlyph.fX + pGlyph.oBitmap.nX);
var nY = asc_floor(fmgr.m_oGlyphString.m_fY + pGlyph.fY - pGlyph.oBitmap.nY); var _r = this.fillColor.r;
var _g = this.fillColor.g;
var _r = t.fillColor.r; var _b = this.fillColor.b;
var _g = t.fillColor.g;
var _b = t.fillColor.b; if (window.g_isMobileVersion) {
// Special for iPad (5.1)
if (window.g_isMobileVersion) {
// Special for iPad (5.1) if (!_r && !_g && !_b) {
this.ctx.drawImage(pGlyph.oBitmap.oGlyphData.m_oCanvas, 0, 0, nW, nH, nX, nY, nW, nH);
if (!_r && !_g && !_b) {
this.ctx.drawImage(pGlyph.oBitmap.oGlyphData.m_oCanvas, 0, 0, nW, nH, nX, nY, nW, nH);
} else {
var canvD = $("<canvas width='"+nW+"' height='"+nH+"'/>")[0];
var ctxD = canvD.getContext("2d");
var pixDst = ctxD.getImageData(0, 0, nW, nH);
var dstP = pixDst.data;
var data = pGlyph.oBitmap.oGlyphData.m_oContext.getImageData(0, 0, nW, nH);
var dataPx = data.data;
var cur = 0;
var cnt = 4 * nW * nH;
for (var i = 3; i < cnt; i += 4) {
dstP[cur++] = _r;
dstP[cur++] = _g;
dstP[cur++] = _b;
dstP[cur++] = dataPx[i];
}
ctxD.putImageData(pixDst, 0, 0, 0, 0, nW, nH);
this.ctx.drawImage(canvD, 0, 0, nW, nH, nX, nY, nW, nH);
}
} else { } else {
pGlyph.oBitmap.oGlyphData.checkColor(_r, _g, _b, nW, nH); var canvD = $("<canvas width='"+nW+"' height='"+nH+"'/>")[0];
pGlyph.oBitmap.draw(this.ctx, nX, nY); var ctxD = canvD.getContext("2d");
var pixDst = ctxD.getImageData(0, 0, nW, nH);
var dstP = pixDst.data;
var data = pGlyph.oBitmap.oGlyphData.m_oContext.getImageData(0, 0, nW, nH);
var dataPx = data.data;
var cur = 0;
var cnt = 4 * nW * nH;
for (var i = 3; i < cnt; i += 4) {
dstP[cur++] = _r;
dstP[cur++] = _g;
dstP[cur++] = _b;
dstP[cur++] = dataPx[i];
}
ctxD.putImageData(pixDst, 0, 0, 0, 0, nW, nH);
this.ctx.drawImage(canvD, 0, 0, nW, nH, nX, nY, nW, nH);
} }
} else {
pGlyph.oBitmap.oGlyphData.checkColor(_r, _g, _b, nW, nH);
pGlyph.oBitmap.draw(this.ctx, nX, nY);
} }
},
fillText: function (text, x, y, maxWidth, charWidths, angle) {
var manager = angle ? this.fmgrGraphics[1] : this.fmgrGraphics[0]; var manager = angle ? this.fmgrGraphics[1] : this.fmgrGraphics[0];
var _x = this._mift.transformPointX(x, y); var _x = this._mift.transformPointX(x, y);
...@@ -899,7 +898,7 @@ DrawingContext.prototype = { ...@@ -899,7 +898,7 @@ DrawingContext.prototype = {
var pGlyph = manager.m_oGlyphString.m_pGlyphsBuffer[0]; var pGlyph = manager.m_oGlyphString.m_pGlyphsBuffer[0];
if (null === pGlyph || null === pGlyph.oBitmap) {continue;} if (null === pGlyph || null === pGlyph.oBitmap) {continue;}
fillGlyph.call(this, pGlyph,manager); this.fillGlyph(pGlyph, manager);
} }
return this; return this;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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