Changeset 147110 in webkit


Ignore:
Timestamp:
Mar 28, 2013 7:04:13 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Handle EXIF orientation for ImageDocuments
https://bugs.webkit.org/show_bug.cgi?id=113423

Internal Bug: PR 293648
Informally Reviewed by Jeff Rogers
Patch by Chris Hutten-Czapski <chutten@blackberry.com> on 2013-03-28
Reviewed by Rob Buis.

Support image orientation in our image draw calls, and advertise
the capability to the calling code. This allows us to respect EXIF
orientation data.

  • platform/graphics/BitmapImage.h:
  • platform/graphics/blackberry/ImageBlackBerry.cpp:

(WebCore::BitmapImage::draw):
(WebCore):

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::shouldRespectImageOrientation):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r147109 r147110  
     12013-03-28  Chris Hutten-Czapski  <chutten@blackberry.com>
     2
     3        [BlackBerry] Handle EXIF orientation for ImageDocuments
     4        https://bugs.webkit.org/show_bug.cgi?id=113423
     5
     6        Internal Bug: PR 293648
     7        Informally Reviewed by Jeff Rogers
     8        Reviewed by Rob Buis.
     9
     10        Support image orientation in our image draw calls, and advertise
     11        the capability to the calling code. This allows us to respect EXIF
     12        orientation data.
     13
     14        * platform/graphics/BitmapImage.h:
     15        * platform/graphics/blackberry/ImageBlackBerry.cpp:
     16        (WebCore::BitmapImage::draw):
     17        (WebCore):
     18        * rendering/RenderObject.cpp:
     19        (WebCore::RenderObject::shouldRespectImageOrientation):
     20
    1212013-03-28  Andrey Kosyakov  <caseq@chromium.org>
    222
  • trunk/Source/WebCore/platform/graphics/BitmapImage.h

    r141637 r147110  
    209209#endif
    210210    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode);
    211 #if USE(CG) || PLATFORM(CHROMIUM) || USE(CAIRO)
     211#if USE(CG) || PLATFORM(CHROMIUM) || USE(CAIRO) || PLATFORM(BLACKBERRY)
    212212    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode, RespectImageOrientationEnum) OVERRIDE;
    213213#endif
  • trunk/Source/WebCore/platform/graphics/blackberry/ImageBlackBerry.cpp

    r145550 r147110  
    122122void BitmapImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator op, BlendMode blendMode)
    123123{
     124    draw(context, dstRect, srcRect, styleColorSpace, op, DoNotRespectImageOrientation);
     125}
     126
     127void BitmapImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation)
     128{
    124129    startAnimation();
    125130
     
    137142    normSrcRect = adjustSourceRectForDownSampling(normSrcRect, image->size());
    138143#endif
     144
     145    // use similar orientation code as ImageSkia
     146    ImageOrientation orientation = DefaultImageOrientation;
     147    if (shouldRespectImageOrientation == RespectImageOrientation)
     148        orientation = frameOrientationAtIndex(m_currentFrame);
     149
     150    GraphicsContextStateSaver saveContext(*context, false);
     151    if (orientation != DefaultImageOrientation) {
     152        saveContext.save();
     153
     154        // ImageOrientation expects the origin to be at (0, 0)
     155        context->translate(normDstRect.x(), normDstRect.y());
     156        normDstRect.setLocation(FloatPoint());
     157
     158        context->concatCTM(orientation.transformFromDefault(normDstRect.size()));
     159        if (orientation.usesWidthAsHeight()) {
     160            // The destination rect will have its width and height already reversed for the orientation of
     161            // the image, as it was needed for page layout, so we need to reverse it back here.
     162            normDstRect = FloatRect(normDstRect.x(), normDstRect.y(), normDstRect.height(), normDstRect.width());
     163        }
     164    }
    139165
    140166    CompositeOperator oldOperator = context->compositeOperation();
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r146856 r147110  
    22902290    // an <img> and the setting to respect it everywhere is set.
    22912291    return
    2292 #if USE(CG) || PLATFORM(CHROMIUM) || USE(CAIRO)
     2292#if USE(CG) || PLATFORM(CHROMIUM) || USE(CAIRO) || PLATFORM(BLACKBERRY)
    22932293        // This can only be enabled for ports which honor the orientation flag in their drawing code.
    22942294        document()->isImageDocument() ||
Note: See TracChangeset for help on using the changeset viewer.