| Index: src/gpu/SkGpuDevice.h
|
| diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
|
| index 07eb348f8de41ad66efd990e2f1cb46dbf428780..d166abc290ea184b3e48b0c98138f3117cc3f193 100644
|
| --- a/src/gpu/SkGpuDevice.h
|
| +++ b/src/gpu/SkGpuDevice.h
|
| @@ -24,6 +24,7 @@ struct GrSkDrawProcs;
|
| class GrAccelData;
|
| struct GrCachedLayer;
|
| class GrTextContext;
|
| +class SkSurface_Gpu;
|
|
|
| /**
|
| * Subclass of SkBaseDevice, which directs all drawing to the GrGpu owned by the
|
| @@ -50,6 +51,10 @@ public:
|
|
|
| virtual ~SkGpuDevice();
|
|
|
| + void setSurface(SkSurface_Gpu* surface) {
|
| + fSurface = surface;
|
| + }
|
| +
|
| SkGpuDevice* cloneDevice(const SkSurfaceProps& props) {
|
| SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), kPossible_TileUsage,
|
| props.pixelGeometry()),
|
| @@ -62,8 +67,6 @@ public:
|
| // set all pixels to 0
|
| void clearAll();
|
|
|
| - void replaceRenderTarget(bool shouldRetainContent);
|
| -
|
| GrRenderTarget* accessRenderTarget() SK_OVERRIDE;
|
|
|
| SkImageInfo imageInfo() const SK_OVERRIDE {
|
| @@ -72,6 +75,12 @@ public:
|
|
|
| const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; }
|
|
|
| + void discard() SK_OVERRIDE;
|
| + SkImage* newImageSnapshot() SK_OVERRIDE;
|
| + SkImage* newImageSnapshot(const SkSurfaceProps* props, SkSurface::Budgeted);
|
| + int getBackendSampleCnt() const { return fRenderTarget->numSamples(); }
|
| + bool isBackendBudgeted() const;
|
| +
|
| void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE;
|
| virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count,
|
| const SkPoint[], const SkPaint& paint) SK_OVERRIDE;
|
| @@ -146,6 +155,8 @@ private:
|
| // remove when our clients don't rely on accessBitmap()
|
| SkBitmap fLegacyBitmap;
|
| bool fNeedClear;
|
| + SkSurface_Gpu* fSurface;
|
| + SkAutoTUnref<SkImage> fSnapshot;
|
|
|
| SkGpuDevice(GrRenderTarget*, const SkSurfaceProps*, unsigned flags);
|
|
|
| @@ -157,8 +168,22 @@ private:
|
|
|
| bool forceConservativeRasterClip() const SK_OVERRIDE { return true; }
|
|
|
| - // sets the render target and clip on context
|
| - void prepareDraw(const SkDraw&);
|
| + /* Prepares the device for modification and sets the clip on context.
|
| + * returns true if the draw can proceed. */
|
| + bool prepareDraw(const SkDraw&);
|
| +
|
| + /* Prepares the device for modification.
|
| + * returns true if the draw can proceed. */
|
| + bool prepareWrite();
|
| +
|
| + enum ModifyMode { kDrawContent_ModifyMode, kDiscard_ModifyMode };
|
| + /** Prepares the render target for modification.
|
| + * 1. Detaches the snapshot, if needed.
|
| + * 2. Creates new render target if snapshot refers to the current render target.
|
| + * 3. Does the deferred clear, if needed.
|
| + * returns true if the render target is functional and can be rendered to.
|
| + */
|
| + bool prepareBackendRenderTarget(ModifyMode);
|
|
|
| /**
|
| * Implementation for both drawBitmap and drawBitmapRect.
|
|
|