File tree Expand file tree Collapse file tree 5 files changed +2
-43
lines changed
CodenameOne/src/com/codename1
Ports/iOSPort/src/com/codename1/impl/ios
docs/demos/common/src/test/java/com/codenameone/developerguide/animations
scripts/device-runner-app/tests Expand file tree Collapse file tree 5 files changed +2
-43
lines changed Original file line number Diff line number Diff line change @@ -1214,20 +1214,6 @@ public void screenshot(SuccessCallback<Image> callback) {
12141214 callback .onSucess (img );
12151215 }
12161216
1217- /**
1218- * Indicates whether the Codename One implementation expects caller-side painting to run
1219- * after a native screenshot has been captured. Implementations that composite peer
1220- * components into the screenshot can override this to {@code false} so downstream code
1221- * won't immediately repaint the captured image and accidentally hide native peers.
1222- *
1223- * @param screenshot the screenshot image produced by {@link #screenshot(SuccessCallback)}
1224- * @return {@code true} if the caller should repaint Codename One components onto the
1225- * screenshot, {@code false} otherwise.
1226- */
1227- public boolean shouldPaintNativeScreenshot (Image screenshot ) {
1228- return true ;
1229- }
1230-
12311217 /**
12321218 * Returns true if the platform supports a native image cache. The native image cache
12331219 * is different than just {@link FileSystemStorage#hasCachesDir()}. A native image cache
Original file line number Diff line number Diff line change @@ -5013,21 +5013,6 @@ public void screenshot(SuccessCallback<Image> callback) {
50135013 impl .screenshot (callback );
50145014 }
50155015
5016- /**
5017- * Indicates whether callers should repaint Codename One components onto a screenshot image
5018- * returned from {@link #screenshot(SuccessCallback)}. Platforms that already composite
5019- * peer components into the native screenshot can return {@code false} to keep the captured
5020- * pixels intact.
5021- *
5022- * @param screenshot the image returned from {@link #screenshot(SuccessCallback)}.
5023- * @return {@code true} if the caller should repaint Codename One components onto the
5024- * screenshot, {@code false} otherwise.
5025- */
5026- public boolean shouldPaintNativeScreenshot (Image screenshot ) {
5027- return impl .shouldPaintNativeScreenshot (screenshot );
5028- }
5029-
5030-
50315016 /**
50325017 * Convenience method to schedule a task to run on the EDT after {@literal timeout}ms.
50335018 *
Original file line number Diff line number Diff line change @@ -300,8 +300,6 @@ public void addCookie(Cookie c) {
300300 }
301301
302302 private static SuccessCallback <Image > screenshotCallback ;
303- private static volatile boolean lastScreenshotHasNativePeers ;
304-
305303 @ Override
306304 public void screenshot (final SuccessCallback <Image > callback ) {
307305 if (callback == null ) {
@@ -338,7 +336,6 @@ static void onScreenshot(final byte[] imageData) {
338336 final SuccessCallback <Image > callback = screenshotCallback ;
339337 screenshotCallback = null ;
340338 if (callback == null ) {
341- lastScreenshotHasNativePeers = false ;
342339 return ;
343340 }
344341
@@ -368,7 +365,6 @@ public void run() {
368365 }
369366
370367 if (image != null && image .getGraphics () != null ) {
371- lastScreenshotHasNativePeers = true ;
372368 callback .onSucess (image );
373369 return ;
374370 }
@@ -377,19 +373,11 @@ public void run() {
377373 Log .e (t );
378374 }
379375 }
380- lastScreenshotHasNativePeers = false ;
381376 callback .onSucess (null );
382377 }
383378 });
384379 }
385380
386- @ Override
387- public boolean shouldPaintNativeScreenshot (Image screenshot ) {
388- boolean shouldPaint = !lastScreenshotHasNativePeers ;
389- lastScreenshotHasNativePeers = false ;
390- return shouldPaint ;
391- }
392-
393381 /**
394382 * Used to enable/disable native cookies from native code.
395383 * @param cookiesArray
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ private Image capture(Form form) {
112112 throw new IllegalStateException ("Timed out waiting for native screenshot result." );
113113 }
114114
115- if (screenshot .getGraphics () != null && display . shouldPaintNativeScreenshot ( screenshot ) ) {
115+ if (screenshot .getGraphics () != null ) {
116116 form .paintComponent (screenshot .getGraphics (), true );
117117 }
118118
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ static boolean emitCurrentFormScreenshot(String testName) {
6262 return false ;
6363 }
6464 Image screenshot = img [0 ];
65- if (Display . getInstance (). shouldPaintNativeScreenshot ( screenshot ) ) {
65+ if (screenshot . getGraphics () != null ) {
6666 current .paintComponent (screenshot .getGraphics (), true );
6767 }
6868 try {
You can’t perform that action at this time.
0 commit comments