• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-cqtcocoa誰得pythonphprubygameguibathyscaphec翻訳計画中(planning stage)omegatframeworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

MIDITrail をピカピカにする。鍵盤方向自動切替・多ポート・歌詞対応等


Commit MetaInfo

Revisiónadcf0bc8dad9da8c65aab1a9e251f0af8b66fa9c (tree)
Tiempo2019-12-24 23:48:56
Autoryoshy <yoshy@user...>
Commiteryoshy

Log Message

[CLEAN] 不要なnullチェック、空チェックを削除

Cambiar Resumen

Diferencia incremental

--- a/MIDITrail/MTFont2Bmp.cpp
+++ b/MIDITrail/MTFont2Bmp.cpp
@@ -49,39 +49,13 @@ void MTFont2Bmp::Clear()
4949 m_hFont = NULL;
5050 }
5151
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);
7254 }
73-// <<< add 20120728 yossiepon end
55+ m_GlyphBmpList.clear();
7456
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;
8559 }
8660
8761 //******************************************************************************
@@ -407,19 +381,9 @@ int MTFont2Bmp::_CreateBmpBuf()
407381
408382 //幅
409383 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);
420386 }
421-// <<< add 20120728 yossiepon end
422-
423387 //幅を4の倍数にする
424388 m_BmpWidth = m_BmpWidth + ((4 - (m_BmpWidth % 4)) % 4);
425389
@@ -456,58 +420,50 @@ int MTFont2Bmp::_WriteGlyphToBmpBuf()
456420 BYTE* pSrc = NULL;
457421 BYTE* pDest = NULL;
458422
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++) {
479424
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+ }
486430
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;
491437
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++) {
500439
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;
503459 }
460+
461+ //ピクセルコピー
462+ *pDest = *pSrc;
504463 }
505- offsetX += (itr->glyphMetric.gmCellIncX);
506464 }
507-
508-// >>> add 20120728 yossiepon begin
465+ offsetX += (itr->glyphMetric.gmCellIncX);
509466 }
510-// <<< add 20120728 yossiepon end
511467
512468 //EXIT:;
513469 return result;
--- a/MIDITrail/MTNoteBox.cpp
+++ b/MIDITrail/MTNoteBox.cpp
@@ -532,12 +532,8 @@ void MTNoteBox::Release()
532532 m_PrimitiveActiveNotes.Release();
533533 m_NoteList.Clear();
534534
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;
541537 }
542538
543539 //******************************************************************************
--- a/MIDITrail/MTNoteBoxMod.cpp
+++ b/MIDITrail/MTNoteBoxMod.cpp
@@ -393,10 +393,8 @@ EXIT:;
393393 //******************************************************************************
394394 void MTNoteBoxMod::Release()
395395 {
396- if(m_pNoteStatusMod != NULL) {
397- delete [] m_pNoteStatusMod;
398- m_pNoteStatusMod = NULL;
399- }
396+ delete [] m_pNoteStatusMod;
397+ m_pNoteStatusMod = NULL;
400398 }
401399
402400 //******************************************************************************
--- a/MIDITrail/MTNoteRipple.cpp
+++ b/MIDITrail/MTNoteRipple.cpp
@@ -282,7 +282,6 @@ EXIT:;
282282 //******************************************************************************
283283 void MTNoteRipple::Release()
284284 {
285-
286285 delete m_pNoteDesign;
287286 m_pNoteDesign = NULL;
288287
@@ -293,12 +292,8 @@ void MTNoteRipple::Release()
293292 m_pTexture = NULL;
294293 }
295294
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;
302297 }
303298
304299 //******************************************************************************
--- a/MIDITrail/MTPianoKeyboardCtrl.cpp
+++ b/MIDITrail/MTPianoKeyboardCtrl.cpp
@@ -528,11 +528,9 @@ void MTPianoKeyboardCtrl::Release()
528528 }
529529
530530 // >>> 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;
536534 // <<< modify 20120728 yossiepon end
537535 }
538536