class SkMatrix;
class SkPaint;
-namespace WebCore {
+namespace blink {
class FloatPoint;
class FloatRect;
return adoptRef(new NativeImageSkia(bitmap));
}
- // This method does a shallow copy of the internal SkBitmap (ie., it
- // references the same pixel data and bumps the refcount). Use only when
- // you want sharing semantics.
- PassRefPtr<NativeImageSkia> clone() const
- {
- return adoptRef(new NativeImageSkia(m_image, m_resizedImage, m_cachedImageInfo, m_resizeRequests));
- }
-
~NativeImageSkia();
- // Returns the number of bytes of image data. This includes the cached
- // resized version if there is one.
- int decodedSize() const;
-
// Returns true if the entire image has been decoded.
- bool isDataComplete() const { return m_image.isImmutable(); }
+ bool isDataComplete() const { return bitmap().isImmutable(); }
// Get reference to the internal SkBitmap representing this image.
- const SkBitmap& bitmap() const { return m_image; }
+ const SkBitmap& bitmap() const { return m_bitmap; }
// We can keep a resized version of the bitmap cached on this object.
// This function will return true if there is a cached version of the given
// Rectangle of the subset in the scaled image.
SkBitmap resizedBitmap(const SkISize& scaledImageSize, const SkIRect& scaledImageSubset) const;
- void draw(GraphicsContext*, const SkRect& srcRect, const SkRect& destRect, PassRefPtr<SkXfermode>) const;
+ void draw(
+ GraphicsContext*,
+ const SkRect& srcRect,
+ const SkRect& destRect,
+ CompositeOperator,
+ WebBlendMode) const;
+
void drawPattern(
GraphicsContext*,
const FloatRect& srcRect,
const FloatPoint& phase,
CompositeOperator,
const FloatRect& destRect,
- blink::WebBlendMode,
+ WebBlendMode,
const IntSize& repeatSpacing) const;
private:
SkIRect rectInSubset(const SkIRect& otherScaledImageRect);
};
- NativeImageSkia(const SkBitmap& image, const SkBitmap& resizedImage, const ImageResourceInfo&, int resizeRequests);
-
// Returns true if the given resize operation should either resize the whole
// image and cache it, or resize just the part it needs and throw the result
// away.
// entire thing, it's best to just do it up front.
bool shouldCacheResampling(const SkISize& scaledImageSize, const SkIRect& scaledImageSubset) const;
- InterpolationQuality computeInterpolationQuality(const SkMatrix&, float srcWidth, float srcHeight, float destWidth, float destHeight) const;
SkBitmap extractScaledImageFragment(const SkRect& srcRect, float scaleX, float scaleY, SkRect* scaledSrcRect) const;
- void drawResampledBitmap(GraphicsContext*, SkPaint&, const SkRect& srcRect, const SkRect& destRect) const;
// The original image.
- SkBitmap m_image;
+ SkBitmap m_bitmap;
// The cached bitmap fragment. This is a subset of the scaled version of
- // |m_image|. empty() returns true if there is no cached image.
+ // |m_bitmap|. empty() returns true if there is no cached image.
mutable SkBitmap m_resizedImage;
// References how many times that the image size has been requested for
mutable int m_resizeRequests;
};
-}
+} // namespace blink
+
#endif // NativeImageSkia_h