Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4156503

Performance improvement of win32 AwtGraphics::ClearRect()

    XMLWordPrintable

Details

    • kestrel
    • x86
    • windows_nt

    Description

      Referencing MFC, the win32 AwtGraphics::FillRect() performance can be improved by using the following API calls

      AwtGraphics::FillRect(...)
      {
          // ...
          ::SetBkColor(m_hDC, clr);
          ::ExtTextOut(m_hDC, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
          // ...
      }

      Instead of the current coding,

      void AwtGraphics::FillRect(JNIEnv* env, long nX, long nY, long nW, long nH)
      {
          if (nW <= 0 || nH <= 0) {
              return;
          }
          HDC hDC = GetDC();
          if (hDC == NULL) {
              return;
          }
          SetBrushColor(TRUE);
          // Bug #4047723 (FillRect apears wrong (was using the wrong DC handle))
          // Bug #4055623 (Performance enhancements)
          VERIFY(::PatBlt(hDC, nX + m_originX, nY + m_originY, nW, nH,
                          ((m_rop == R2_XORPEN) ? PATINVERT : PATCOPY)));
          ReleaseDC();
      }

      Attachments

        Activity

          People

            dmendenhsunw David Mendenhall (Inactive)
            hongzh Hong Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: