aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkCanvas.h12
-rw-r--r--include/core/SkDevice.h6
-rw-r--r--include/core/SkImage.h2
-rw-r--r--include/core/SkSurface.h15
4 files changed, 29 insertions, 6 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 01e0c75a24..1f29e1c00a 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -26,6 +26,7 @@ class SkDevice;
class SkDraw;
class SkDrawFilter;
class SkPicture;
+class SkSurface_Base;
/** \class SkCanvas
@@ -950,6 +951,10 @@ protected:
bool clipRectBounds(const SkRect* bounds, SaveFlags flags,
SkIRect* intersection);
+ // notify our surface (if we have one) that we are about to draw, so it
+ // can perform copy-on-write or invalidate any cached images
+ void predrawNotify();
+
private:
class MCRec;
@@ -964,6 +969,13 @@ private:
SkDevice* fLastDeviceToGainFocus;
int fSaveLayerCount; // number of successful saveLayer calls
+ SkSurface_Base* fSurfaceBase;
+ SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; }
+ void setSurfaceBase(SkSurface_Base* sb) {
+ fSurfaceBase = sb;
+ }
+ friend class SkSurface_Base;
+
void prepareForDeviceDraw(SkDevice*, const SkMatrix&, const SkRegion&);
bool fDeviceCMDirty; // cleared by updateDeviceCMCache()
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 326115ca31..41e316c9cc 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -380,6 +380,12 @@ private:
friend class SkDeviceFilteredPaint;
friend class DeviceImageFilterProxy;
+ friend class SkSurface_Raster;
+ // used to change the backend's pixels (and possibly config/rowbytes)
+ // but cannot change the width/height, so there should be no change to
+ // any clip information.
+ void replaceBitmapBackendForRasterSurface(const SkBitmap&);
+
// just called by SkCanvas when built as a layer
void setOrigin(int x, int y) { fOrigin.set(x, y); }
// just called by SkCanvas for saveLayer
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 985a3bbbbb..b0071e28d8 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -37,7 +37,7 @@ class SkColorSpace;
*/
class SkImage : public SkRefCnt {
public:
- SK_DECLARE_INST_COUNT(SkImage)
+// SK_DECLARE_INST_COUNT(SkImage)
enum ColorType {
kAlpha_8_ColorType,
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index 8e407b92f6..9f8908a3bd 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -26,7 +26,7 @@ class GrRenderTarget;
*/
class SkSurface : public SkRefCnt {
public:
- SK_DECLARE_INST_COUNT(SkSurface)
+// SK_DECLARE_INST_COUNT(SkSurface)
/**
* Create a new surface, using the specified pixels/rowbytes as its
@@ -78,7 +78,7 @@ public:
* If this surface is empty (i.e. has a zero-dimention), this will return
* 0.
*/
- uint32_t generationID() const;
+ uint32_t generationID();
/**
* Call this if the contents have changed. This will (lazily) force a new
@@ -128,10 +128,15 @@ public:
protected:
SkSurface(int width, int height);
+ // called by subclass if their contents have changed
+ void dirtyGenerationID() {
+ fGenerationID = 0;
+ }
+
private:
- const int fWidth;
- const int fHeight;
- mutable uint32_t fGenerationID;
+ const int fWidth;
+ const int fHeight;
+ uint32_t fGenerationID;
};
#endif