19241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com
29241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com/*
39241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com * Copyright 2013 Google Inc.
49241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com *
59241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com * Use of this source code is governed by a BSD-style license that can be
69241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com * found in the LICENSE file.
79241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com */
89241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com
99241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com#ifndef SkBitmapDevice_DEFINED
109241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com#define SkBitmapDevice_DEFINED
119241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com
129241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com#include "SkDevice.h"
139241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com
141f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com///////////////////////////////////////////////////////////////////////////////
151f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.comclass SK_API SkBitmapDevice : public SkBaseDevice {
161f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.compublic:
171f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    SK_DECLARE_INST_COUNT(SkBitmapDevice)
181f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
191f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /**
201f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  Construct a new device with the specified bitmap as its backend. It is
211f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  valid for the bitmap to have no pixels associated with it. In that case,
221f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  any drawing to this device will have no effect.
231f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    */
241f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    SkBitmapDevice(const SkBitmap& bitmap);
251f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
261f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /**
271f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  Construct a new device with the specified bitmap as its backend. It is
281f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  valid for the bitmap to have no pixels associated with it. In that case,
291f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  any drawing to this device will have no effect.
301f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    */
311f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties);
321f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
3315a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    static SkBitmapDevice* Create(const SkImageInfo&,
3415a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org                                  const SkDeviceProperties* = NULL);
351f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
36c3bd8af6d5722e854feca70c40d92f4954c5b67bcommit-bot@chromium.org    virtual SkImageInfo imageInfo() const SK_OVERRIDE;
37c3bd8af6d5722e854feca70c40d92f4954c5b67bcommit-bot@chromium.org
381f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /**
391f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     * Return the device's associated gpu render target, or NULL.
401f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     */
411f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE { return NULL; }
421f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
431f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.comprotected:
441f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /**
451f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  Device may filter the text flags for drawing text here. If it wants to
461f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  make a change to the specified values, it should write them into the
471f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  textflags parameter (output) and return true. If the paint is fine as
481f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  is, then ignore the textflags parameter and return false.
491f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *
501f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  The baseclass SkDevice filters based on its depth and blitters.
511f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     */
521f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE;
531f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
541f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /** Clears the entire device to the specified color (including alpha).
551f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  Ignores the clip.
561f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     */
571f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void clear(SkColor color) SK_OVERRIDE;
581f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
591f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /** These are called inside the per-device-layer loop for each draw call.
601f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     When these are called, we have already applied any saveLayer operations,
611f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     and are handling any looping from the paint, and any effects from the
621f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     DrawFilter.
631f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     */
641f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE;
651f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count,
661f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                            const SkPoint[], const SkPaint& paint) SK_OVERRIDE;
671f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawRect(const SkDraw&, const SkRect& r,
681f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                          const SkPaint& paint) SK_OVERRIDE;
691f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawOval(const SkDraw&, const SkRect& oval,
701f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                          const SkPaint& paint) SK_OVERRIDE;
711f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawRRect(const SkDraw&, const SkRRect& rr,
721f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                           const SkPaint& paint) SK_OVERRIDE;
731f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
741f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /**
751f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  If pathIsMutable, then the implementation is allowed to cast path to a
761f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  non-const pointer and modify it in place (as an optimization). Canvas
771f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  may do this to implement helpers such as drawOval, by placing a temp
781f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  path on the stack to hold the representation of the oval.
791f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *
801f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  If prePathMatrix is not null, it should logically be applied before any
811f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  stroking or other effects. If there are no effects on the paint that
821f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  affect the geometry/rasterization, then the pre matrix can just be
831f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  pre-concated with the current matrix.
841f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     */
851f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawPath(const SkDraw&, const SkPath& path,
861f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                          const SkPaint& paint,
871f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                          const SkMatrix* prePathMatrix = NULL,
881f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                          bool pathIsMutable = false) SK_OVERRIDE;
891f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap,
901f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                            const SkMatrix& matrix, const SkPaint& paint) SK_OVERRIDE;
911f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap,
921f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                            int x, int y, const SkPaint& paint) SK_OVERRIDE;
931f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
941f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /**
951f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  The default impl. will create a bitmap-shader from the bitmap,
961f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  and call drawRect with it.
971f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     */
981f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawBitmapRect(const SkDraw&, const SkBitmap&,
991f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                                const SkRect* srcOrNull, const SkRect& dst,
1001f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                                const SkPaint& paint,
1011f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                                SkCanvas::DrawBitmapRectFlags flags) SK_OVERRIDE;
1021f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
1031f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /**
1041f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  Does not handle text decoration.
1051f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  Decorations (underline and stike-thru) will be handled by SkCanvas.
1061f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     */
1071f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawText(const SkDraw&, const void* text, size_t len,
1081f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                          SkScalar x, SkScalar y, const SkPaint& paint) SK_OVERRIDE;
1091f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawPosText(const SkDraw&, const void* text, size_t len,
1101f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                             const SkScalar pos[], SkScalar constY,
1111f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                             int scalarsPerPos, const SkPaint& paint) SK_OVERRIDE;
1121f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len,
1131f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                                const SkPath& path, const SkMatrix* matrix,
1141f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                                const SkPaint& paint) SK_OVERRIDE;
1151f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCount,
1161f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                              const SkPoint verts[], const SkPoint texs[],
1171f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                              const SkColor colors[], SkXfermode* xmode,
1181f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                              const uint16_t indices[], int indexCount,
1191f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                              const SkPaint& paint) SK_OVERRIDE;
1201f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /** The SkBaseDevice passed will be an SkBaseDevice which was returned by a call to
12115a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org        onCreateDevice on this device with kSaveLayer_Usage.
1221f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     */
1231f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
1241f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                            const SkPaint&) SK_OVERRIDE;
1251f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
1261f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    ///////////////////////////////////////////////////////////////////////////
1271f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
1281f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /** Update as needed the pixel value in the bitmap, so that the caller can
1291f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com        access the pixels directly. Note: only the pixels field should be
1301f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com        altered. The config/width/height/rowbytes must remain unchanged.
1311f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com        @return the device contents as a bitmap
1321f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    */
1331f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE;
1341f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
1351f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); }
1361f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    // just for subclasses, to assign a custom pixelref
137672588b684d484dce6ae251e9e163e4a46924322reed@google.com    SkPixelRef* setPixelRef(SkPixelRef* pr) {
138672588b684d484dce6ae251e9e163e4a46924322reed@google.com        fBitmap.setPixelRef(pr);
1391f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com        return pr;
1401f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    }
1411f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
142a713f9c6f6a06d216d53e268b9c691941053dabfcommit-bot@chromium.org    virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) SK_OVERRIDE;
1434cd9e2169e35cd67ee7358acea6541245e1d1744commit-bot@chromium.org    virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) SK_OVERRIDE;
1449c135db83d198e7d8200027c7d2cf60f38517ee3reed@google.com    virtual void* onAccessPixels(SkImageInfo* info, size_t* rowBytes) SK_OVERRIDE;
1451f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
1461f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /** Called when this device is installed into a Canvas. Balanced by a call
1471f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com        to unlockPixels() when the device is removed from a Canvas.
1481f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    */
1491f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void lockPixels() SK_OVERRIDE;
1501f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void unlockPixels() SK_OVERRIDE;
1511f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
1521f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /**
1531f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  Returns true if the device allows processing of this imagefilter. If
1541f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  false is returned, then the filter is ignored. This may happen for
1551f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  some subclasses that do not support pixel manipulations after drawing
1561f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  has occurred (e.g. printing). The default implementation returns true.
1571f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     */
158ae761f7545d8ebf181d220169afac2056b057b8ccommit-bot@chromium.org    virtual bool allowImageFilter(const SkImageFilter*) SK_OVERRIDE;
1591f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
1601f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /**
1611f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  Override and return true for filters that the device can handle
1621f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  intrinsically. Doing so means that SkCanvas will pass-through this
1631f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  filter to drawSprite and drawDevice (and potentially filterImage).
1641f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  Returning false means the SkCanvas will have apply the filter itself,
1651f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  and just pass the resulting image to the device.
1661f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     */
167ae761f7545d8ebf181d220169afac2056b057b8ccommit-bot@chromium.org    virtual bool canHandleImageFilter(const SkImageFilter*) SK_OVERRIDE;
1681f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
1691f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /**
1701f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  Related (but not required) to canHandleImageFilter, this method returns
1711f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  true if the device could apply the filter to the src bitmap and return
1721f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  the result (and updates offset as needed).
1731f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  If the device does not recognize or support this filter,
1741f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     *  it just returns false and leaves result and offset unchanged.
1751f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     */
1764cb543d6057b692e1099e9f115155f0bf323a0c8senorblanco@chromium.org    virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkImageFilter::Context&,
1771f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com                             SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
1781f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
1791f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.comprivate:
1801f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    friend class SkCanvas;
1811f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    friend struct DeviceCM; //for setMatrixClip
1821f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    friend class SkDraw;
1831f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    friend class SkDrawIter;
1841f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    friend class SkDeviceFilteredPaint;
1851f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    friend class SkDeviceImageFilterProxy;
1861f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
1871f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    friend class SkSurface_Raster;
1881f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
1891f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    // used to change the backend's pixels (and possibly config/rowbytes)
1901f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    // but cannot change the width/height, so there should be no change to
1911f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    // any clip information.
1921f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE;
1931f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
19415a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE;
1951f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
1961f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    /** Causes any deferred drawing to the device to be completed.
1971f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com     */
1981f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    virtual void flush() SK_OVERRIDE {}
1991f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
20076f10a3bd936af7dbe2b5873d5a7eedd73cdc5dareed@google.com    virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE;
201c3bd8af6d5722e854feca70c40d92f4954c5b67bcommit-bot@chromium.org    virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE;
20276f10a3bd936af7dbe2b5873d5a7eedd73cdc5dareed@google.com
2031f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    SkBitmap    fBitmap;
2041f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com
2051f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com    typedef SkBaseDevice INHERITED;
2061f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com};
2079241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com
2089241e33ca900c5fd8f902829255f381f8e6e17c8robertphillips@google.com#endif // SkBitmapDevice_DEFINED
209