summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-06-03 23:39:30 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-06-04 00:18:04 +0200
commit01c5c1de3acc9039fabef1fa03d171fa1a75a702 (patch)
treefa57360a77a2f60b2aa073ee92ed77d4c598e7a7
parenteddf277c992b80282e0b49325b3138de5a3a2509 (diff)
fdo#34423 Allow to rotate raw uncompressed bitmaps.
When using a graphic filter like blur or sharpen, a raw uncompressed bitmap is created. Until now it was not possible to rotate such bitmap but now this is allowed. Change-Id: I716fa46e37680b1111131586fad20da28391de14
-rw-r--r--include/vcl/GraphicNativeTransform.hxx5
-rw-r--r--vcl/source/filter/GraphicNativeTransform.cxx21
2 files changed, 23 insertions, 3 deletions
diff --git a/include/vcl/GraphicNativeTransform.hxx b/include/vcl/GraphicNativeTransform.hxx
index db727a22c5ff..4739e97cce26 100644
--- a/include/vcl/GraphicNativeTransform.hxx
+++ b/include/vcl/GraphicNativeTransform.hxx
@@ -26,8 +26,9 @@ class VCL_DLLPUBLIC GraphicNativeTransform
{
Graphic& mrGraphic;
- bool rotateJPEG (sal_uInt16 aRotation);
- bool rotateGeneric (sal_uInt16 aRotation, OUString aType);
+ bool rotateBitmapOnly (sal_uInt16 aRotation);
+ bool rotateJPEG (sal_uInt16 aRotation);
+ bool rotateGeneric (sal_uInt16 aRotation, OUString aType);
public:
GraphicNativeTransform(Graphic& rGraphic);
diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx
index 7b3f64072afa..261ad90c3ce5 100644
--- a/vcl/source/filter/GraphicNativeTransform.cxx
+++ b/vcl/source/filter/GraphicNativeTransform.cxx
@@ -47,7 +47,8 @@ bool GraphicNativeTransform::canBeRotated()
if ( aLink.GetType() == GFX_LINK_TYPE_NATIVE_JPG
|| aLink.GetType() == GFX_LINK_TYPE_NATIVE_PNG
- || aLink.GetType() == GFX_LINK_TYPE_NATIVE_GIF)
+ || aLink.GetType() == GFX_LINK_TYPE_NATIVE_GIF
+ || aLink.GetType() == GFX_LINK_TYPE_NONE)
{
return true;
}
@@ -82,9 +83,27 @@ bool GraphicNativeTransform::rotate(sal_uInt16 aInputRotation)
{
return rotateGeneric(aRotation, OUString("gif"));
}
+ else if ( aLink.GetType() == GFX_LINK_TYPE_NONE )
+ {
+ return rotateBitmapOnly(aRotation);
+ }
return false;
}
+bool GraphicNativeTransform::rotateBitmapOnly(sal_uInt16 aRotation)
+{
+ if (mrGraphic.IsAnimated())
+ {
+ return false;
+ }
+
+ BitmapEx aBitmap = mrGraphic.GetBitmapEx();
+ aBitmap.Rotate(aRotation, COL_BLACK);
+ mrGraphic = aBitmap;
+
+ return true;
+}
+
bool GraphicNativeTransform::rotateGeneric(sal_uInt16 aRotation, OUString aType)
{
// Can't rotate animations yet