Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: WebCore/platform/graphics/chromium/ImageLayerChromium.cpp

Issue 10633016: Merge r120507 to chromium 1132 branch. (Closed) Base URL: svn://svn.chromium.org/webkit-readonly/branches/chromium/1132/Source/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
===================================================================
--- WebCore/platform/graphics/chromium/ImageLayerChromium.cpp (revision 120960)
+++ WebCore/platform/graphics/chromium/ImageLayerChromium.cpp (working copy)
@@ -83,11 +83,6 @@
LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::SampledTexelFormatBGRA;
}
- virtual void updateLayerRect(const IntRect& contentRect, const IntSize& tileSize, int /* borderTexels */, float /* contentsScale */, IntRect* /* resultingOpaqueRect */)
- {
- m_texSubImage.setSubImageSize(tileSize);
- }
-
virtual void updateTextureRect(GraphicsContext3D* context, TextureAllocator* allocator, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
{
texture->bindTexture(context, allocator);
@@ -95,37 +90,29 @@
// Source rect should never go outside the image pixels, even if this
// is requested because the texture extends outside the image.
IntRect clippedSourceRect = sourceRect;
- clippedSourceRect.intersect(imageRect());
+ IntRect imageRect = IntRect(0, 0, m_bitmap.width(), m_bitmap.height());
+ clippedSourceRect.intersect(imageRect);
IntRect clippedDestRect = destRect;
clippedDestRect.move(clippedSourceRect.location() - sourceRect.location());
clippedDestRect.setSize(clippedSourceRect.size());
- m_texSubImage.upload(m_image.pixels(), imageRect(), clippedSourceRect, clippedDestRect, texture->format(), context);
+ SkAutoLockPixels lock(m_bitmap);
+ m_texSubImage.upload(static_cast<const uint8_t*>(m_bitmap.getPixels()), imageRect, clippedSourceRect, clippedDestRect, texture->format(), context);
}
- void updateFromImage(NativeImagePtr nativeImage)
+ void setBitmap(const SkBitmap& bitmap)
{
- m_image.updateFromImage(nativeImage);
+ m_bitmap = bitmap;
}
-
- IntSize imageSize() const
- {
- return m_image.size();
- }
-
+
private:
explicit ImageLayerTextureUpdater(bool useMapTexSubImage)
: m_texSubImage(useMapTexSubImage)
{
}
- IntRect imageRect() const
- {
- return IntRect(IntPoint::zero(), m_image.size());
- }
-
- PlatformImage m_image;
+ SkBitmap m_bitmap;
LayerTextureSubImage m_texSubImage;
};
@@ -136,7 +123,6 @@
ImageLayerChromium::ImageLayerChromium()
: TiledLayerChromium()
- , m_imageForCurrentFrame(0)
{
}
@@ -144,17 +130,16 @@
{
}
-void ImageLayerChromium::setContents(Image* contents)
+void ImageLayerChromium::setBitmap(const SkBitmap& bitmap)
{
- // setContents() currently gets called whenever there is any
+ // setBitmap() currently gets called whenever there is any
// style change that affects the layer even if that change doesn't
// affect the actual contents of the image (e.g. a CSS animation).
// With this check in place we avoid unecessary texture uploads.
- if ((m_contents == contents) && (m_contents->nativeImageForCurrentFrame() == m_imageForCurrentFrame))
+ if (bitmap.pixelRef() && bitmap.pixelRef() == m_bitmap.pixelRef())
return;
- m_contents = contents;
- m_imageForCurrentFrame = m_contents->nativeImageForCurrentFrame();
+ m_bitmap = bitmap;
setNeedsDisplay();
}
@@ -162,7 +147,7 @@
{
createTextureUpdaterIfNeeded();
if (m_needsDisplay) {
- m_textureUpdater->updateFromImage(m_contents->nativeImageForCurrentFrame());
+ m_textureUpdater->setBitmap(m_bitmap);
updateTileSizeAndTilingOption();
invalidateRect(IntRect(IntPoint(), contentBounds()));
m_needsDisplay = false;
@@ -189,14 +174,12 @@
IntSize ImageLayerChromium::contentBounds() const
{
- if (!m_contents)
- return IntSize();
- return m_contents->size();
+ return IntSize(m_bitmap.width(), m_bitmap.height());
}
bool ImageLayerChromium::drawsContent() const
{
- return m_contents && TiledLayerChromium::drawsContent();
+ return !m_bitmap.isNull() && TiledLayerChromium::drawsContent();
}
bool ImageLayerChromium::needsContentsScale() const
« no previous file with comments | « WebCore/platform/graphics/chromium/ImageLayerChromium.h ('k') | WebCore/platform/graphics/chromium/PlatformImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698