changeset 4645:4873e7422e65

SW pipeline: fix for RT-32227 - setContentWidth + setContentHeight functions on SWTexture
author Martin Soch <Martin.Soch@oracle.com>
date Fri, 09 Aug 2013 17:30:41 +0200
parents 4618b11c75f9
children 8d527964b7aa
files modules/graphics/src/main/java/com/sun/prism/sw/SWArgbPreTexture.java modules/graphics/src/main/java/com/sun/prism/sw/SWMaskTexture.java modules/graphics/src/main/java/com/sun/prism/sw/SWTexture.java
diffstat 3 files changed, 23 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/prism/sw/SWArgbPreTexture.java	Fri Aug 09 10:43:44 2013 -0400
+++ b/modules/graphics/src/main/java/com/sun/prism/sw/SWArgbPreTexture.java	Fri Aug 09 17:30:41 2013 +0200
@@ -196,14 +196,4 @@
     public int getMaxContentHeight() {
         return getContentHeight();
     }
-
-    @Override
-    public void setContentWidth(int contentWidth) {
-        throw new UnsupportedOperationException("Not supported.");
-    }
-
-    @Override
-    public void setContentHeight(int contentHeight) {
-        throw new UnsupportedOperationException("Not supported.");
-    }
 }
--- a/modules/graphics/src/main/java/com/sun/prism/sw/SWMaskTexture.java	Fri Aug 09 10:43:44 2013 -0400
+++ b/modules/graphics/src/main/java/com/sun/prism/sw/SWMaskTexture.java	Fri Aug 09 17:30:41 2013 +0200
@@ -110,14 +110,4 @@
     public int getMaxContentHeight() {
         return getContentHeight();
     }
-
-    @Override
-    public void setContentWidth(int contentWidth) {
-        throw new UnsupportedOperationException("Not supported.");
-    }
-
-    @Override
-    public void setContentHeight(int contentHeight) {
-        throw new UnsupportedOperationException("Not supportedt.");
-    }
 }
--- a/modules/graphics/src/main/java/com/sun/prism/sw/SWTexture.java	Fri Aug 09 10:43:44 2013 -0400
+++ b/modules/graphics/src/main/java/com/sun/prism/sw/SWTexture.java	Fri Aug 09 17:30:41 2013 +0200
@@ -42,7 +42,7 @@
     }
 
     boolean allocated = false;
-    int width, height;
+    int width, height, contentWidth, contentHeight;
     private SWResourceFactory factory;
     private int lastImageSerial;
     private final WrapMode wrapMode;
@@ -52,6 +52,8 @@
         this.wrapMode = wrapMode;
         width = w;
         height = h;
+        contentWidth = w;
+        contentHeight = h;
         lock();
     }
 
@@ -59,6 +61,8 @@
         this.allocated = sharedTex.allocated;
         this.width = sharedTex.width;
         this.height = sharedTex.height;
+        this.contentWidth = sharedTex.contentWidth;
+        this.contentHeight = sharedTex.contentHeight;
         this.factory = sharedTex.factory;
         // REMIND: Use indirection to share the serial number?
         this.lastImageSerial = sharedTex.lastImageSerial;
@@ -149,12 +153,28 @@
 
     @Override
     public int getContentWidth() {
-        return width;
+        return contentWidth;
+    }
+
+    @Override
+    public void setContentWidth(int contentWidth) {
+        if (contentWidth > width) {
+            throw new IllegalArgumentException("contentWidth cannot exceed physicalWidth");
+        }
+        this.contentWidth = contentWidth;
     }
 
     @Override
     public int getContentHeight() {
-        return height;
+        return contentHeight;
+    }
+
+    @Override
+    public void setContentHeight(int contentHeight) {
+        if (contentHeight > height) {
+            throw new IllegalArgumentException("contentHeight cannot exceed physicalHeight");
+        }
+        this.contentHeight = contentHeight;
     }
 
     public int getLastImageSerial() {