#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkColor.h"
-#include "SkDeviceProperties.h"
#include "SkImageFilter.h"
class SkClipStack;
class SkMatrix;
class SkMetaData;
class SkRegion;
-
+struct SkDeviceProperties;
class GrRenderTarget;
class SK_API SkBaseDevice : public SkRefCnt {
* Construct a new device.
*/
SkBaseDevice();
-
- /**
- * Construct a new device.
- */
- SkBaseDevice(const SkDeviceProperties& deviceProperties);
-
virtual ~SkBaseDevice();
SkBaseDevice* createCompatibleDevice(const SkImageInfo&);
SkMetaData& getMetaData();
- /** Return the image properties of the device. */
- virtual const SkDeviceProperties& getDeviceProperties() const {
- //Currently, all the properties are leaky.
- return fLeakyProperties;
- }
-
/**
* Return ImageInfo for this device. If the canvas is not backed by pixels
* (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType.
};
struct TextFlags {
- uint32_t fFlags; // SkPaint::getFlags()
- SkPaint::Hinting fHinting;
+ uint32_t fFlags; // SkPaint::getFlags()
};
/**
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
const SkPaint& paint) = 0;
+ // default implementation unrolls the blob runs.
+ virtual void drawTextBlob(const SkDraw&, const SkTextBlob*, SkScalar x, SkScalar y,
+ const SkPaint& paint);
// default implementation calls drawVertices
virtual void drawPatch(const SkDraw&, const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint);
protected:
// default impl returns NULL
- virtual SkSurface* newSurface(const SkImageInfo&);
+ virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&);
// default impl returns NULL
virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes);
* If the device does handle a property, that property should be set to the identity value
* for that property, effectively making it non-leaky.
*/
- SkDeviceProperties fLeakyProperties;
+ const SkDeviceProperties& getLeakyProperties() const {
+ return *fLeakyProperties;
+ }
/**
* PRIVATE / EXPERIMENTAL -- do not call
virtual bool EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const SkMatrix*,
const SkPaint*);
+ void setPixelGeometry(SkPixelGeometry geo);
+
private:
friend class SkCanvas;
friend struct DeviceCM; //for setMatrixClip
// TODO: move to SkBitmapDevice
virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {}
+ virtual bool forceConservativeRasterClip() const { return false; }
+
// 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
SkIPoint fOrigin;
SkMetaData* fMetaData;
+ SkDeviceProperties* fLeakyProperties; // will always exist.
#ifdef SK_DEBUG
bool fAttachedToCanvas;