MIDITrail をピカピカにする。鍵盤方向自動切替・多ポート・歌詞対応等
Revision | 36a3d53e301a87f7e2925351b0b74e8ead05fac8 (tree) |
---|---|
Time | 2023-08-06 14:38:45 |
Author | yoshy <yoshy@user...> |
Commiter | yoshy |
[CLEAN] 不要なnullチェック、空チェックを削除
@@ -49,39 +49,13 @@ void MTFont2Bmp::Clear() | ||
49 | 49 | m_hFont = NULL; |
50 | 50 | } |
51 | 51 | |
52 | -// >>> add 20120728 yossiepon begin | |
53 | - if(!m_GlyphBmpList.empty()) { | |
54 | -// <<< add 20120728 yossiepon end | |
55 | - | |
56 | - for (itr = m_GlyphBmpList.begin(); itr != m_GlyphBmpList.end(); itr++) { | |
57 | - | |
58 | -// >>> add 20120728 yossiepon begin | |
59 | - if(itr->pBmp != NULL) { | |
60 | -// <<< add 20120728 yossiepon end | |
61 | - | |
62 | - delete [] (itr->pBmp); | |
63 | - | |
64 | -// >>> add 20120728 yossiepon begin | |
65 | - } | |
66 | -// <<< add 20120728 yossiepon end | |
67 | - | |
68 | - } | |
69 | - m_GlyphBmpList.clear(); | |
70 | - | |
71 | -// >>> add 20120728 yossiepon begin | |
52 | + for (itr = m_GlyphBmpList.begin(); itr != m_GlyphBmpList.end(); itr++) { | |
53 | + delete [] (itr->pBmp); | |
72 | 54 | } |
73 | -// <<< add 20120728 yossiepon end | |
55 | + m_GlyphBmpList.clear(); | |
74 | 56 | |
75 | -// >>> add 20120728 yossiepon begin | |
76 | - if(m_pBmpBuf != NULL) { | |
77 | -// <<< add 20120728 yossiepon end | |
78 | - | |
79 | - delete [] m_pBmpBuf; | |
80 | - m_pBmpBuf = NULL; | |
81 | - | |
82 | -// >>> add 20120728 yossiepon begin | |
83 | - } | |
84 | -// <<< add 20120728 yossiepon end | |
57 | + delete [] m_pBmpBuf; | |
58 | + m_pBmpBuf = NULL; | |
85 | 59 | } |
86 | 60 | |
87 | 61 | //****************************************************************************** |
@@ -407,19 +381,9 @@ int MTFont2Bmp::_CreateBmpBuf() | ||
407 | 381 | |
408 | 382 | //幅 |
409 | 383 | m_BmpWidth = 0; |
410 | - | |
411 | -// >>> add 20120728 yossiepon begin | |
412 | - if(!m_GlyphBmpList.empty()) { | |
413 | -// <<< add 20120728 yossiepon end | |
414 | - | |
415 | - for (itr = m_GlyphBmpList.begin(); itr != m_GlyphBmpList.end(); itr++) { | |
416 | - m_BmpWidth += (itr->glyphMetric.gmCellIncX); | |
417 | - } | |
418 | - | |
419 | -// >>> add 20120728 yossiepon begin | |
384 | + for (itr = m_GlyphBmpList.begin(); itr != m_GlyphBmpList.end(); itr++) { | |
385 | + m_BmpWidth += (itr->glyphMetric.gmCellIncX); | |
420 | 386 | } |
421 | -// <<< add 20120728 yossiepon end | |
422 | - | |
423 | 387 | //幅を4の倍数にする |
424 | 388 | m_BmpWidth = m_BmpWidth + ((4 - (m_BmpWidth % 4)) % 4); |
425 | 389 |
@@ -456,58 +420,50 @@ int MTFont2Bmp::_WriteGlyphToBmpBuf() | ||
456 | 420 | BYTE* pSrc = NULL; |
457 | 421 | BYTE* pDest = NULL; |
458 | 422 | |
459 | -// >>> add 20120728 yossiepon begin | |
460 | - if(!m_GlyphBmpList.empty()) { | |
461 | -// <<< add 20120728 yossiepon end | |
462 | - | |
463 | - for (itr = m_GlyphBmpList.begin(); itr != m_GlyphBmpList.end(); itr++) { | |
464 | - | |
465 | - //空文字はスキップ | |
466 | - if (itr->pBmp == NULL) { | |
467 | - offsetX += (itr->glyphMetric.gmCellIncX); | |
468 | - continue; | |
469 | - } | |
470 | - | |
471 | - //コピー元グリフBMPの座標は4の倍数制限があるBMPサイズを意識せず | |
472 | - //実データの範囲でスキャンする | |
473 | - for (y = 0; y < (itr->glyphMetric.gmBlackBoxY); y++) { | |
474 | - //Ticket #33695 対策 | |
475 | - //コピー先の領域外になる場合はスキップする | |
476 | - if (y >= m_BmpHeight) continue; | |
477 | - | |
478 | - for (x = 0; x < (itr->glyphMetric.gmBlackBoxX); x++) { | |
423 | + for (itr = m_GlyphBmpList.begin(); itr != m_GlyphBmpList.end(); itr++) { | |
479 | 424 | |
480 | - //コピー先の領域外になる場合はスキップする | |
481 | - destX = offsetX + (itr->glyphMetric.gmptGlyphOrigin.x) + x; | |
482 | - if (destX >= (m_BmpWidth-1)) continue; | |
483 | - | |
484 | - //コピー元ピクセルポインタ:BMPサイズの4の倍数制限を意識して算出する | |
485 | - pSrc = itr->pBmp + (itr->bmpWidth * y) + x; | |
425 | + //空文字はスキップ | |
426 | + if (itr->pBmp == NULL) { | |
427 | + offsetX += (itr->glyphMetric.gmCellIncX); | |
428 | + continue; | |
429 | + } | |
486 | 430 | |
487 | - //コピー先ピクセルポインタ | |
488 | - pDest = m_pBmpBuf | |
489 | - + (m_TextMetric.tmAscent - (itr->glyphMetric.gmptGlyphOrigin.y) + y) * m_BmpWidth | |
490 | - + (offsetX + (itr->glyphMetric.gmptGlyphOrigin.x) + x); | |
431 | + //コピー元グリフBMPの座標は4の倍数制限があるBMPサイズを意識せず | |
432 | + //実データの範囲でスキャンする | |
433 | + for (y = 0; y < (itr->glyphMetric.gmBlackBoxY); y++) { | |
434 | + //Ticket #33695 対策 | |
435 | + //コピー先の領域外になる場合はスキップする | |
436 | + if (y >= m_BmpHeight) continue; | |
491 | 437 | |
492 | - //確保したバッファを越えて書き込もうとしていないかチェックする | |
493 | - if (pDest > (m_pBmpBuf + (m_BmpHeight * m_BmpWidth) - 1)) { | |
494 | - //result = YN_SET_ERR("Program error.", itr->glyphMetric.gmBlackBoxY, itr->glyphMetric.gmBlackBoxX); | |
495 | - //goto EXIT; | |
496 | - //Ticket #33695 対策 | |
497 | - //エラーとせずスキップする | |
498 | - continue; | |
499 | - } | |
438 | + for (x = 0; x < (itr->glyphMetric.gmBlackBoxX); x++) { | |
500 | 439 | |
501 | - //ピクセルコピー | |
502 | - *pDest = *pSrc; | |
440 | + //コピー先の領域外になる場合はスキップする | |
441 | + destX = offsetX + (itr->glyphMetric.gmptGlyphOrigin.x) + x; | |
442 | + if (destX >= (m_BmpWidth-1)) continue; | |
443 | + | |
444 | + //コピー元ピクセルポインタ:BMPサイズの4の倍数制限を意識して算出する | |
445 | + pSrc = itr->pBmp + (itr->bmpWidth * y) + x; | |
446 | + | |
447 | + //コピー先ピクセルポインタ | |
448 | + pDest = m_pBmpBuf | |
449 | + + (m_TextMetric.tmAscent - (itr->glyphMetric.gmptGlyphOrigin.y) + y) * m_BmpWidth | |
450 | + + (offsetX + (itr->glyphMetric.gmptGlyphOrigin.x) + x); | |
451 | + | |
452 | + //確保したバッファを越えて書き込もうとしていないかチェックする | |
453 | + if (pDest > (m_pBmpBuf + (m_BmpHeight * m_BmpWidth) - 1)) { | |
454 | + //result = YN_SET_ERR("Program error.", itr->glyphMetric.gmBlackBoxY, itr->glyphMetric.gmBlackBoxX); | |
455 | + //goto EXIT; | |
456 | + //Ticket #33695 対策 | |
457 | + //エラーとせずスキップする | |
458 | + continue; | |
503 | 459 | } |
460 | + | |
461 | + //ピクセルコピー | |
462 | + *pDest = *pSrc; | |
504 | 463 | } |
505 | - offsetX += (itr->glyphMetric.gmCellIncX); | |
506 | 464 | } |
507 | - | |
508 | -// >>> add 20120728 yossiepon begin | |
465 | + offsetX += (itr->glyphMetric.gmCellIncX); | |
509 | 466 | } |
510 | -// <<< add 20120728 yossiepon end | |
511 | 467 | |
512 | 468 | //EXIT:; |
513 | 469 | return result; |
@@ -532,12 +532,8 @@ void MTNoteBox::Release() | ||
532 | 532 | m_PrimitiveActiveNotes.Release(); |
533 | 533 | m_NoteList.Clear(); |
534 | 534 | |
535 | -// >>> modify 20120728 yossiepon begin | |
536 | - if(m_pNoteStatus != NULL) { | |
537 | - delete [] m_pNoteStatus; | |
538 | - m_pNoteStatus = NULL; | |
539 | - } | |
540 | -// <<< modify 20120728 yossiepon end | |
535 | + delete [] m_pNoteStatus; | |
536 | + m_pNoteStatus = NULL; | |
541 | 537 | } |
542 | 538 | |
543 | 539 | //****************************************************************************** |
@@ -393,10 +393,8 @@ EXIT:; | ||
393 | 393 | //****************************************************************************** |
394 | 394 | void MTNoteBoxMod::Release() |
395 | 395 | { |
396 | - if(m_pNoteStatusMod != NULL) { | |
397 | - delete [] m_pNoteStatusMod; | |
398 | - m_pNoteStatusMod = NULL; | |
399 | - } | |
396 | + delete [] m_pNoteStatusMod; | |
397 | + m_pNoteStatusMod = NULL; | |
400 | 398 | } |
401 | 399 | |
402 | 400 | //****************************************************************************** |
@@ -282,7 +282,6 @@ EXIT:; | ||
282 | 282 | //****************************************************************************** |
283 | 283 | void MTNoteRipple::Release() |
284 | 284 | { |
285 | - | |
286 | 285 | delete m_pNoteDesign; |
287 | 286 | m_pNoteDesign = NULL; |
288 | 287 |
@@ -293,12 +292,8 @@ void MTNoteRipple::Release() | ||
293 | 292 | m_pTexture = NULL; |
294 | 293 | } |
295 | 294 | |
296 | -// >>> modify 20120728 yossiepon begin | |
297 | - if(m_pNoteStatus != NULL) { | |
298 | - delete [] m_pNoteStatus; | |
299 | - m_pNoteStatus = NULL; | |
300 | - } | |
301 | -// <<< modify 20120728 yossiepon end | |
295 | + delete [] m_pNoteStatus; | |
296 | + m_pNoteStatus = NULL; | |
302 | 297 | } |
303 | 298 | |
304 | 299 | //****************************************************************************** |
@@ -528,11 +528,9 @@ void MTPianoKeyboardCtrl::Release() | ||
528 | 528 | } |
529 | 529 | |
530 | 530 | // >>> modify 20120728 yossiepon begin |
531 | - if(m_pNoteStatus != NULL) { | |
532 | - //20120728 yossiepon: delete を delete[] に修正 | |
533 | - delete[] m_pNoteStatus; | |
534 | - m_pNoteStatus = NULL; | |
535 | - } | |
531 | + //20120728 yossiepon: delete を delete[] に修正 | |
532 | + delete[] m_pNoteStatus; | |
533 | + m_pNoteStatus = NULL; | |
536 | 534 | // <<< modify 20120728 yossiepon end |
537 | 535 | } |
538 | 536 |