1 #include "SkGLDevice_SWLayer.h"
4 SkGLDevice_SWLayer::SkGLDevice_SWLayer(const SkBitmap
& bitmap
)
5 : SkGLDevice(bitmap
, true) {
8 SkASSERT(bitmap
.getPixels());
11 SkGLDevice_SWLayer::~SkGLDevice_SWLayer() {
13 glDeleteTextures(1, &fTextureID
);
17 SkGLDevice::TexOrientation
SkGLDevice_SWLayer::bindDeviceAsTexture() {
18 const SkBitmap
& bitmap
= this->accessBitmap(false);
20 if (0 == fTextureID
) {
21 fTextureID
= SkGL::BindNewTexture(bitmap
, NULL
);
23 return kTopToBottom_TexOrientation
;
26 ///////////////////////////////////////////////////////////////////////////////
30 void SkGLDevice_SWLayer::drawPaint(const SkDraw
& draw
, const SkPaint
& paint
) {
31 draw
.drawPaint(paint
);
34 void SkGLDevice_SWLayer::drawPoints(const SkDraw
& draw
, SkCanvas::PointMode mode
, size_t count
,
35 const SkPoint pts
[], const SkPaint
& paint
) {
36 draw
.drawPoints(mode
, count
, pts
, paint
);
39 void SkGLDevice_SWLayer::drawRect(const SkDraw
& draw
, const SkRect
& r
,
40 const SkPaint
& paint
) {
41 draw
.drawRect(r
, paint
);
44 void SkGLDevice_SWLayer::drawPath(const SkDraw
& draw
, const SkPath
& path
,
45 const SkPaint
& paint
) {
46 draw
.drawPath(path
, paint
);
49 void SkGLDevice_SWLayer::drawBitmap(const SkDraw
& draw
, const SkBitmap
& bitmap
,
50 const SkMatrix
& matrix
, const SkPaint
& paint
) {
51 draw
.drawBitmap(bitmap
, matrix
, paint
);
54 void SkGLDevice_SWLayer::drawSprite(const SkDraw
& draw
, const SkBitmap
& bitmap
,
55 int x
, int y
, const SkPaint
& paint
) {
56 draw
.drawSprite(bitmap
, x
, y
, paint
);
59 void SkGLDevice_SWLayer::drawText(const SkDraw
& draw
, const void* text
, size_t len
,
60 SkScalar x
, SkScalar y
, const SkPaint
& paint
) {
61 draw
.drawText((const char*)text
, len
, x
, y
, paint
);
64 void SkGLDevice_SWLayer::drawPosText(const SkDraw
& draw
, const void* text
, size_t len
,
65 const SkScalar xpos
[], SkScalar y
,
66 int scalarsPerPos
, const SkPaint
& paint
) {
67 draw
.drawPosText((const char*)text
, len
, xpos
, y
, scalarsPerPos
, paint
);
70 void SkGLDevice_SWLayer::drawTextOnPath(const SkDraw
& draw
, const void* text
,
71 size_t len
, const SkPath
& path
,
72 const SkMatrix
* matrix
,
73 const SkPaint
& paint
) {
74 draw
.drawTextOnPath((const char*)text
, len
, path
, matrix
, paint
);
77 void SkGLDevice_SWLayer::drawVertices(const SkDraw
& draw
, SkCanvas::VertexMode vmode
,
79 const SkPoint verts
[], const SkPoint textures
[],
80 const SkColor colors
[], SkXfermode
* xmode
,
81 const uint16_t indices
[], int indexCount
,
82 const SkPaint
& paint
) {
83 draw
.drawVertices(vmode
, vertexCount
, verts
, textures
, colors
, xmode
,
84 indices
, indexCount
, paint
);
87 void SkGLDevice_SWLayer::drawDevice(const SkDraw
& draw
, SkDevice
* dev
,
88 int x
, int y
, const SkPaint
& paint
) {
89 this->SkDevice::drawDevice(draw
, dev
, x
, y
, paint
);