< prev index next >

src/java.desktop/macosx/classes/sun/java2d/OSXSurfaceData.java

Print this page

        

*** 72,83 **** this.fGraphicsStates = getBufferOfSize(kSizeOfParameters); this.fGraphicsStatesInt = this.fGraphicsStates.asIntBuffer(); this.fGraphicsStatesFloat = this.fGraphicsStates.asFloatBuffer(); this.fGraphicsStatesLong = this.fGraphicsStates.asLongBuffer(); ! this.fGraphicsStatesObject = new Object[6]; // clip coordinates + clip types + texture paint image + stroke dash ! // array + font + font paint // NOTE: All access to the DrawingQueue comes through this OSXSurfaceData instance. Therefore // every instance method of OSXSurfaceData that accesses the fDrawingQueue is synchronized. // Thread.dumpStack(); --- 72,88 ---- this.fGraphicsStates = getBufferOfSize(kSizeOfParameters); this.fGraphicsStatesInt = this.fGraphicsStates.asIntBuffer(); this.fGraphicsStatesFloat = this.fGraphicsStates.asFloatBuffer(); this.fGraphicsStatesLong = this.fGraphicsStates.asLongBuffer(); ! this.fGraphicsStatesObject = new Object[8]; // clip coordinates + ! // clip types + ! // texture paint image + ! // stroke dash array + ! // font + font paint + ! // linear gradient color + ! // linear gradient fractions // NOTE: All access to the DrawingQueue comes through this OSXSurfaceData instance. Therefore // every instance method of OSXSurfaceData that accesses the fDrawingQueue is synchronized. // Thread.dumpStack();
*** 302,311 **** --- 307,318 ---- @Native static final int kClipTypesIndex = 1; @Native static final int kTextureImageIndex = 2; @Native static final int kStrokeDashArrayIndex = 3; @Native static final int kFontIndex = 4; @Native static final int kFontPaintIndex = 5; + @Native static final int kColorArrayIndex = 6; + @Native static final int kFractionsArrayIndex = 7; // possible state changes @Native static final int kBoundsChangedBit = 1 << 0; @Native static final int kBoundsNotChangedBit = ~kBoundsChangedBit; @Native static final int kClipChangedBit = 1 << 1;
*** 327,336 **** --- 334,344 ---- // possible color states @Native static final int kColorSimple = 0; @Native static final int kColorSystem = 1; @Native static final int kColorGradient = 2; @Native static final int kColorTexture = 3; + @Native static final int kColorLinearOrRadialGradient = 4; // possible gradient color states @Native static final int kColorNonCyclic = 0; @Native static final int kColorCyclic = 1;
*** 565,574 **** --- 573,612 ---- this.fChangeFlag = (this.fChangeFlag | kColorChangedBit); } else { this.fChangeFlag = (this.fChangeFlag & kColorNotChangedBit); } + } else if (sg2d.paint instanceof LinearGradientPaint) { + if ((this.fGraphicsStatesInt.get(kColorStateIndex) != kColorGradient) || (lastPaint != sg2d.paint)) { + LinearGradientPaint color = (LinearGradientPaint) sg2d.paint; + this.fGraphicsStatesInt.put(kColorStateIndex, kColorLinearOrRadialGradient); + int numColor = color.getColors().length; + int colorArray[] = new int[numColor]; + for (int i = 0; i < numColor; i++) { + colorArray[i] = color.getColors()[i].getRGB(); + } + this.fGraphicsStatesObject[kColorArrayIndex] = colorArray; + + int numFractions = color.getFractions().length; + float fractionArray[] = new float[numFractions]; + for (int i = 0; i < numFractions; i++) { + fractionArray[i] = color.getFractions()[i]; + } + this.fGraphicsStatesObject[kFractionsArrayIndex] = color.getFractions(); + + this.fGraphicsStatesInt.put(kColorIsCyclicIndex, (color.getCycleMethod() == LinearGradientPaint.CycleMethod.NO_CYCLE) ? kColorNonCyclic : kColorCyclic); + Point2D p = color.getStartPoint(); + this.fGraphicsStatesFloat.put(kColorx1Index, (float) p.getX()); + this.fGraphicsStatesFloat.put(kColory1Index, (float) p.getY()); + p = color.getEndPoint(); + this.fGraphicsStatesFloat.put(kColorx2Index, (float) p.getX()); + this.fGraphicsStatesFloat.put(kColory2Index, (float) p.getY()); + + this.fChangeFlag = (this.fChangeFlag | kColorChangedBit); + } else { + this.fChangeFlag = (this.fChangeFlag & kColorNotChangedBit); + } } else if (sg2d.paint instanceof TexturePaint) { if ((this.fGraphicsStatesInt.get(kColorStateIndex) != kColorTexture) || (lastPaint != sg2d.paint)) { TexturePaint color = (TexturePaint) sg2d.paint; this.fGraphicsStatesInt.put(kColorStateIndex, kColorTexture); texturePaintImage = color.getImage();
< prev index next >