Fix testplugin painting issues from bug 596451 part J - when doing non-solid painting, paint to x/y, not 0/0.
authorBenjamin Smedberg <benjamin@smedbergs.us>
Thu, 28 Oct 2010 09:17:35 -0400
changeset 57221 9adc8f43d987fdf4ff0bd5945fbe9753f9c08bed
parent 57220 005779cf3e419a4613459e764c90700bec6ad421
child 57222 3db23492203ff76d97ade9e85436b99a165d5040
push id16846
push userbsmedberg@mozilla.com
push dateWed, 10 Nov 2010 15:29:47 +0000
treeherdermozilla-central@bdbef533364f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs596451
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Fix testplugin painting issues from bug 596451 part J - when doing non-solid painting, paint to x/y, not 0/0.
modules/plugin/test/testplugin/nptest_windows.cpp
--- a/modules/plugin/test/testplugin/nptest_windows.cpp
+++ b/modules/plugin/test/testplugin/nptest_windows.cpp
@@ -107,46 +107,46 @@ pluginWidgetInit(InstanceData* instanceD
                     WS_CHILD, 0, 0, CHILD_WIDGET_SIZE, CHILD_WIDGET_SIZE, hWnd, NULL,
                     NULL, NULL);
 }
 
 static void
 drawToDC(InstanceData* instanceData, HDC dc,
          int x, int y, int width, int height)
 {
-  RECT fill = { 0, 0, width, height };
-
   switch (instanceData->scriptableObject->drawMode) {
     case DM_DEFAULT:
     {
+      const RECT fill = { x, y, width, height };
+
       int oldBkMode = ::SetBkMode(dc, TRANSPARENT);
       HBRUSH brush = ::CreateSolidBrush(RGB(0, 0, 0));
       if (brush) {
         ::FillRect(dc, &fill, brush);
         ::DeleteObject(brush);
       }
       if (width > 6 && height > 6) {
         brush = ::CreateSolidBrush(RGB(192, 192, 192));
         if (brush) {
-          RECT inset = { 3, 3, width - 3, height - 3 };
+          RECT inset = { x + 3, y + 3, x + width - 3, y + height - 3 };
           ::FillRect(dc, &inset, brush);
           ::DeleteObject(brush);
         }
       }
 
       const char* uaString = NPN_UserAgent(instanceData->npp);
       if (uaString && width > 10 && height > 10) {
         HFONT font =
           ::CreateFontA(20, 0, 0, 0, 400, FALSE, FALSE, FALSE,
                         DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
                         CLIP_DEFAULT_PRECIS, 5, // CLEARTYPE_QUALITY
                         DEFAULT_PITCH, "Arial");
         if (font) {
           HFONT oldFont = (HFONT)::SelectObject(dc, font);
-          RECT inset = { 5, 5, width - 5, height - 5 };
+          RECT inset = { x + 5, y + 5, x + width - 5, y + height - 5 };
           ::DrawTextA(dc, uaString, -1, &inset,
                       DT_LEFT | DT_TOP | DT_NOPREFIX | DT_WORDBREAK);
           ::SelectObject(dc, oldFont);
           ::DeleteObject(font);
         }
       }
       ::SetBkMode(dc, oldBkMode);
     }