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

Unified Diff: Source/core/platform/graphics/ImageBuffer.h

Issue 104023007: Refactoring ImageBuffer to decouple it from Canvas2DLayerBridge (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: build fixes for win+mac Created 7 years 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/core/platform/graphics/ImageBuffer.h
diff --git a/Source/core/platform/graphics/ImageBuffer.h b/Source/core/platform/graphics/ImageBuffer.h
index 28ef739473f0b889eccedf47cef031ed083d9d59..65527a7bdc3723986fa3a21164a6639b82bc67a1 100644
--- a/Source/core/platform/graphics/ImageBuffer.h
+++ b/Source/core/platform/graphics/ImageBuffer.h
@@ -29,12 +29,11 @@
#define ImageBuffer_h
#include "core/platform/graphics/GraphicsContext.h"
-#include "core/platform/graphics/Canvas2DLayerBridge.h"
#include "platform/geometry/FloatRect.h"
-#include "platform/geometry/IntSize.h"
#include "platform/graphics/ColorSpace.h"
#include "platform/graphics/GraphicsTypes.h"
#include "platform/graphics/GraphicsTypes3D.h"
+#include "platform/graphics/ImageBufferSurface.h"
#include "platform/transforms/AffineTransform.h"
#include "wtf/Forward.h"
#include "wtf/OwnPtr.h"
@@ -45,27 +44,19 @@
class SkCanvas;
-namespace blink { class WebLayer; }
-
namespace WebCore {
+class DrawingBuffer;
+class GraphicsContext3D;
class Image;
class IntPoint;
class IntRect;
-class GraphicsContext3D;
enum Multiply {
Premultiplied,
Unmultiplied
};
-enum RenderingMode {
- Unaccelerated,
- UnacceleratedNonPlatformBuffer, // Use plain memory allocation rather than platform API to allocate backing store.
- TextureBacked, // Allocate a texture-based SkBitmap for the backing store.
- Accelerated, // Besides a texture-based SkBitmap for the backing store, allocate Canvas2DLayerBridge, etc as well for 2D Canvas drawing.
-};
-
enum BackingStoreCopy {
CopyBackingStore, // Guarantee subsequent draws don't affect the copy.
DontCopyBackingStore // Subsequent draws may affect the copy.
@@ -76,34 +67,15 @@ enum ScaleBehavior {
Unscaled
};
-enum OpacityMode {
- NonOpaque,
- Opaque,
-};
-
class ImageBuffer {
WTF_MAKE_NONCOPYABLE(ImageBuffer); WTF_MAKE_FAST_ALLOCATED;
public:
- // Will return a null pointer on allocation failure.
- static PassOwnPtr<ImageBuffer> create(const IntSize& size, float resolutionScale = 1, RenderingMode renderingMode = Unaccelerated, OpacityMode opacityMode = NonOpaque, int acceleratedMSAASampleCount = 0)
- {
- bool success = false;
- OwnPtr<ImageBuffer> buf = adoptPtr(new ImageBuffer(size, resolutionScale, renderingMode, opacityMode, acceleratedMSAASampleCount, success));
- if (!success)
- return nullptr;
- return buf.release();
- }
-
- static PassOwnPtr<ImageBuffer> createCompatibleBuffer(const IntSize&, float resolutionScale, const GraphicsContext*, bool hasAlpha);
-
- // Tiles may need float-to-integer coordinate mapping.
- static PassOwnPtr<ImageBuffer> createBufferForTile(const FloatSize& tileSize, const FloatSize& clampedTileSize, RenderingMode);
-
+ ImageBuffer(PassOwnPtr<ImageBufferSurface>);
~ImageBuffer();
// The actual resolution of the backing store
- const IntSize& internalSize() const { return m_size; }
- const IntSize& logicalSize() const { return m_logicalSize; }
+ const IntSize& internalSize() const { return m_surface->size(); }
+ const IntSize& logicalSize() const { return m_surface->size(); }
GraphicsContext* context() const;
@@ -145,17 +117,8 @@ private:
friend class GradientGeneratedImage;
friend class SkiaImageFilterBuilder;
- IntSize m_size;
- IntSize m_logicalSize;
- float m_resolutionScale;
- RefPtr<SkCanvas> m_canvas;
+ OwnPtr<ImageBufferSurface> m_surface;
OwnPtr<GraphicsContext> m_context;
- Canvas2DLayerBridgePtr m_layerBridge;
-
- // This constructor will place its success into the given out-variable
- // so that create() knows when it should return failure.
- ImageBuffer(const IntSize&, float resolutionScale, RenderingMode, OpacityMode, int acceleratedSampleCount, bool& success);
- ImageBuffer(const IntSize&, float resolutionScale, const GraphicsContext*, bool hasAlpha, bool& success);
};
struct ImageDataBuffer {

Powered by Google App Engine
This is Rietveld 408576698