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

Unified Diff: Source/platform/graphics/GraphicsLayer.cpp

Issue 1001703003: Take NativeImageSkia out behind the woodshed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make bitmapForCurrentFrame() return SkBitmap by value. Created 5 years, 9 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: Source/platform/graphics/GraphicsLayer.cpp
diff --git a/Source/platform/graphics/GraphicsLayer.cpp b/Source/platform/graphics/GraphicsLayer.cpp
index c0216a770ce1c43bf129097bfae884b230cb3039..720d09aa47c57c3d6d7df0b09d2d5f6002c5f4ef 100644
--- a/Source/platform/graphics/GraphicsLayer.cpp
+++ b/Source/platform/graphics/GraphicsLayer.cpp
@@ -39,7 +39,6 @@
#include "platform/graphics/filters/SkiaImageFilterBuilder.h"
#include "platform/graphics/paint/DisplayItemList.h"
#include "platform/graphics/paint/DrawingRecorder.h"
-#include "platform/graphics/skia/NativeImageSkia.h"
#include "platform/scroll/ScrollableArea.h"
#include "platform/text/TextStream.h"
#include "public/platform/Platform.h"
@@ -1008,13 +1007,16 @@ void GraphicsLayer::setContentsRect(const IntRect& rect)
void GraphicsLayer::setContentsToImage(Image* image)
{
- RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFrame() : nullptr;
- if (nativeImage) {
+ SkBitmap bitmap;
+ if (image) {
+ bitmap = image->bitmapForCurrentFrame();
+ }
+ if (!bitmap.isNull()) {
if (!m_imageLayer) {
m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->createImageLayer());
registerContentsLayer(m_imageLayer->layer());
}
- m_imageLayer->setImageBitmap(nativeImage->bitmap());
+ m_imageLayer->setImageBitmap(bitmap);
m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque());
updateContentsRect();
} else {
@@ -1033,10 +1035,12 @@ void GraphicsLayer::setContentsToNinePatch(Image* image, const IntRect& aperture
unregisterContentsLayer(m_ninePatchLayer->layer());
m_ninePatchLayer.clear();
}
- RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFrame() : nullptr;
- if (nativeImage) {
+ SkBitmap bitmap;
+ if (image) {
+ bitmap = image->bitmapForCurrentFrame();
+ }
+ if (!bitmap.isNull()) {
m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->createNinePatchLayer());
- const SkBitmap& bitmap = nativeImage->bitmap();
int borderWidth = bitmap.width() - aperture.width();
int borderHeight = bitmap.height() - aperture.height();
WebRect border(aperture.x(), aperture.y(), borderWidth, borderHeight);

Powered by Google App Engine
This is Rietveld 408576698