BitmapPattern::BitmapPattern(PassRefPtr<Image> image, RepeatMode repeatMode)
: BitmapPatternBase(repeatMode, 0 )
{
    if (image) {
        // If image is animated, what about the pattern?
        if (image->bitmapForCurrentFrame(&m_tileImage))
            adjustExternalMemoryAllocated(m_tileImage.getSafeSize());
    }
}
Ejemplo n.º 2
0
ImagePattern::ImagePattern(PassRefPtr<Image> image, RepeatMode repeatMode)
    : Pattern(repeatMode)
    , m_tileImage(image->imageForCurrentFrame())
{
    if (m_tileImage) {
        // TODO(fmalita): mechanism to extract the actual SkImageInfo from an SkImage?
        const SkImageInfo info =
            SkImageInfo::MakeN32Premul(m_tileImage->width(), m_tileImage->height());
        adjustExternalMemoryAllocated(info.getSafeSize(info.minRowBytes()));
    }
}
Ejemplo n.º 3
0
// TODO(ccameron): ImagePattern should not draw to a globally set color space.
// https://crbug.com/672306
ImagePattern::ImagePattern(PassRefPtr<Image> image, RepeatMode repeatMode)
    : Pattern(repeatMode),
      m_tileImage(image->imageForCurrentFrame(
          ColorBehavior::transformToGlobalTarget())) {
  m_previousLocalMatrix.setIdentity();
  if (m_tileImage) {
    // TODO(fmalita): mechanism to extract the actual SkImageInfo from an
    // SkImage?
    const SkImageInfo info = SkImageInfo::MakeN32Premul(
        m_tileImage->width() + (isRepeatX() ? 0 : 2),
        m_tileImage->height() + (isRepeatY() ? 0 : 2));
    adjustExternalMemoryAllocated(info.getSafeSize(info.minRowBytes()));
  }
}
Ejemplo n.º 4
0
Pattern::~Pattern() {
  adjustExternalMemoryAllocated(-m_externalMemoryAllocated);
}
Ejemplo n.º 5
0
Pattern::Pattern(RepeatMode repeatMode, int64_t externalMemoryAllocated)
    : m_repeatMode(repeatMode), m_externalMemoryAllocated(0) {
  adjustExternalMemoryAllocated(externalMemoryAllocated);
}