8 #ifndef SkDevice_DEFINED
9 #define SkDevice_DEFINED
14 #include "SkSurfaceProps.h"
20 class SkImageFilterCache;
58 const SkIPoint& origin = this->getOrigin();
59 bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height());
62 SkIRect getGlobalBounds()
const {
64 this->getGlobalBounds(&bounds);
69 return this->imageInfo().
width();
73 return this->imageInfo().height();
76 bool isOpaque()
const {
77 return this->imageInfo().isOpaque();
80 #ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP
87 const SkBitmap& accessBitmap(
bool changePixels);
90 bool writePixels(
const SkImageInfo&,
const void*,
size_t rowBytes,
int x,
int y);
129 uint32_t filterTextFlags(
const SkPaint&)
const;
131 virtual bool onShouldDisableLCD(
const SkPaint&)
const {
return false; }
157 virtual void drawPaint(
const SkDraw&,
const SkPaint& paint) = 0;
162 virtual void drawOval(
const SkDraw&,
const SkRect& oval,
165 virtual void drawArc(
const SkDraw&,
const SkRect& oval, SkScalar startAngle,
166 SkScalar sweepAngle,
bool useCenter,
const SkPaint& paint);
185 virtual void drawPath(
const SkDraw&,
const SkPath& path,
187 const SkMatrix* prePathMatrix = NULL,
188 bool pathIsMutable =
false) = 0;
192 int x,
int y,
const SkPaint& paint) = 0;
219 virtual void drawText(
const SkDraw&,
const void* text,
size_t len,
220 SkScalar x, SkScalar y,
const SkPaint& paint) = 0;
221 virtual void drawPosText(
const SkDraw&,
const void* text,
size_t len,
222 const SkScalar pos[],
int scalarsPerPos,
224 virtual void drawVertices(
const SkDraw&, SkCanvas::VertexMode,
int vertexCount,
227 const uint16_t indices[],
int indexCount,
230 virtual void drawTextBlob(
const SkDraw&,
const SkTextBlob*, SkScalar x, SkScalar y,
248 virtual void drawTextOnPath(
const SkDraw&,
const void* text,
size_t len,
const SkPath&,
250 virtual void drawTextRSXform(
const SkDraw&,
const void* text,
size_t len,
const SkRSXform[],
253 virtual void drawSpecial(
const SkDraw&, SkSpecialImage*,
int x,
int y,
const SkPaint&);
258 bool readPixels(
const SkImageInfo&,
void* dst,
size_t rowBytes,
int x,
int y);
262 #ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP
267 virtual const SkBitmap& onAccessBitmap() {
269 return fLegacyBitmap;
273 virtual GrContext* context()
const {
return nullptr; }
277 virtual bool onPeekPixels(
SkPixmap*) {
return false; }
285 virtual bool onReadPixels(
const SkImageInfo&,
void*,
size_t,
int x,
int y);
293 virtual bool onWritePixels(
const SkImageInfo&,
const void*,
size_t,
int x,
int y);
295 virtual bool onAccessPixels(
SkPixmap*) {
return false; }
299 bool preserveLCDText);
306 , fTileUsage(tileUsage)
307 , fPixelGeometry(AdjustGeometry(info, tileUsage, geo,
false))
313 bool preserveLCDText)
315 , fTileUsage(tileUsage)
316 , fPixelGeometry(AdjustGeometry(info, tileUsage, geo, preserveLCDText))
321 const SkPixelGeometry fPixelGeometry;
340 static void LogDrawScaleFactor(
const SkMatrix&, SkFilterQuality);
344 friend struct DeviceCM;
346 friend class SkDrawIter;
347 friend class SkDeviceFilteredPaint;
348 friend class SkNoPixelsBitmapDevice;
349 friend class SkSurface_Raster;
350 friend class DeviceTestingAccess;
356 virtual void replaceBitmapBackendForRasterSurface(
const SkBitmap&) {}
358 virtual bool forceConservativeRasterClip()
const {
return false; }
366 void setOrigin(
int x,
int y) { fOrigin.set(x, y); }
372 virtual SkImageFilterCache* getImageFilterCache() {
return NULL; }
375 void privateResize(
int w,
int h) {
384 #ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP
the created device will never be drawn tiled
Definition: SkDevice.h:118
A Canvas encapsulates all of the state about drawing into a device (bitmap).
Definition: SkCanvas.h:58
The SkRRect class represents a rounded rect with a potentially different radii for each corner...
Definition: SkRRect.h:48
The SkPath class encapsulates compound (multiple contour) geometric paths consisting of straight line...
Definition: SkPath.h:27
Describe an image's dimensions and pixel type.
Definition: SkImageInfo.h:181
SkTextBlob combines multiple text runs into an immutable, ref-counted structure.
Definition: SkTextBlob.h:22
Mode
List of predefined xfermodes.
Definition: SkXfermode.h:71
const SkIPoint & getOrigin() const
Return the device's origin: its offset in device coordinates from the default origin in its canvas' m...
Definition: SkDevice.h:113
PointMode
Definition: SkCanvas.h:620
Describes properties and constraints of a given SkSurface.
Definition: SkSurfaceProps.h:51
Pairs SkImageInfo with actual pixels and rowbytes.
Definition: SkPixmap.h:23
Definition: SkPoint.h:156
Definition: SkDevice.h:297
The SkMatrix class holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:26
Definition: SkRefCnt.h:135
The SkPaint class holds the style and color information about how to draw geometries, text and bitmaps.
Definition: SkPaint.h:46
virtual SkBaseDevice * onCreateDevice(const CreateInfo &, const SkPaint *)
Create a new device based on CreateInfo.
Definition: SkDevice.h:335
SkXfermode is the base class for objects that are called to implement custom "transfer-modes" in the ...
Definition: SkXfermode.h:34
SkData holds an immutable data buffer.
Definition: SkData.h:22
const SkImageInfo & imageInfo() const
Return ImageInfo for this device.
Definition: SkDevice.h:42
Definition: SkDevice.h:121
Specifies coordinates to divide a bitmap into (xCount*yCount) rects.
Definition: SkCanvas.h:926
The SkBitmap class specifies a raster bitmap.
Definition: SkBitmap.h:41
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:258
Definition: GrDrawContext.h:51
DEPRECATED - use SkPaintFilterCanvas instead.
Definition: SkDrawFilter.h:26
Definition: GrContext.h:48
virtual void flush()
Causes any deferred drawing to the device to be completed.
Definition: SkDevice.h:370
SrcRectConstraint
Controls the behavior at the edge of the src-rect, when specified in drawImageRect, trading off speed for exactness.
Definition: SkCanvas.h:796
The SkRegion class encapsulates the geometric region used to specify clipping areas for drawing...
Definition: SkRegion.h:30
the created device may be drawn tiled
Definition: SkDevice.h:117
uint32_t SkColor
32 bit ARGB color value, not premultiplied.
Definition: SkColor.h:28
Definition: SkDevice.h:28
const SkSurfaceProps & surfaceProps() const
Return SurfaceProps for this device.
Definition: SkDevice.h:47
int width() const
Returns the rectangle's width.
Definition: SkRect.h:72
virtual GrDrawContext * accessDrawContext()
Don't call this!
Definition: SkDevice.h:363
GrRenderTarget represents a 2D buffer of pixels that can be rendered to.
Definition: GrRenderTarget.h:26
virtual void setMatrixClip(const SkMatrix &, const SkRegion &, const SkClipStack &)
DEPRECATED: This will be removed in a future change.
Definition: SkDevice.h:149
TileUsage
Definition: SkDevice.h:116
SkIRect holds four 32 bit integer coordinates for a rectangle.
Definition: SkRect.h:20
SkImageInfo makeWH(int newWidth, int newHeight) const
Return a new ImageInfo with the same colortype and alphatype as this info, but with the specified wid...
Definition: SkImageInfo.h:255
Definition: SkClipStack.h:26
SkImage is an abstraction for drawing a rectagle of pixels, though the particular type of image could...
Definition: SkImage.h:45
SkIPoint holds two 32 bit integer coordinates.
Definition: SkPoint.h:40
void getGlobalBounds(SkIRect *bounds) const
Return the bounds of the device in the coordinate space of the root canvas.
Definition: SkDevice.h:56
Types and macros for colors.
Definition: SkBitmapDevice.h:36