Mercurial > projects > dwt2
annotate org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGSegment.d @ 120:536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
===D2===
* added [Try]Immutable/Const/Shared templates to work with differenses in D1/D2 instead of version statements
used these templates to work with strict type storage rules of dmd-2.053
* com.ibm.icu now also compilable with D2, but not tested yet
* small fixes
Snippet288 - shared data is in TLS
===Phobos===
* fixed critical bugs in Phobos implemention
completely incorrect segfault prone fromStringz (Linux's port ruthless killer)
terrible, incorrect StringBuffer realization (StyledText killer)
* fixed small bugs as well
Snippet72 - misprint in the snippet
* implemented missed functionality for Phobos
ByteArrayOutputStream implemented (image loading available)
formatting correctly works for all DWT's cases
As a result, folowing snippets now works with Phobos (Snippet### - what is fixed):
Snippet24, 42, 111, 115, 130, 235, 276 - bad string formatting
Snippet48, 282 - crash on image loading
Snippet163, 189, 211, 213, 217, 218, 222 - crash on copy/cut in StyledText
Snippet244 - hang-up
===Tango===
* few changes for the latest Tango trunc-r5661
* few small performance improvments
===General===
* implMissing-s for only one version changed to implMissingInTango/InPhobos
* incorrect calls to Format in toString-s fixed
* fixed loading \uXXXX characters in ResourceBundle
* added good UTF-8 support for StyledText, TextLayout (Win32) and friends
UTF functions revised and tested. It is now in java.nonstandard.*Utf modules
StyledText and TextLayout (Win32) modules revised for UTF-8 support
* removed small diferences in most identical files in *.swt.* folders
*.swt.internal.image, *.swt.events and *.swt.custom are identical in Win32/Linux32
now 179 of 576 (~31%) files in *.swt.* folders are fully identical
* Win32: snippets now have right subsystem, pretty icons and native system style controls
* small fixes in snippets
Snippet44 - it's not Snippet44
Snippet212 - functions work with different images and offsets arrays
Win32: Snippet282 - crash on close if the button has an image
Snippet293 - setGrayed is commented
and others
Win32: As a result, folowing snippets now works
Snippet68 - color doesn't change
Snippet163, 189, 211, 213, 217, 218, 222 - UTF-8 issues (see above)
Snippet193 - no tabel headers
author | Denis Shelomovskij <verylonglogin.reg@gmail.com> |
---|---|
date | Sat, 09 Jul 2011 15:50:20 +0300 |
parents | ddbfe84d86df |
children |
rev | line source |
---|---|
25 | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2003 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module org.eclipse.swt.internal.image.JPEGSegment; | |
14 | |
15 import org.eclipse.swt.internal.image.LEDataOutputStream; | |
16 | |
17 | |
18 class JPEGSegment { | |
19 public byte[] reference; | |
20 | |
21 this() { | |
22 } | |
23 | |
24 public this(byte[] reference) { | |
25 this.reference = reference; | |
26 } | |
27 | |
28 public int signature() { | |
29 return 0; | |
30 } | |
31 | |
32 public bool verify() { | |
33 return getSegmentMarker() is signature(); | |
34 } | |
35 | |
36 public int getSegmentMarker() { | |
37 return ((reference[0] & 0xFF) << 8 | (reference[1] & 0xFF)); | |
38 } | |
39 | |
40 public void setSegmentMarker(int marker) { | |
41 reference[0] = cast(byte)((marker & 0xFF00) >> 8); | |
42 reference[1] = cast(byte)(marker & 0xFF); | |
43 } | |
44 | |
45 public int getSegmentLength() { | |
46 return ((reference[2] & 0xFF) << 8 | (reference[3] & 0xFF)); | |
47 } | |
48 | |
49 public void setSegmentLength(int length) { | |
50 reference[2] = cast(byte)((length & 0xFF00) >> 8); | |
51 reference[3] = cast(byte)(length & 0xFF); | |
52 } | |
53 | |
54 public bool writeToStream(LEDataOutputStream byteStream) { | |
55 try { | |
56 byteStream.write(reference); | |
57 return true; | |
58 } catch (Exception e) { | |
59 return false; | |
60 } | |
61 } | |
62 } |