Project

General

Profile

caching_images_20151012.txt

Sergey Ivanovskiy, 10/12/2015 12:44 PM

Download (22.5 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js'
2
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js	2015-10-12 08:01:00 +0000
3
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js	2015-10-12 15:13:00 +0000
4
@@ -17,6 +17,7 @@
5
 ** 005 GES 20150701 Added a clarifying comment.
6
 ** 006 SBI 20150922 Rewrite to create separate ChUI and GUI implementations.
7
 ** 007 SBI 20151006 Improvements to support better GUI key processing compatibility.
8
+** 008 SBI 20151011 Added SHIFT + DEL key label to return 639 as its key code.
9
 */
10
 
11
 "use strict";
12
@@ -1120,7 +1121,7 @@
13
       basicKeys[650] = "MIDDLE-MOUSE-DBLCLICK";
14
       
15
       // differences for multi-byte keys
16
-      extendedKeys[639]  = "SHIFT-DELETE";
17
+      extendedKeys[639]  = "SHIFT-DEL";
18
       extendedKeys[1021] = "SHIFT-SHIFT-TAB";
19
       extendedKeys[1024] = "ALT";
20
       extendedKeys[1033] = "ALT-CTRL-I";
21

    
22
=== modified file 'src/com/goldencode/p2j/ui/client/gui/GuiKeyboard.java'
23
--- src/com/goldencode/p2j/ui/client/gui/GuiKeyboard.java	2015-10-12 08:42:54 +0000
24
+++ src/com/goldencode/p2j/ui/client/gui/GuiKeyboard.java	2015-10-12 15:13:08 +0000
25
@@ -13,6 +13,7 @@
26
 ** 002 CA  20141220 Added mapping for COPY/CTRL-C key function.
27
 ** 003 GES 20150708 Added alternative mappings for CUT/COPY/PASTE key functions.
28
 ** 004 VIG 20150916 Added keyboard layout support.
29
+** 005 SBI 20151011 Added SHIFT + DEL key label to return 639 as its key code.
30
 */
31
 
32
 package com.goldencode.p2j.ui.client.gui;
33

    
34
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/BufferedImageDrawHelper.java'
35
--- src/com/goldencode/p2j/ui/client/gui/driver/BufferedImageDrawHelper.java	2015-10-11 21:09:40 +0000
36
+++ src/com/goldencode/p2j/ui/client/gui/driver/BufferedImageDrawHelper.java	2015-10-12 16:10:42 +0000
37
@@ -11,6 +11,8 @@
38
 ** -#- -I- --Date-- --------------------------------Description----------------------------------
39
 ** 001 SBI 20150810 First version which implements the helper function for image processing
40
 **                  as a part of the common functionality used by swing and web clients.
41
+** 002 SBI 20151011 Added new method to calculate the transformed image bounds to support images
42
+**                  caching.
43
 */
44
 
45
 package com.goldencode.p2j.ui.client.gui.driver;
46
@@ -28,13 +30,13 @@
47
    /**
48
     * Do the common transformations on the target image.
49
     * 
50
-    * @param    ps
51
+    * @param    embeddedImageStructure
52
     *           The holder for images parameters.
53
     * 
54
     * @return The wrapped image with its width and its height.
55
     */
56
    @Override
57
-   public ImageWrapper<BufferedImage> processImage(PaintStructure<?, BufferedImage> ps)
58
+   public ImageWrapper<BufferedImage> processImage(EmbeddedImageStructure<BufferedImage> embeddedImageStructure)
59
    {
60
       BufferedImage img2draw = null;
61
       int width  = 0;
62
@@ -42,33 +44,33 @@
63
       // scaling factors for vertical and horizontal
64
       float kHor = 0;
65
       float kVer = 0;
66
-      if (ps.xOffset == -1 && ps.yOffset == -1)
67
+      if (embeddedImageStructure.getXOffset() == -1 && embeddedImageStructure.getYOffset() == -1)
68
       {
69
          // full original image
70
-         img2draw = ((ImageWrapper<BufferedImage>)ps.img).getImage();
71
-         width    = ps.width;
72
-         height   = ps.height;
73
-         kHor = ((float)ps.width) / ((float) ps.img.getWidth());
74
-         kVer = ((float)ps.height) / ((float) ps.img.getHeight()); 
75
+         img2draw = embeddedImageStructure.getWrappedImage();
76
+         width    = embeddedImageStructure.getWidth();
77
+         height   = embeddedImageStructure.getHeight();
78
+         kHor = ((float)embeddedImageStructure.getWidth()) / ((float) embeddedImageStructure.getImage().getWidth());
79
+         kVer = ((float)embeddedImageStructure.getHeight()) / ((float) embeddedImageStructure.getImage().getHeight()); 
80
       }
81
       else
82
       {
83
          // need to recalc the width and height for subimage to cut
84
          // to not go out of image borders
85
-         int widthToCut = ps.img.getWidth() - ps.xOffset;
86
-         if (widthToCut > ps.width)
87
+         int widthToCut = embeddedImageStructure.getImage().getWidth() - embeddedImageStructure.getXOffset();
88
+         if (widthToCut > embeddedImageStructure.getWidth())
89
          {
90
-            widthToCut = ps.width;
91
+            widthToCut = embeddedImageStructure.getWidth();
92
          }
93
-         int heightToCut = ps.img.getHeight() - ps.yOffset;
94
-         if (heightToCut > ps.height)
95
+         int heightToCut = embeddedImageStructure.getImage().getHeight() - embeddedImageStructure.getYOffset();
96
+         if (heightToCut > embeddedImageStructure.getHeight())
97
          {
98
-            heightToCut = ps.height;
99
+            heightToCut = embeddedImageStructure.getHeight();
100
          }
101
          // partial image, get subimage
102
-         BufferedImage fullImg = ((ImageWrapper<BufferedImage>)ps.img).getImage();
103
-         BufferedImage bimg = fullImg.getSubimage(ps.xOffset,
104
-                                                  ps.yOffset,
105
+         BufferedImage fullImg = embeddedImageStructure.getWrappedImage();
106
+         BufferedImage bimg = fullImg.getSubimage(embeddedImageStructure.getXOffset(),
107
+                                                  embeddedImageStructure.getYOffset(),
108
                                                   widthToCut,
109
                                                   heightToCut);
110
          
111
@@ -77,8 +79,8 @@
112
             img2draw = bimg;
113
             width    = widthToCut;
114
             height   = heightToCut;
115
-            kHor = ((float)ps.width) / ((float)widthToCut);
116
-            kVer = ((float)ps.height) / ((float)heightToCut); 
117
+            kHor = ((float)embeddedImageStructure.getWidth()) / ((float)widthToCut);
118
+            kVer = ((float)embeddedImageStructure.getHeight()) / ((float)heightToCut); 
119
          }
120
       }
121
       // finally draw the image
122
@@ -86,39 +88,39 @@
123
       {
124
          // check binary image options
125
          // 3D color conversions
126
-         if (ps.convert3D)
127
+         if (embeddedImageStructure.is3D())
128
          {
129
-            img2draw = get3DColorsConvertedImage((BufferedImage)img2draw);
130
+            img2draw = get3DColorsConvertedImage(img2draw);
131
          }
132
          // transparency
133
-         if (ps.transparent)
134
+         if (embeddedImageStructure.isTransparent())
135
          {
136
             int pixTrans = img2draw.getRGB(0, height - 1);
137
             img2draw = getTransparentImage(img2draw, pixTrans);
138
          }
139
          // resizing
140
-         if (ps.stretchToFit)
141
+         if (embeddedImageStructure.isStretchToFit())
142
          {
143
-            if (ps.retainShape)
144
+            if (embeddedImageStructure.isRetainShape() && kHor != kVer)
145
             {
146
                // need to calculate native aspect ratio for image
147
                // if we have two different scaling factors for x and y we choose only one
148
                // to keep scaling in both directions, this must be one that is smaller
149
                if (kHor < kVer)
150
                {
151
-                  width  = ps.width;
152
+                  width  = embeddedImageStructure.getWidth();
153
                   height = Math.round(((float)height) * kHor);
154
                }
155
                else
156
                {
157
                   width = Math.round(((float)width) * kVer);
158
-                  height = ps.height;
159
+                  height = embeddedImageStructure.getHeight();
160
                }
161
             }
162
             else
163
             {
164
-               width  = ps.width;
165
-               height = ps.height;
166
+               width  = embeddedImageStructure.getWidth();
167
+               height = embeddedImageStructure.getHeight();
168
             }
169
          }
170
       }
171
@@ -129,69 +131,69 @@
172
    /**
173
     * Calculate the transformed image bounds.
174
     * 
175
-    * @param    ps
176
+    * @param    embeddedImageStructure
177
     *           The holder for images parameters.
178
     * 
179
     * @return The 2-elements array filled with new transformed image width and its new height.
180
     */
181
    @Override
182
-   public Integer[] calculateImageBounds(PaintStructure<?, BufferedImage> ps)
183
+   public Integer[] calculateImageBounds(EmbeddedImageStructure<BufferedImage> embeddedImageStructure)
184
    {
185
       int width  = 0;
186
       int height = 0;
187
       // scaling factors for vertical and horizontal
188
       float kHor = 0;
189
       float kVer = 0;
190
-      if (ps.xOffset == -1 && ps.yOffset == -1)
191
+      if (embeddedImageStructure.getXOffset() == -1 && embeddedImageStructure.getYOffset() == -1)
192
       {
193
-         width    = ps.width;
194
-         height   = ps.height;
195
-         kHor = ((float)ps.width) / ((float) ps.img.getWidth());
196
-         kVer = ((float)ps.height) / ((float) ps.img.getHeight()); 
197
+         width    = embeddedImageStructure.getWidth();
198
+         height   = embeddedImageStructure.getHeight();
199
+         kHor = ((float)embeddedImageStructure.getWidth()) / ((float) embeddedImageStructure.getImage().getWidth());
200
+         kVer = ((float)embeddedImageStructure.getHeight()) / ((float) embeddedImageStructure.getImage().getHeight()); 
201
       }
202
       else
203
       {
204
          // need to recalc the width and height for subimage to cut
205
          // to not go out of image borders
206
-         int widthToCut = ps.img.getWidth() - ps.xOffset;
207
-         if (widthToCut > ps.width)
208
+         int widthToCut = embeddedImageStructure.getImage().getWidth() - embeddedImageStructure.getXOffset();
209
+         if (widthToCut > embeddedImageStructure.getWidth())
210
          {
211
-            widthToCut = ps.width;
212
+            widthToCut = embeddedImageStructure.getWidth();
213
          }
214
-         int heightToCut = ps.img.getHeight() - ps.yOffset;
215
-         if (heightToCut > ps.height)
216
+         int heightToCut = embeddedImageStructure.getImage().getHeight() - embeddedImageStructure.getYOffset();
217
+         if (heightToCut > embeddedImageStructure.getHeight())
218
          {
219
-            heightToCut = ps.height;
220
+            heightToCut = embeddedImageStructure.getHeight();
221
          }
222
 
223
          width    = widthToCut;
224
          height   = heightToCut;
225
-         kHor = ((float)ps.width) / ((float)widthToCut);
226
-         kVer = ((float)ps.height) / ((float)heightToCut); 
227
+         kHor = ((float)embeddedImageStructure.getWidth()) / ((float)widthToCut);
228
+         kVer = ((float)embeddedImageStructure.getHeight()) / ((float)heightToCut); 
229
       }
230
       // resizing
231
-      if (ps.stretchToFit)
232
+      if (embeddedImageStructure.isStretchToFit())
233
       {
234
-         if (ps.retainShape)
235
+         if (embeddedImageStructure.isRetainShape() && kHor != kVer)
236
          {
237
             // need to calculate native aspect ratio for image
238
             // if we have two different scaling factors for x and y we choose only one
239
             // to keep scaling in both directions, this must be one that is smaller
240
             if (kHor < kVer)
241
             {
242
-               width  = ps.width;
243
+               width  = embeddedImageStructure.getWidth();
244
                height = Math.round(((float)height) * kHor);
245
             }
246
             else
247
             {
248
                width = Math.round(((float)width) * kVer);
249
-               height = ps.height;
250
+               height = embeddedImageStructure.getHeight();
251
             }
252
          }
253
          else
254
          {
255
-            width  = ps.width;
256
-            height = ps.height;
257
+            width  = embeddedImageStructure.getWidth();
258
+            height = embeddedImageStructure.getHeight();
259
          }
260
       }
261
 
262

    
263
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/ClientImageDrawHelper.java'
264
--- src/com/goldencode/p2j/ui/client/gui/driver/ClientImageDrawHelper.java	2015-10-11 21:09:40 +0000
265
+++ src/com/goldencode/p2j/ui/client/gui/driver/ClientImageDrawHelper.java	2015-10-12 16:10:55 +0000
266
@@ -10,11 +10,12 @@
267
 **
268
 ** -#- -I- --Date-- --------------------------------Description----------------------------------
269
 ** 001 SBI 20150810 First version which defines a helper function for image processing.
270
+** 002 SBI 20151011 Added new method to calculate the transformed image bounds to support images
271
+**                  caching.
272
 */
273
 
274
 package com.goldencode.p2j.ui.client.gui.driver;
275
 
276
-import java.awt.image.BufferedImage;
277
 
278
 /**
279
  * Defines additional processing for images.
280
@@ -27,20 +28,20 @@
281
    /**
282
     * Do the implemented transformations on the target image.
283
     * 
284
-    * @param    ps
285
+    * @param    embeddedImageStructure
286
     *           The holder for images parameters.
287
     * 
288
     * @return The wrapped image with its width and its height.
289
     */
290
-   public ImageWrapper<I> processImage(PaintStructure<?, I> ps);
291
+   public ImageWrapper<I> processImage(EmbeddedImageStructure<I> embeddedImageStructure);
292
 
293
    /**
294
     * Calculate the transformed image bounds.
295
     * 
296
-    * @param    ps
297
+    * @param    embeddedImageStructure
298
     *           The holder for images parameters.
299
     * 
300
     * @return The 2-elements array filled with new transformed image width and its new height.
301
     */
302
-   public Integer[] calculateImageBounds(PaintStructure<?, BufferedImage> ps);
303
+   public Integer[] calculateImageBounds(EmbeddedImageStructure<I> embeddedImageStructure);
304
 }
305

    
306
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/EmbeddedImageStructure.java'
307
--- src/com/goldencode/p2j/ui/client/gui/driver/EmbeddedImageStructure.java	2015-10-11 21:09:40 +0000
308
+++ src/com/goldencode/p2j/ui/client/gui/driver/EmbeddedImageStructure.java	2015-10-12 16:21:37 +0000
309
@@ -14,14 +14,13 @@
310
 
311
 package com.goldencode.p2j.ui.client.gui.driver;
312
 
313
-import java.util.Arrays;
314
-import java.util.List;
315
+import java.util.*;
316
 
317
 
318
 /**
319
  * Encapsulates the image drawing parameters. 
320
  */
321
-public class EmbeddedImageStructure
322
+public class EmbeddedImageStructure<I>
323
 {
324
    /** convert 3d image bit mask */
325
    static final int CONVERT_3D_MASK  = 1;
326
@@ -49,7 +48,7 @@
327
    private final int yOffset;
328
 
329
    /** Image to draw */
330
-   private final ImageWrapper img;
331
+   private final ImageWrapper<I> img;
332
 
333
    /** The bits mask that encodes image conversions. */
334
    private final int imageConversionMask;
335
@@ -57,7 +56,7 @@
336
    /**
337
     * @param paintStructure
338
     */
339
-   EmbeddedImageStructure(PaintStructure paintStructure)
340
+   private <F> EmbeddedImageStructure(PaintStructure<F, I> paintStructure)
341
    {
342
       this.width   = paintStructure.width;
343
       this.height  = paintStructure.height;
344
@@ -72,7 +71,7 @@
345
     * 
346
     * @return   The bits mask that encodes image conversions.
347
     */
348
-   private static byte encodeImageConversionMask(PaintStructure paintStructure)
349
+   private static <F, I> byte encodeImageConversionMask(PaintStructure<F, I> paintStructure)
350
    {
351
       byte mask = 0;
352
       if (paintStructure.convert3D)
353
@@ -120,7 +119,7 @@
354
     * 
355
     * @return   The xOffset
356
     */
357
-   public int getxOffset()
358
+   public int getXOffset()
359
    {
360
       return this.xOffset;
361
    }
362
@@ -130,22 +129,32 @@
363
     * 
364
     * @return   The yOffset.
365
     */
366
-   public int getyOffset()
367
+   public int getYOffset()
368
    {
369
       return this.yOffset;
370
    }
371
 
372
    /**
373
-    * Returns the wrapped image to draw.
374
+    * Returns the wrapped image.
375
     * 
376
     * @return   The wrapped image.
377
     */
378
-   public ImageWrapper getImage()
379
+   public ImageWrapper<I> getImage()
380
    {
381
       return this.img;
382
    }
383
 
384
    /**
385
+    * Returns the target image to draw.
386
+    * 
387
+    * @return   The target image to draw.
388
+    */
389
+   public I getWrappedImage()
390
+   {
391
+      return (this.img != null) ? this.img.getImage() : null;
392
+   }
393
+
394
+   /**
395
     * Encodes image conversions: 3d, transparent, stretch, retain.
396
     * 
397
     * @return   The bits mask that encodes image conversions.
398
@@ -168,4 +177,72 @@
399
                            this.imageConversionMask, this.img.getUniqueId()
400
                         });
401
    }
402
+
403
+   /**
404
+    * Helper method to get the conversion mask is supported or not.
405
+    * 
406
+    * @param    conversion
407
+    *           The conversion mask that can be one of CONVERT_3D_MASK, RETAIN_SHAPE_MASK,
408
+    *           STRETCH_TO_FIT_MASK, TRANSPARENT_MASK.
409
+    * 
410
+    * @return   true iff the target conversion is supported.
411
+    */
412
+   private boolean hasConversion(int conversion)
413
+   {
414
+      return (this.imageConversionMask & conversion) == conversion;
415
+   }
416
+
417
+   /**
418
+    * Indicates the image should retain shape.
419
+    * 
420
+    * @return   true iff the image should retain shape. 
421
+    */
422
+   public boolean isRetainShape()
423
+   {
424
+      return hasConversion(RETAIN_SHAPE_MASK);
425
+   }
426
+
427
+   /**
428
+    * Indicates the image should be 3D style.
429
+    * 
430
+    * @return   true iff the image should have 3D style. 
431
+    */
432
+   public boolean is3D()
433
+   {
434
+      return hasConversion(CONVERT_3D_MASK);
435
+   }
436
+
437
+   /**
438
+    * Indicates the image should stretch to fit the embedded space.
439
+    * 
440
+    * @return   true iff the image should stretch to fit the embedded space.
441
+    */
442
+   public boolean isStretchToFit()
443
+   {
444
+      return hasConversion(STRETCH_TO_FIT_MASK);
445
+   }
446
+
447
+   /**
448
+    * Indicates the image should be transparent.
449
+    * 
450
+    * @return   true iff the image should be transparent.
451
+    */
452
+   public boolean isTransparent()
453
+   {
454
+      return hasConversion(TRANSPARENT_MASK);
455
+   }
456
+
457
+   /**
458
+    * Creates the embedded image structure filled with the required parameters to draw the target.
459
+    * 
460
+    * @param    ps
461
+    *           The paint structure.
462
+    * 
463
+    * @return   The embedded image structure.
464
+    */
465
+   public static <F, I> EmbeddedImageStructure<I> create(PaintStructure<F, I> ps)
466
+   {
467
+      return new EmbeddedImageStructure<I>(ps);
468
+   }
469
+
470
 }
471

    
472
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/ImageWrapper.java'
473
--- src/com/goldencode/p2j/ui/client/gui/driver/ImageWrapper.java	2015-10-11 21:09:40 +0000
474
+++ src/com/goldencode/p2j/ui/client/gui/driver/ImageWrapper.java	2015-10-12 16:24:07 +0000
475
@@ -10,11 +10,12 @@
476
 **
477
 ** -#- -I- --Date-- ---------------------------------Description---------------------------------
478
 ** 001 GES 20150420 First version.
479
+** 002 SBI 20151012 Added unique ids support.
480
 */
481
 
482
 package com.goldencode.p2j.ui.client.gui.driver;
483
 
484
-import java.util.concurrent.atomic.AtomicInteger;
485
+import java.util.concurrent.atomic.*;
486
 
487
 /**
488
  * Contains the state for a native image which can be accessed in a general purpose manner.
489
@@ -66,16 +67,6 @@
490
    }
491
 
492
    /**
493
-    * Returns the image unique id.
494
-    * 
495
-    * @return The image unique id.
496
-    */
497
-   public int getUniqueId()
498
-   {
499
-      return uniqueId;
500
-   }
501
-
502
-   /**
503
     * Obtain the contained native image instance.
504
     *
505
     * @return   The contained image.
506
@@ -104,4 +95,14 @@
507
    {
508
       return width;
509
    }
510
+
511
+   /**
512
+    * Returns the image unique id.
513
+    * 
514
+    * @return The image unique id.
515
+    */
516
+   public int getUniqueId()
517
+   {
518
+      return uniqueId;
519
+   }
520
 }
521

    
522
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/PaintStructure.java'
523
--- src/com/goldencode/p2j/ui/client/gui/driver/PaintStructure.java	2015-10-11 21:09:40 +0000
524
+++ src/com/goldencode/p2j/ui/client/gui/driver/PaintStructure.java	2015-10-12 15:13:55 +0000
525
@@ -118,14 +118,5 @@
526
    {
527
       this.id = id;
528
    }
529
-   
530
-   /**
531
-    * Return the embedded image structure filled with the required parameters to draw the target.
532
-    * 
533
-    * @return   The embedded image structure.
534
-    */
535
-   public EmbeddedImageStructure getEmbeddedImageStructure()
536
-   {
537
-      return new EmbeddedImageStructure(this);
538
-   }
539
+
540
 }
541

    
542
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedWindow.java'
543
--- src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedWindow.java	2015-10-06 19:09:18 +0000
544
+++ src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedWindow.java	2015-10-12 16:27:03 +0000
545
@@ -68,6 +68,7 @@
546
 **                  SwingUtilities.invokeAndWait must be bracketed in a save/restore bracket state
547
 **                  calls, to allow the AWTEventThread to process the request; otherwise, deadlocks
548
 **                  may occur. 
549
+** 033 SBI 20151012 Changed the image helper method signature to be more specific.
550
 */
551
 
552
 package com.goldencode.p2j.ui.client.gui.driver.swing;
553
@@ -716,7 +717,8 @@
554
             g2.drawRoundRect(ps.x, ps.y, ps.width, ps.height, ps.arcDiameter, ps.arcDiameter);
555
             break;
556
          case DRAW_IMAGE:
557
-            ImageWrapper<BufferedImage> preparedImage = drawHelper.processImage(ps);
558
+            ImageWrapper<BufferedImage> preparedImage = drawHelper.processImage(
559
+                     EmbeddedImageStructure.create(ps));
560
             if (preparedImage.getImage() != null) {
561
                g2.drawImage(preparedImage.getImage(), ps.x, ps.y, preparedImage.getWidth(), preparedImage.getHeight(), pane);
562
             }
563

    
564
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java'
565
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java	2015-10-11 21:09:40 +0000
566
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java	2015-10-12 16:12:48 +0000
567
@@ -23,7 +23,8 @@
568
 ** 006 CA  20150929 Fixed multi-window drawing issues caused by concurrent drawing access to the
569
 **                  GuiDriver: all access to the driver is done exclusively, each thread taking
570
 **                  and releasing ownership for the duration of the drawing operation or other
571
-**                  GUI API invocation which requires access to the underlying physical window.
572
+**                  GUI API invocation which requires access to the underlying physical window.
573
+** 007 SBI 20151011 Fixed images caching.
574
 */
575
 
576
 package com.goldencode.p2j.ui.client.gui.driver.web;
577
@@ -448,7 +449,7 @@
578
     */
579
    private final Object[] encodeImage(PaintStructure<Integer, BufferedImage> ps)
580
    {
581
-      EmbeddedImageStructure embeddedImageStructure = ps.getEmbeddedImageStructure();
582
+      EmbeddedImageStructure<BufferedImage> embeddedImageStructure = EmbeddedImageStructure.create(ps);
583
       List<Integer> imageSeal = embeddedImageStructure.getObjectSeal();
584
       VirtualScreen virtualScreen = webdriver.getVirtualScreen();
585
       ImageEncoding encoding;
586
@@ -460,7 +461,7 @@
587
       {
588
          int x = ps.x;
589
          int y = ps.y;
590
-         ImageWrapper embeddedImage = drawHelper.processImage(ps);
591
+         ImageWrapper<BufferedImage> embeddedImage = drawHelper.processImage(embeddedImageStructure);
592
          imageId = embeddedImage.getUniqueId();
593
          webdriver.mapSealToUniqueId(imageSeal, imageId);
594
          imageWidth  = embeddedImage.getWidth();
595
@@ -475,7 +476,7 @@
596
          imageId = webdriver.getUniqueIdForSeal(imageSeal);
597
          encoding = ImageEncoding.HASH;
598
          encodedImage = null;
599
-         Integer[] imageBounds = drawHelper.calculateImageBounds(ps);
600
+         Integer[] imageBounds = drawHelper.calculateImageBounds(embeddedImageStructure);
601
          imageWidth  = imageBounds[0];
602
          imageHeight = imageBounds[1];
603
       }
604