diff options
author | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-09 22:30:18 +0000 |
---|---|---|
committer | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-09 22:30:18 +0000 |
commit | 3fffb2ee9fa01ae61efb2395973eb7575eda4c96 (patch) | |
tree | 22f3328eb4c6bca5cb87339d5a765630293f7aaf /include | |
parent | 5cd3656ed3676730b296722812f5924d06d0cc98 (diff) |
Reverting r5861 (remove gainfocus and setMatixClip) due to Chrome compilation issues
git-svn-id: http://skia.googlecode.com/svn/trunk@5871 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkCanvas.h | 5 | ||||
-rw-r--r-- | include/core/SkDevice.h | 23 | ||||
-rw-r--r-- | include/gpu/SkGpuDevice.h | 14 |
3 files changed, 39 insertions, 3 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 178364cb43..0868574525 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -978,6 +978,7 @@ private: uint32_t fMCRecStorage[32]; SkBounder* fBounder; + SkDevice* fLastDeviceToGainFocus; int fSaveLayerCount; // number of successful saveLayer calls SkMetaData* fMetaData; @@ -988,7 +989,9 @@ private: fSurfaceBase = sb; } friend class SkSurface_Base; - + + void prepareForDeviceDraw(SkDevice*, const SkMatrix&, const SkRegion&); + bool fDeviceCMDirty; // cleared by updateDeviceCMCache() void updateDeviceCMCache(); diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index 2ce64ee44f..f0aa8e0a02 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -187,6 +187,28 @@ protected: */ virtual bool filterTextFlags(const SkPaint& paint, TextFlags*); + /** + * Called with the correct matrix and clip before this device is drawn + * to using those settings. If your subclass overrides this, be sure to + * call through to the base class as well. + * + * The clipstack is another view of the clip. It records the actual + * geometry that went into building the region. It is present for devices + * that want to parse it, but is not required: the region is a complete + * picture of the current clip. (i.e. if you regionize all of the geometry + * in the clipstack, you will arrive at an equivalent region to the one + * passed in). + */ + virtual void setMatrixClip(const SkMatrix&, const SkRegion&, + const SkClipStack&); + + /** Called when this device gains focus (i.e becomes the current device + for drawing). + */ + virtual void gainFocus(const SkMatrix&, const SkRegion&) { + SkASSERT(fAttachedToCanvas); + } + /** Clears the entire device to the specified color (including alpha). * Ignores the clip. */ @@ -363,6 +385,7 @@ protected: private: friend class SkCanvas; + friend struct DeviceCM; //for setMatrixClip friend class SkDraw; friend class SkDrawIter; friend class SkDeviceFilteredPaint; diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h index b941894221..790d4a9ca1 100644 --- a/include/gpu/SkGpuDevice.h +++ b/include/gpu/SkGpuDevice.h @@ -51,6 +51,12 @@ public: GrContext* context() const { return fContext; } + /** + * Override from SkGpuDevice, so we can set our FBO to be the render target + * The canvas parameter must be a SkGpuCanvas + */ + virtual void gainFocus(const SkMatrix&, const SkRegion&) SK_OVERRIDE; + virtual SkGpuRenderTarget* accessRenderTarget() SK_OVERRIDE; // overrides from SkDevice @@ -59,6 +65,9 @@ public: virtual void writePixels(const SkBitmap& bitmap, int x, int y, SkCanvas::Config8888 config8888) SK_OVERRIDE; + virtual void setMatrixClip(const SkMatrix& matrix, const SkRegion& clip, + const SkClipStack&) SK_OVERRIDE; + virtual 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; @@ -125,9 +134,10 @@ private: GrClipData fClipData; - // state for our render-target + // state for our offscreen render-target GrRenderTarget* fRenderTarget; bool fNeedClear; + bool fNeedPrepareRenderTarget; // called from rt and tex cons void initFromRenderTarget(GrContext*, GrRenderTarget*, bool cached); @@ -144,7 +154,7 @@ private: SkDrawProcs* initDrawForText(GrTextContext*); bool bindDeviceAsTexture(GrPaint* paint); - void prepareDraw(const SkDraw&); // sets the render target, clip, and matrix on GrContext. + void prepareRenderTarget(const SkDraw&); bool shouldTileBitmap(const SkBitmap& bitmap, const GrTextureParams& sampler, const SkRect* srcRectPtr) const; |