From e61f3e932b44e9dae42c379cb93d6d6b12eb6b1d Mon Sep 17 00:00:00 2001 From: Lee Date: Tue, 27 Nov 2012 16:30:09 +0900 Subject: [PATCH] [Title] input data corrupt bug fix [Desc.] data making thread input corrupt bug fix [Issue] - --- .../org/tizen/dynamicanalyzer/logparser/Logs.java | 19 ++++-- .../dynamicanalyzer/ui/file/FileChartView.java | 2 +- .../dynamicanalyzer/ui/widgets/DAAnimation.java | 26 +++++++ .../dynamicanalyzer/uirecorder/RecorderXml.java | 4 +- .../tizen/dynamicanalyzer/uirecorder/XmlData.java | 4 +- .../org/tizen/dynamicanalyzer/utils/ImageUtil.java | 76 +++++++++++++++++++++ .../tizen/dynamicanalyzer/utils/ImageUtils.java | 79 ---------------------- 7 files changed, 122 insertions(+), 88 deletions(-) delete mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/ImageUtils.java diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/Logs.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/Logs.java index 41ce889..360414f 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/Logs.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/Logs.java @@ -42,6 +42,7 @@ public class Logs { return logCenterId; } + // getLogs -> getRawLogs public List> getLogs() { if (null == logs) { logs = new ArrayList>(); @@ -49,13 +50,23 @@ public class Logs { return logs; } - public void setLogs(List> input) - { + public void setLogs(List> input) { logs = input; } - public void setLogCenterId(int id) - { + public void setLogCenterId(int id) { logCenterId = id; } + + // cloneLogs -> getLogs + public List> getCloneLogs() { + List> newLogs = new ArrayList>(); + int size = logs.size(); + for (int i = 0; i < size; i++) { + List newLog = new ArrayList(); + newLog.addAll(logs.get(i)); + newLogs.add(newLog); + } + return newLogs; + } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java index dbda9c7..30d009c 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java @@ -86,7 +86,7 @@ public class FileChartView extends DAView { if (null == logs || logs.getLogs().size() == 0) { return; } - List> inputs = logs.getLogs(); + List> inputs = logs.getCloneLogs(); FileChartManager.getInstance().getLogListQueue().putLog(inputs); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/DAAnimation.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/DAAnimation.java index 9b02a6d..68a03c3 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/DAAnimation.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/DAAnimation.java @@ -1,3 +1,29 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jooyoul Lee + * Juyoung Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + package org.tizen.dynamicanalyzer.ui.widgets; import java.util.ArrayList; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/uirecorder/RecorderXml.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/uirecorder/RecorderXml.java index 03b34d6..8796064 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/uirecorder/RecorderXml.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/uirecorder/RecorderXml.java @@ -1,11 +1,11 @@ /* - * SLPUnitTest + * Dynamic Analyzer * * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: - * SangHyun Lee * Gun Kim + * Jooyoul Lee * JuYoung Kim * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/uirecorder/XmlData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/uirecorder/XmlData.java index 1ad0534..2f658fc 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/uirecorder/XmlData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/uirecorder/XmlData.java @@ -1,11 +1,11 @@ /* - * SLPUnitTest + * Dynamic Analyzer * * Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: - * SangHyun Lee * Gun Kim + * Jooyoul Lee * JuYoung Kim * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/ImageUtil.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/ImageUtil.java index b92d8ae..8e3b6c6 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/ImageUtil.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/ImageUtil.java @@ -35,6 +35,9 @@ import java.io.IOException; import javax.imageio.ImageIO; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.ImageData; + public class ImageUtil { public static void resize(String origFile, String newFile, int width, @@ -73,4 +76,77 @@ public class ImageUtil { } } + // FIXME : refactoring + public static ImageData rotate(ImageData srcData, int direction) { + int bytesPerPixel = srcData.bytesPerLine / srcData.width; + int destBytesPerLine = (direction == SWT.DOWN) ? srcData.width + * bytesPerPixel : srcData.height * bytesPerPixel; + byte[] newData = new byte[(direction == SWT.DOWN) ? srcData.height + * destBytesPerLine : srcData.width * destBytesPerLine]; + int width = 0, height = 0; + for (int srcY = 0; srcY < srcData.height; srcY++) { + for (int srcX = 0; srcX < srcData.width; srcX++) { + int destX = 0, destY = 0, destIndex = 0, srcIndex = 0; + switch (direction) { + case SWT.LEFT: // left 90 degrees + destX = srcY; + destY = srcData.width - srcX - 1; + width = srcData.height; + height = srcData.width; + break; + case SWT.RIGHT: // right 90 degrees + destX = srcData.height - srcY - 1; + destY = srcX; + width = srcData.height; + height = srcData.width; + break; + case SWT.DOWN: // 180 degrees + destX = srcData.width - srcX - 1; + destY = srcData.height - srcY - 1; + width = srcData.width; + height = srcData.height; + break; + } + destIndex = (destY * destBytesPerLine) + + (destX * bytesPerPixel); + srcIndex = (srcY * srcData.bytesPerLine) + + (srcX * bytesPerPixel); + System.arraycopy(srcData.data, srcIndex, newData, destIndex, + bytesPerPixel); + } + } + // destBytesPerLine is used as scanlinePad to ensure that no padding is + // required + return new ImageData(width, height, srcData.depth, srcData.palette, + srcData.scanlinePad, newData); + } + + public static ImageData flip(ImageData srcData, boolean vertical) { + int bytesPerPixel = srcData.bytesPerLine / srcData.width; + int destBytesPerLine = srcData.width * bytesPerPixel; + byte[] newData = new byte[srcData.data.length]; + for (int srcY = 0; srcY < srcData.height; srcY++) { + for (int srcX = 0; srcX < srcData.width; srcX++) { + int destX = 0, destY = 0, destIndex = 0, srcIndex = 0; + if (vertical) { + destX = srcX; + destY = srcData.height - srcY - 1; + } else { + destX = srcData.width - srcX - 1; + destY = srcY; + } + destIndex = (destY * destBytesPerLine) + + (destX * bytesPerPixel); + srcIndex = (srcY * srcData.bytesPerLine) + + (srcX * bytesPerPixel); + System.arraycopy(srcData.data, srcIndex, newData, destIndex, + bytesPerPixel); + } + } + // destBytesPerLine is used as scanlinePad to ensure that no padding is + // required + return new ImageData(srcData.width, srcData.height, srcData.depth, + srcData.palette, srcData.scanlinePad, newData); + } + } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/ImageUtils.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/ImageUtils.java deleted file mode 100644 index 3fd1dcb..0000000 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/ImageUtils.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.tizen.dynamicanalyzer.utils; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.ImageData; - -public class ImageUtils { - public static ImageData rotate(ImageData srcData, int direction) { - int bytesPerPixel = srcData.bytesPerLine / srcData.width; - int destBytesPerLine = (direction == SWT.DOWN) ? srcData.width - * bytesPerPixel : srcData.height * bytesPerPixel; - byte[] newData = new byte[(direction == SWT.DOWN) ? srcData.height - * destBytesPerLine : srcData.width * destBytesPerLine]; - int width = 0, height = 0; - for (int srcY = 0; srcY < srcData.height; srcY++) { - for (int srcX = 0; srcX < srcData.width; srcX++) { - int destX = 0, destY = 0, destIndex = 0, srcIndex = 0; - switch (direction) { - case SWT.LEFT: // left 90 degrees - destX = srcY; - destY = srcData.width - srcX - 1; - width = srcData.height; - height = srcData.width; - break; - case SWT.RIGHT: // right 90 degrees - destX = srcData.height - srcY - 1; - destY = srcX; - width = srcData.height; - height = srcData.width; - break; - case SWT.DOWN: // 180 degrees - destX = srcData.width - srcX - 1; - destY = srcData.height - srcY - 1; - width = srcData.width; - height = srcData.height; - break; - } - destIndex = (destY * destBytesPerLine) - + (destX * bytesPerPixel); - srcIndex = (srcY * srcData.bytesPerLine) - + (srcX * bytesPerPixel); - System.arraycopy(srcData.data, srcIndex, newData, destIndex, - bytesPerPixel); - } - } - // destBytesPerLine is used as scanlinePad to ensure that no padding is - // required - return new ImageData(width, height, srcData.depth, srcData.palette, - srcData.scanlinePad, newData); - } - - public static ImageData flip(ImageData srcData, boolean vertical) { - int bytesPerPixel = srcData.bytesPerLine / srcData.width; - int destBytesPerLine = srcData.width * bytesPerPixel; - byte[] newData = new byte[srcData.data.length]; - for (int srcY = 0; srcY < srcData.height; srcY++) { - for (int srcX = 0; srcX < srcData.width; srcX++) { - int destX = 0, destY = 0, destIndex = 0, srcIndex = 0; - if (vertical) { - destX = srcX; - destY = srcData.height - srcY - 1; - } else { - destX = srcData.width - srcX - 1; - destY = srcY; - } - destIndex = (destY * destBytesPerLine) - + (destX * bytesPerPixel); - srcIndex = (srcY * srcData.bytesPerLine) - + (srcX * bytesPerPixel); - System.arraycopy(srcData.data, srcIndex, newData, destIndex, - bytesPerPixel); - } - } - // destBytesPerLine is used as scanlinePad to ensure that no padding is - // required - return new ImageData(srcData.width, srcData.height, srcData.depth, - srcData.palette, srcData.scanlinePad, newData); - } - -} -- 2.7.4