1
1
/*
2
- * Copyright (c) 1996, 2020 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 1996, 2021 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
47
47
#include " awt_Win32GraphicsDevice.h"
48
48
#include " Hashtable.h"
49
49
#include " ComCtl32Util.h"
50
+ #include " math.h"
50
51
51
52
#include < Region.h>
52
53
@@ -2234,8 +2235,8 @@ void AwtComponent::PaintUpdateRgn(const RECT *insets)
2234
2235
*/
2235
2236
RECT* r = (RECT*)(buffer + rgndata->rdh .dwSize );
2236
2237
RECT* un[2 ] = {0 , 0 };
2237
- DWORD i;
2238
- for (i = 0 ; i < rgndata->rdh .nCount ; i++, r++) {
2238
+ DWORD i;
2239
+ for (i = 0 ; i < rgndata->rdh .nCount ; i++, r++) {
2239
2240
int width = r->right -r->left ;
2240
2241
int height = r->bottom -r->top ;
2241
2242
if (width > 0 && height > 0 ) {
@@ -2247,13 +2248,22 @@ void AwtComponent::PaintUpdateRgn(const RECT *insets)
2247
2248
}
2248
2249
}
2249
2250
}
2251
+ // The Windows may request to update the small region of pixels that
2252
+ // cannot be represented in the user's space, in this case, we will
2253
+ // request to repaint the smallest non-empty bounding box in the user's
2254
+ // space
2255
+ int screen = GetScreenImOn ();
2256
+ Devices::InstanceAccess devices;
2257
+ AwtWin32GraphicsDevice* device = devices->GetDevice (screen);
2258
+ float scaleX = (device == NULL ) ? 1 : device->GetScaleX ();
2259
+ float scaleY = (device == NULL ) ? 1 : device->GetScaleY ();
2250
2260
for (i = 0 ; i < 2 ; i++) {
2251
2261
if (un[i] != 0 ) {
2252
- DoCallback ( " handleExpose " , " (IIII)V " ,
2253
- ScaleDownX (un[i]->left ),
2254
- ScaleDownY (un[i]->top ),
2255
- ScaleDownX (un[i]->right - un[i]-> left ),
2256
- ScaleDownY (un[i]-> bottom - un[i]-> top ) );
2262
+ int x1 = floor (un[i]-> left / scaleX);
2263
+ int y1 = floor (un[i]->top / scaleY);
2264
+ int x2 = ceil (un[i]->right / scaleX);
2265
+ int y2 = ceil (un[i]->bottom / scaleY);
2266
+ DoCallback ( " handleExpose " , " (IIII)V " , x1, y1 , x2 - x1, y2 - y1 );
2257
2267
}
2258
2268
}
2259
2269
delete [] buffer;
1 commit comments
openjdk-notifier[bot] commentedon Dec 29, 2021
Review
Issues